1 // SALOME_ParallelContainer : implementation of container and engine for Parallel Kernel
3 // Copyright (C) 2007 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
22 // File : SALOME_ParallelContainer_i.hxx
23 // Author : André RIBES, EDF
24 // Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
26 #ifndef _SALOME_PARALLEL_CONTAINER_I_HXX_
27 #define _SALOME_PARALLEL_CONTAINER_I_HXX_
29 #include <SALOMEconfig.h>
31 #include "SALOME_ComponentPaCO_Engines_Container_server.h"
39 #include <sys/types.h>
40 #include <omnithread.h>
44 class SALOME_NamingService;
47 #if defined CONTAINER_EXPORTS
49 #define CONTAINER_EXPORT __declspec( dllexport )
51 #define CONTAINER_EXPORT
55 #define CONTAINER_EXPORT __declspec( dllimport )
57 #define CONTAINER_EXPORT
61 class CONTAINER_EXPORT Engines_Parallel_Container_i:
62 /* public virtual POA_Engines::Container, */
63 public Engines::Container_serv,
64 public virtual PortableServer::RefCountServantBase
67 Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior, int rank);
68 Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior, int rank,
69 PortableServer::POA_ptr poa,
70 char * containerName ,
71 int argc, char* argv[],
72 bool activAndRegist = true,
73 bool isServantAloneInProcess = true);
74 virtual ~Engines_Parallel_Container_i();
78 virtual bool load_component_Library(const char* componentName);
80 virtual 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();
100 void logfilename(const char* name);
102 virtual void Shutdown();
104 CORBA::Long getPID();
105 //! Kill current container
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 Engines::Component_ptr
120 createParallelInstance(std::string genericRegisterName,
124 static bool isPythonContainer(const char* ContainerName);
125 static void decInstanceCnt(std::string genericRegisterName);
127 // --- needed for parallel components, Numerical Platon
129 int getArgc() { return _argc; }
130 char **getArgv() { return _argv; }
132 void set_id(PortableServer::ObjectId * id) { _id = id;}
134 Engines::fileRef_ptr createFileRef(const char* origFileName);
135 Engines::fileTransfer_ptr getFileTransfer();
137 virtual Engines::Salome_file_ptr createSalome_file(const char* origFileName);
140 static std::map<std::string, int> _cntInstances_map;
141 static std::map<std::string, void *> _library_map; // library names, loaded
142 static std::map<std::string, void *> _toRemove_map;// library names to remove
143 static omni_mutex _numInstanceMutex ; // lib and instance protection
145 bool _isSupervContainer;
147 SALOME_NamingService *_NS ;
148 std::string _library_path;
149 std::string _containerName;
150 std::string _logfilename;
152 PortableServer::POA_var _poa;
153 PortableServer::ObjectId * _id ;
155 std::map<std::string,Engines::Component_var> _listInstances_map;
156 std::map<std::string,Engines::fileRef_var> _fileRef_map;
157 std::map<std::string,Engines::Salome_file_var> _Salome_file_map;
158 Engines::fileTransfer_var _fileTransfer;
163 bool _isServantAloneInProcess;