]> SALOME platform Git repositories - modules/kernel.git/blob - src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx
Salome HOME
Merging with WPDev
[modules/kernel.git] / src / LifeCycleCORBA / SALOME_LifeCycleCORBA.hxx
1 //  SALOME LifeCycleCORBA : implementation of containers and engines life cycle both in Python and C++
2 //
3 //  Copyright (C) 2003  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 //
23 //
24 //  File   : SALOME_LifeCycleCORBA.hxx
25 //  Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef _SALOME_LIFECYCLECORBA_HXX_
30 #define _SALOME_LIFECYCLECORBA_HXX_
31
32 #include <stdlib.h>
33 #ifndef WNT
34 #include <unistd.h>
35 #endif
36 #include <string>
37
38 #include <SALOMEconfig.h>
39 #include <Utils_SALOME_Exception.hxx>
40 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
41 #include CORBA_CLIENT_HEADER(SALOME_Component)
42
43 #ifdef WNT
44 # if defined LIFECYCLECORBA_EXPORTS
45 #  define LIFECYCLECORBA_EXPORT __declspec( dllexport )
46 # else
47 #  define LIFECYCLECORBA_EXPORT __declspec( dllimport )
48 # endif
49 #else
50 # define LIFECYCLECORBA_EXPORT
51 #endif
52
53
54 class SALOME_NamingService;
55
56 class LIFECYCLECORBA_EXPORT IncompatibleComponent : public SALOME_Exception
57 {
58 public :
59   IncompatibleComponent(void);
60   IncompatibleComponent(const IncompatibleComponent &ex);
61 };
62
63 class LIFECYCLECORBA_EXPORT SALOME_LifeCycleCORBA
64 {
65 public:
66   SALOME_LifeCycleCORBA(SALOME_NamingService *ns = 0);
67   virtual ~SALOME_LifeCycleCORBA();
68
69   Engines::Component_ptr 
70   FindComponent(const Engines::MachineParameters& params,
71                 const char *componentName,
72                 int studyId=0);
73
74   Engines::Component_ptr
75   LoadComponent(const Engines::MachineParameters& params,
76                 const char *componentName,
77                 int studyId=0);
78
79   Engines::Component_ptr 
80   FindOrLoad_Component(const Engines::MachineParameters& params,
81                        const char *componentName,
82                        int studyId =0);
83
84   Engines::Component_ptr
85   FindOrLoad_Component(const char *containerName,
86                        const char *componentName); // for compatibility
87   
88   bool isKnownComponentClass(const char *componentName);
89
90   bool isMpiContainer(const Engines::MachineParameters& params)
91     throw(IncompatibleComponent);
92
93   int NbProc(const Engines::MachineParameters& params);
94
95   void preSet(Engines::MachineParameters& params);
96
97   Engines::ContainerManager_ptr getContainerManager();
98
99 protected:
100
101   /*! Establish if a component called "componentName" in a container called
102    *  "containerName"
103    *  exists among the list of resources in "listOfMachines".
104    *  This method uses Naming Service to find the component.
105    */
106   Engines::Component_ptr 
107   _FindComponent(const Engines::MachineParameters& params,
108                  const char *componentName,
109                  int studyId,
110                  const Engines::MachineList& listOfMachines);
111
112   Engines::Component_ptr
113   _LoadComponent(const Engines::MachineParameters& params,
114                  const char *componentName,
115                  int studyId,
116                  const Engines::MachineList& listOfMachines);
117   
118   SALOME_NamingService *_NS;
119   Engines::ContainerManager_var _ContManager;
120   
121 } ;
122
123 #endif