1 // SALOME Container : implementation of container and engine for Kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOME_Container_i.hxx
25 // Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
29 #ifndef _SALOME_CONTAINER_I_HXX_
30 #define _SALOME_CONTAINER_I_HXX_
32 #include <SALOMEconfig.h>
33 #include CORBA_SERVER_HEADER(SALOME_Component)
41 #include <sys/types.h>
42 #include <omnithread.h>
46 class SALOME_NamingService;
49 #if defined CONTAINER_EXPORTS
51 #define CONTAINER_EXPORT __declspec( dllexport )
53 #define CONTAINER_EXPORT
57 #define CONTAINER_EXPORT __declspec( dllimport )
59 #define CONTAINER_EXPORT
63 class CONTAINER_EXPORT Engines_Container_i: public virtual POA_Engines::Container,
64 public virtual PortableServer::RefCountServantBase
67 Engines_Container_i();
68 Engines_Container_i(CORBA::ORB_ptr orb,
69 PortableServer::POA_ptr poa,
70 char * containerName ,
71 int argc, char* argv[],
72 bool activAndRegist = true,
73 bool isServantAloneInProcess = true);
74 virtual ~Engines_Container_i();
78 bool load_component_Library(const char* componentName);
80 Engines::Component_ptr
81 create_component_instance( const char* componentName,
82 CORBA::Long studyId); // 0 for multiStudy
84 Engines::Component_ptr
85 find_component_instance( const char* registeredName,
86 CORBA::Long studyId); // 0 for multiStudy
88 Engines::Component_ptr
89 load_impl(const char* nameToRegister,
90 const char* componentName);
93 void remove_impl(Engines::Component_ptr component_i);
94 void finalize_removal();
104 //char* machineName();
105 //Engines::Component_ptr instance(const char* nameToRegister,
106 // const char* componentName);
108 // --- local C++ methods
110 Engines::Component_ptr
111 find_or_create_instance( std::string genericRegisterName,
112 std::string componentLibraryName);
114 Engines::Component_ptr
115 createInstance(std::string genericRegisterName,
119 static bool isPythonContainer(const char* ContainerName);
120 static std::string BuildContainerNameForNS(const char *ContainerName,
121 const char *hostname);
122 static void decInstanceCnt(std::string genericRegisterName);
126 static const char *_defaultContainerName;
127 static std::map<std::string, int> _cntInstances_map;
128 static std::map<std::string, void *> _library_map; // library names, loaded
129 static std::map<std::string, void *> _toRemove_map;// library names to remove
130 static omni_mutex _numInstanceMutex ; // lib and instance protection
132 bool _isSupervContainer;
134 SALOME_NamingService *_NS ;
135 std::string _library_path;
136 std::string _containerName;
138 PortableServer::POA_var _poa;
139 PortableServer::ObjectId * _id ;
141 std::map<std::string,Engines::Component_var> _listInstances_map;
148 bool _isServantAloneInProcess;