Salome HOME
A patch from Paul RASCLE for: kernel documentation with doxygen, modification on...
[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 #include <iostream>
43 using namespace std;
44 #ifdef WNT
45 # if defined LIFECYCLECORBA_EXPORTS
46 #  define LIFECYCLECORBA_EXPORT __declspec( dllexport )
47 # else
48 #  define LIFECYCLECORBA_EXPORT __declspec( dllimport )
49 # endif
50 #else
51 # define LIFECYCLECORBA_EXPORT
52 #endif
53
54
55 class SALOME_NamingService;
56
57 class LIFECYCLECORBA_EXPORT IncompatibleComponent : public SALOME_Exception
58 {
59 public :
60   IncompatibleComponent(void);
61   IncompatibleComponent(const IncompatibleComponent &ex);
62 };
63
64 class LIFECYCLECORBA_EXPORT SALOME_LifeCycleCORBA
65 {
66 public:
67   SALOME_LifeCycleCORBA(SALOME_NamingService *ns = 0);
68   virtual ~SALOME_LifeCycleCORBA();
69
70   Engines::Component_ptr 
71   FindComponent(const Engines::MachineParameters& params,
72                 const char *componentName,
73                 int studyId=0);
74
75   Engines::Component_ptr
76   LoadComponent(const Engines::MachineParameters& params,
77                 const char *componentName,
78                 int studyId=0);
79
80   Engines::Component_ptr 
81   FindOrLoad_Component(const Engines::MachineParameters& params,
82                        const char *componentName,
83                        int studyId =0);
84
85   Engines::Component_ptr
86   FindOrLoad_Component(const char *containerName,
87                        const char *componentName); // for compatibility
88   
89   // Parallel extension
90   Engines::Component_ptr 
91     Load_ParallelComponent(const Engines::MachineParameters& params,
92                            const char *componentName,
93                            int studyId);
94
95   bool isKnownComponentClass(const char *componentName);
96
97   bool isMpiContainer(const Engines::MachineParameters& params)
98     throw(IncompatibleComponent);
99
100   int NbProc(const Engines::MachineParameters& params);
101
102   void preSet(Engines::MachineParameters& params);
103
104   Engines::ContainerManager_ptr getContainerManager();
105   Engines::ResourcesManager_ptr getResourcesManager();
106
107 protected:
108
109   /*! Establish if a component called "componentName" in a container called
110    *  "containerName"
111    *  exists among the list of resources in "listOfMachines".
112    *  This method uses Naming Service to find the component.
113    */
114   Engines::Component_ptr 
115   _FindComponent(const Engines::MachineParameters& params,
116                  const char *componentName,
117                  int studyId,
118                  const Engines::MachineList& listOfMachines);
119
120   Engines::Component_ptr
121   _LoadComponent(const Engines::MachineParameters& params,
122                  const char *componentName,
123                  int studyId,
124                  const Engines::MachineList& listOfMachines);
125   
126   SALOME_NamingService *_NS;
127   Engines::ContainerManager_var _ContManager;
128   Engines::ResourcesManager_var _ResManager;
129   
130 } ;
131
132 #endif