Back to index

salome-kernel  6.5.0
MPIContainer_i.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 //  File   : MPIContainer_i.hxx
00023 //  Module : SALOME
00024 
00025 #ifndef _SALOME_PCONTAINER_
00026 #define _SALOME_PCONTAINER_ 
00027 
00028 #include <SALOMEconfig.h>
00029 #include CORBA_SERVER_HEADER(SALOME_MPIContainer)
00030 #include "SALOME_Container_i.hxx"
00031 #include "MPIObject_i.hxx"
00032 
00033 void * th_loadcomponentlibrary(void *st);
00034 void * th_createcomponentinstance(void *st);
00035 void * th_loadimpl(void *st);
00036 void * th_removeimpl(void *st);
00037 void * th_finalizeremoval(void *st);
00038 
00039 typedef struct {
00040   int ip;
00041   Engines::IORTab* tior;
00042   std::string compoName;
00043   std::string nameToRegister;
00044   long studyId;
00045   Engines::EngineComponent_ptr cptr;
00046 } thread_st;
00047 
00048 class Engines_MPIContainer_i : public POA_Engines::MPIContainer,
00049                                public Engines_Container_i,
00050                                public MPIObject_i
00051 {
00052 
00053  public:
00054   // Constructor
00055   Engines_MPIContainer_i( CORBA::ORB_ptr orb,
00056                           PortableServer::POA_ptr poa,
00057                           char * containerName,
00058                           int argc, char *argv[]);
00059   Engines_MPIContainer_i();
00060   // Destructor
00061   ~Engines_MPIContainer_i();
00062 
00063   // shutdown corba server
00064   void Shutdown();
00065 
00066   // Load a component library
00067   // synchronous version for process 0
00068   bool load_component_Library(const char* componentName, CORBA::String_out reason);
00069 
00070   // Create an instance of component
00071   // synchronous version for process 0
00072   virtual Engines::EngineComponent_ptr
00073   create_component_instance_env( const char* componentName,
00074                                  CORBA::Long studyId,          // 0 for multiStudy
00075                                  const Engines::FieldsDict& env,
00076                                  CORBA::String_out reason);
00077 
00078   // Load a component in current MPI container
00079   // synchronous version for process 0
00080   Engines::EngineComponent_ptr load_impl(const char* nameToRegister,
00081                                    const char* componentName);
00082 
00083   // Unload a component from current MPI container
00084   // synchronous version for process 0
00085   void remove_impl(Engines::EngineComponent_ptr component_i);
00086 
00087   // synchronous version for process 0
00088   void finalize_removal();
00089 
00090  private:
00091   bool Lload_component_Library(const char* componentName);
00092   Engines::EngineComponent_ptr
00093   Lcreate_component_instance( const char* componentName,
00094                               CORBA::Long studyId); // 0 for multiStudy
00095   Engines::EngineComponent_ptr Lload_impl(const char* nameToRegister,
00096                                     const char* componentName);
00097 
00098   Engines::EngineComponent_ptr
00099   createMPIInstance(std::string genericRegisterName,
00100                     void *handle,
00101                     int studyId);
00102 
00103 };
00104 #endif