Salome HOME
61ce9d308a3793133cb0ad17f48977cf7e6faea7
[modules/kernel.git] / src / Container / SALOME_Container_i.hxx
1 //  SALOME Container : implementation of container and engine for Kernel
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOME_Container_i.hxx
25 //  Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef _SALOME_CONTAINER_I_HXX_
30 #define _SALOME_CONTAINER_I_HXX_
31
32 #include <iostream>
33 #include <signal.h>
34 #include <stdlib.h>
35 #include <unistd.h>
36 #include <sys/types.h>
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SALOME_Component)
39 #include <omnithread.h>
40 #include <map>
41 #include <string>
42
43 class SALOME_NamingService;
44
45 class Engines_Container_i: public POA_Engines::Container,
46                 public PortableServer::RefCountServantBase
47 {
48 public:
49   Engines_Container_i();
50   Engines_Container_i(CORBA::ORB_ptr orb, 
51                       PortableServer::POA_ptr poa,
52                       char * containerName ,
53                       int argc, char* argv[]);
54 // Constructeur pour composant parallele : ne pas faire appel au naming service
55   Engines_Container_i(CORBA::ORB_ptr orb, 
56                       PortableServer::POA_ptr poa,
57                       char * containerName,
58                       int flag);
59   virtual ~Engines_Container_i();
60
61
62   Engines::Container_ptr start_impl(const char* ContainerName);
63
64   Engines::Component_ptr load_impl(const char* nameToRegister,
65                                    const char* componentName);
66   void remove_impl(Engines::Component_ptr component_i);
67   void finalize_removal();
68
69   char* name();
70   char* machineName();
71   void ping();
72   bool Kill_impl() ;
73   char* getHostName();
74   long getPID();
75
76 protected:
77
78   SALOME_NamingService *_NS ;
79   string _library_path;
80   string _containerName;
81   CORBA::ORB_var _orb;
82   PortableServer::POA_var _poa;
83   PortableServer::ObjectId * _id ;
84   int _numInstance ;
85   map<string, void *> handle_map ;
86   map<string, void *> remove_map ;
87   omni_mutex _numInstanceMutex ; // if several threads on the same object
88
89 private: 
90
91   int   _argc ;
92   char** _argv ;
93   long _pid;
94
95 };
96
97 #endif
98