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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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 <SALOME_Container.hxx>
34 #include <SALOMEconfig.h>
35 #include CORBA_SERVER_HEADER(SALOME_Component)
43 #include <sys/types.h>
44 #include <omnithread.h>
48 class SALOME_NamingService;
50 class CONTAINER_EXPORT Engines_Container_i:
51 public virtual POA_Engines::Container,
52 public virtual PortableServer::ServantBase
55 Engines_Container_i();
56 Engines_Container_i(CORBA::ORB_ptr orb,
57 PortableServer::POA_var poa,
58 char * containerName ,
59 int argc, char* argv[],
60 bool activAndRegist = true,
61 bool isServantAloneInProcess = true);
62 virtual ~Engines_Container_i();
66 virtual bool load_component_Library(const char* componentName);
68 virtual Engines::Component_ptr
69 create_component_instance( const char* componentName,
70 CORBA::Long studyId); // 0 for multiStudy
72 Engines::Component_ptr
73 find_component_instance( const char* registeredName,
74 CORBA::Long studyId); // 0 for multiStudy
76 Engines::Component_ptr
77 load_impl(const char* nameToRegister,
78 const char* componentName);
81 void remove_impl(Engines::Component_ptr component_i);
82 void finalize_removal();
86 virtual void Shutdown();
89 //! Kill current container
92 Engines::fileRef_ptr createFileRef(const char* origFileName);
93 Engines::fileTransfer_ptr getFileTransfer();
96 // --- local C++ methods
98 Engines::Component_ptr
99 find_or_create_instance( std::string genericRegisterName,
100 std::string componentLibraryName);
102 Engines::Component_ptr
103 createInstance(std::string genericRegisterName,
107 static bool isPythonContainer(const char* ContainerName);
108 static void decInstanceCnt(std::string genericRegisterName);
109 //??? char* machineName();
111 // --- needed for parallel components, Numerical Platon
113 int getArgc() { return _argc; }
114 char **getArgv() { return _argv; }
118 static std::map<std::string, int> _cntInstances_map;
119 static std::map<std::string, void *> _library_map; // library names, loaded
120 static std::map<std::string, void *> _toRemove_map;// library names to remove
121 static omni_mutex _numInstanceMutex ; // lib and instance protection
123 bool _isSupervContainer;
125 SALOME_NamingService *_NS ;
126 std::string _library_path;
127 std::string _containerName;
129 PortableServer::POA_var _poa;
130 PortableServer::ObjectId * _id ;
132 std::map<std::string,Engines::Component_var> _listInstances_map;
133 std::map<std::string,Engines::fileRef_var> _fileRef_map;
134 Engines::fileTransfer_var _fileTransfer;
139 bool _isServantAloneInProcess;