Back to index

salome-kernel  6.5.0
SALOME_ParallelContainerProxy_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   : SALOME_ParallelContainerProxy_i.hxx
00023 //  Author : André RIBES, EDF
00024 
00025 #ifndef _SALOME_PARALLEL_CONTAINER_PROXY_I_HXX_
00026 #define _SALOME_PARALLEL_CONTAINER_PROXY_I_HXX_
00027 
00028 #include "utilities.h"
00029 #include "Basics_Utils.hxx"
00030 #include "SALOME_PACOExtensionPaCO_Engines_PACO_Container_server.hxx"
00031 #include "SALOME_ParallelGlobalProcessVar_i.hxx"
00032 #include "SALOME_NamingService.hxx"
00033 #include "RegistryConnexion.hxx"
00034 #include <map>
00035 #include <dlfcn.h>
00036 #include <paco_omni.h>
00037 
00038 #include <Python.h>
00039 #include "Container_init_python.hxx"
00040 
00041 class Container_proxy_impl_final :
00042   virtual public Engines::PACO_Container_proxy_impl,
00043   virtual public ParallelGlobalProcessVar_i
00044 {
00045   public:
00046     Container_proxy_impl_final(CORBA::ORB_ptr orb, 
00047                                paco_fabrique_thread * fab_thread,
00048                                PortableServer::POA_ptr poa,
00049                                std::string containerName,
00050                                bool is_a_return_proxy = false);
00051 
00052     virtual ~Container_proxy_impl_final();
00053 
00054     virtual void Shutdown();
00055 
00056     virtual ::CORBA::Boolean load_component_Library(const char* componentName,CORBA::String_out reason);
00057     virtual Engines::EngineComponent_ptr create_component_instance (const char* componentName,
00058                                                                     ::CORBA::Long studyId);
00059     virtual Engines::EngineComponent_ptr create_component_instance_env (const char* componentName,
00060                                                                         CORBA::Long studyId,    // 0 for multiStudy
00061                                                                         const Engines::FieldsDict& env,
00062                                                                         CORBA::String_out reason);
00063 
00064   private:
00065     std::map<std::string, std::string> _libtype_map; // libname -> libtype (seq ou par)
00066 
00067     struct proxy_object
00068     {
00069       Engines::EngineComponent_var proxy_corba_ref;
00070       PortableServer::ObjectId *   proxy_id;
00071       RegistryConnexion *          proxy_regist;
00072     };
00073 
00074     // Cette liste contient les references vers les différentes
00075     // instances d'objets parallèles.
00076     std::list<Container_proxy_impl_final::proxy_object> _par_obj_inst_list;
00077 
00078     // Fonction de test pour savoir si les objets de la bib sont
00079     // parallèles ou sequentiels
00080     typedef void (*PACO_TEST_FUNCTION) ();
00081     typedef PortableServer::ObjectId * (*FACTORY_FUNCTION) (CORBA::ORB_ptr,
00082                                                             paco_fabrique_thread *,
00083                                                             PortableServer::POA_ptr,
00084                                                             PortableServer::ObjectId *,
00085                                                             RegistryConnexion **,
00086                                                             const char *,
00087                                                             int);
00088     int _numInstance;
00089     std::string _hostname;
00090     std::string _containerName;
00091     PortableServer::POA_var _poa;
00092     PortableServer::ObjectId * _id;
00093     SALOME_NamingService *_NS;
00094 
00095     paco_fabrique_thread * _fab_thread; 
00096 };
00097 
00098 #endif