Version: 6.5.0
SALOME_LifeCycleCORBA.hxx
1 // Copyright (C) 2007-2012 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 // File : SALOME_LifeCycleCORBA.hxx
23 // Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
24 // Module : SALOME
25 
26 #ifndef _SALOME_LIFECYCLECORBA_HXX_
27 #define _SALOME_LIFECYCLECORBA_HXX_
28 
29 #include <stdlib.h>
30 #ifndef WIN32
31 #include <unistd.h>
32 #endif
33 #include <string>
34 
35 #include <SALOMEconfig.h>
36 #include <Utils_SALOME_Exception.hxx>
37 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
38 #include CORBA_CLIENT_HEADER(SALOME_Component)
39 #include <iostream>
40 
41 #ifdef WIN32
42 # if defined LIFECYCLECORBA_EXPORTS || defined SalomeLifeCycleCORBA_EXPORTS
43 # define LIFECYCLECORBA_EXPORT __declspec( dllexport )
44 # else
45 # define LIFECYCLECORBA_EXPORT __declspec( dllimport )
46 # endif
47 #else
48 # define LIFECYCLECORBA_EXPORT
49 #endif
50 
51 
53 
54 class LIFECYCLECORBA_EXPORT IncompatibleComponent : public SALOME_Exception
55 {
56 public :
59 };
60 
61 class LIFECYCLECORBA_EXPORT SALOME_LifeCycleCORBA
62 {
63 public:
65  virtual ~SALOME_LifeCycleCORBA();
66 
67  Engines::EngineComponent_ptr
68  FindComponent(const Engines::MachineParameters& params,
69  const char *componentName,
70  int studyId=0);
71 
72  Engines::EngineComponent_ptr
73  LoadComponent(const Engines::MachineParameters& params,
74  const char *componentName,
75  int studyId=0);
76 
77  Engines::EngineComponent_ptr
78  FindOrLoad_Component(const Engines::MachineParameters& params,
79  const char *componentName,
80  int studyId =0);
81 
82  // SALOME 6 - Interface
83  Engines::EngineComponent_ptr
84  FindOrLoad_Component(const Engines::ContainerParameters& params,
85  const char *componentName,
86  int studyId =0);
87 
88  Engines::EngineComponent_ptr
89  FindOrLoad_Component(const char *containerName,
90  const char *componentName); // for compatibility
91 
92  // Parallel extension
93  Engines::EngineComponent_ptr
94  Load_ParallelComponent(const Engines::ContainerParameters& params,
95  const char *componentName,
96  int studyId);
97 
98  bool isKnownComponentClass(const char *componentName);
99 
100  bool isMpiContainer(const Engines::ContainerParameters& params)
101  throw(IncompatibleComponent);
102 
103  int NbProc(const Engines::ContainerParameters& params);
104 
105  static void preSet(Engines::MachineParameters& outparams);
106  static void preSet(Engines::ResourceParameters& outparams);
107  static void preSet(Engines::ContainerParameters& outparams);
108 
109  Engines::ContainerManager_ptr getContainerManager();
110  Engines::ResourcesManager_ptr getResourcesManager();
111  SALOME_NamingService * namingService();
112  CORBA::ORB_ptr orb();
113  void copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest);
114 
115  void shutdownServers();
116  static void killOmniNames();
117 
118  // For SALOME 5.1.x
119  // Will be deleted on SALOME 6
120  void convert(const Engines::MachineParameters& params_in,
121  Engines::ContainerParameters& params_out);
122 protected:
123 
129  Engines::EngineComponent_ptr
130  _FindComponent(const Engines::ContainerParameters& params,
131  const char *componentName,
132  int studyId,
133  const Engines::ResourceList& listOfResources);
134 
135  Engines::EngineComponent_ptr
136  _LoadComponent(const Engines::ContainerParameters& params,
137  const char *componentName,
138  int studyId);
139 
141  SALOME_NamingService *_NSnew;
142  Engines::ContainerManager_var _ContManager;
143  Engines::ResourcesManager_var _ResManager;
144 
145 } ;
146 
147 #endif
A class to manage life cycle of SALOME components.
Definition: SALOME_LifeCycleCORBA.hxx:61
A class to manage the SALOME naming service.
Definition: SALOME_NamingService.hxx:48
Type to describe required properties of a resource.
Definition: SALOME_ContainerManager.idl:54
Type to describe required properties of a container.
Definition: SALOME_ContainerManager.idl:301
Definition: SALOME_LifeCycleCORBA.hxx:54
Definition: Utils_SALOME_Exception.hxx:67
sequence< string > ResourceList
Type to transmit list of resources.
Definition: SALOME_ContainerManager.idl:36
Type to describe required properties of a container.
Definition: SALOME_ContainerManager.idl:86
Copyright © 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS