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