Salome HOME
- New Version with PaCO++
[modules/kernel.git] / src / ParallelContainer / SALOME_ParallelContainerProxy_i.hxx
1 //  Copyright (C) 2007-2008  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_ParallelContainerProxy : implementation of container and engine for Parallel Kernel
23 //  File   : SALOME_ParallelContainerProxy_i.hxx
24 //  Author : André RIBES, EDF
25
26 #ifndef _SALOME_PARALLEL_CONTAINER_PROXY_I_HXX_
27 #define _SALOME_PARALLEL_CONTAINER_PROXY_I_HXX_
28
29 #include "utilities.h"
30 #include "Basics_Utils.hxx"
31 #include "SALOME_PACOExtensionPaCO_Engines_PACO_Container_server.hxx"
32 #include "SALOME_ParallelGlobalProcessVar_i.hxx"
33 #include "SALOME_NamingService.hxx"
34 #include "RegistryConnexion.hxx"
35 #include <map>
36 #include <dlfcn.h>
37 #include <paco_omni.h>
38
39 #include <Python.h>
40 #include "Container_init_python.hxx"
41
42 class Container_proxy_impl_final :
43   virtual public Engines::PACO_Container_proxy_impl,
44   virtual public ParallelGlobalProcessVar_i
45 {
46   public:
47     Container_proxy_impl_final(CORBA::ORB_ptr orb, 
48                                paco_fabrique_thread * fab_thread,
49                                PortableServer::POA_ptr poa,
50                                std::string containerName,
51                                bool is_a_return_proxy = false);
52
53     virtual ~Container_proxy_impl_final();
54
55     virtual void Shutdown();
56
57     virtual ::CORBA::Boolean load_component_Library(const char* componentName);
58     virtual Engines::Component_ptr create_component_instance(const char* componentName, ::CORBA::Long studyId);
59
60   private:
61     std::map<std::string, std::string> _libtype_map; // libname -> libtype (seq ou par)
62
63     struct proxy_object
64     {
65       Engines::Component_var     proxy_corba_ref;
66       PortableServer::ObjectId * proxy_id;
67       RegistryConnexion *        proxy_regist;
68     };
69
70     // Cette liste contient les references vers les différentes
71     // instances d'objets parallèles.
72     std::list<Container_proxy_impl_final::proxy_object> _par_obj_inst_list;
73
74     // Fonction de test pour savoir si les objets de la bib sont
75     // parallèles ou sequentiels
76     typedef void (*PACO_TEST_FUNCTION) ();
77     typedef PortableServer::ObjectId * (*FACTORY_FUNCTION) (CORBA::ORB_ptr,
78                                                             paco_fabrique_thread *,
79                                                             PortableServer::POA_ptr,
80                                                             PortableServer::ObjectId *,
81                                                             RegistryConnexion **,
82                                                             const char *,
83                                                             int);
84     int _numInstance;
85     std::string _hostname;
86     std::string _containerName;
87     PortableServer::POA_var _poa;
88     PortableServer::ObjectId * _id;
89     SALOME_NamingService *_NS;
90
91     paco_fabrique_thread * _fab_thread; 
92 };
93
94 #endif