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