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:
64 public virtual POA_Engines::Container,
65 public virtual PortableServer::RefCountServantBase
68 Engines_Container_i();
69 Engines_Container_i(CORBA::ORB_ptr orb,
70 PortableServer::POA_var poa,
71 char * containerName ,
72 int argc, char* argv[],
73 bool activAndRegist = true,
74 bool isServantAloneInProcess = true);
75 virtual ~Engines_Container_i();
79 virtual bool load_component_Library(const char* componentName);
81 virtual Engines::Component_ptr
82 create_component_instance( const char* componentName,
83 CORBA::Long studyId); // 0 for multiStudy
85 Engines::Component_ptr
86 find_component_instance( const char* registeredName,
87 CORBA::Long studyId); // 0 for multiStudy
89 Engines::Component_ptr
90 load_impl(const char* nameToRegister,
91 const char* componentName);
94 void remove_impl(Engines::Component_ptr component_i);
95 void finalize_removal();
99 virtual void Shutdown();
101 CORBA::Long getPID();
102 //! Kill current container
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 void decInstanceCnt(std::string genericRegisterName);
121 //??? char* machineName();
123 // --- needed for parallel components, Numerical Platon
125 int getArgc() { return _argc; }
126 char **getArgv() { return _argv; }
130 static std::map<std::string, int> _cntInstances_map;
131 static std::map<std::string, void *> _library_map; // library names, loaded
132 static std::map<std::string, void *> _toRemove_map;// library names to remove
133 static omni_mutex _numInstanceMutex ; // lib and instance protection
135 bool _isSupervContainer;
137 SALOME_NamingService *_NS ;
138 std::string _library_path;
139 std::string _containerName;
141 PortableServer::POA_var _poa;
142 PortableServer::ObjectId * _id ;
144 std::map<std::string,Engines::Component_var> _listInstances_map;
149 bool _isServantAloneInProcess;