]> SALOME platform Git repositories - modules/kernel.git/blob - src/MPIContainer/MPIContainer_i.hxx
Salome HOME
the dump state for batch of yacs file is optional
[modules/kernel.git] / src / MPIContainer / MPIContainer_i.hxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SALOME MPIContainer : implemenation of container based on MPI libraries
24 //  File   : MPIContainer_i.hxx
25 //  Module : SALOME
26 //
27 #ifndef _SALOME_PCONTAINER_
28 #define _SALOME_PCONTAINER_ 
29
30 #include <SALOMEconfig.h>
31 #include CORBA_SERVER_HEADER(SALOME_MPIContainer)
32 #include "SALOME_Container_i.hxx"
33 #include "MPIObject_i.hxx"
34
35 void * th_loadcomponentlibrary(void *st);
36 void * th_createcomponentinstance(void *st);
37 void * th_loadimpl(void *st);
38 void * th_removeimpl(void *st);
39 void * th_finalizeremoval(void *st);
40
41 typedef struct {
42   int ip;
43   Engines::IORTab* tior;
44   std::string compoName;
45   std::string nameToRegister;
46   long studyId;
47   Engines::Component_ptr cptr;
48 } thread_st;
49
50 class Engines_MPIContainer_i : public POA_Engines::MPIContainer,
51                                public Engines_Container_i,
52                                public MPIObject_i
53 {
54
55  public:
56   // Constructor
57   Engines_MPIContainer_i( CORBA::ORB_ptr orb,
58                           PortableServer::POA_ptr poa,
59                           char * containerName,
60                           int argc, char *argv[]);
61   Engines_MPIContainer_i();
62   // Destructor
63   ~Engines_MPIContainer_i();
64
65   // shutdown corba server
66   void Shutdown();
67
68   // Load a component library
69   // synchronous version for process 0
70   bool load_component_Library(const char* componentName, CORBA::String_out reason);
71
72   // Create an instance of component
73   // synchronous version for process 0
74   virtual Engines::Component_ptr
75   create_component_instance_env( const char* componentName,
76                                  CORBA::Long studyId,          // 0 for multiStudy
77                                  const Engines::FieldsDict& env,
78                                  CORBA::String_out reason);
79
80   // Load a component in current MPI container
81   // synchronous version for process 0
82   Engines::Component_ptr load_impl(const char* nameToRegister,
83                                    const char* componentName);
84
85   // Unload a component from current MPI container
86   // synchronous version for process 0
87   void remove_impl(Engines::Component_ptr component_i);
88
89   // synchronous version for process 0
90   void finalize_removal();
91
92  private:
93   bool Lload_component_Library(const char* componentName);
94   Engines::Component_ptr
95   Lcreate_component_instance( const char* componentName,
96                               CORBA::Long studyId); // 0 for multiStudy
97   Engines::Component_ptr Lload_impl(const char* nameToRegister,
98                                     const char* componentName);
99
100   Engines::Component_ptr
101   createMPIInstance(std::string genericRegisterName,
102                     void *handle,
103                     int studyId);
104
105 };
106 #endif