1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SALOME LifeCycleCORBA : implementation of containers and engines life cycle both in Python and C++
23 // File : SALOME_LifeCycleCORBA.hxx
24 // Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
28 #ifndef _SALOME_LIFECYCLECORBA_HXX_
29 #define _SALOME_LIFECYCLECORBA_HXX_
37 #include <SALOMEconfig.h>
38 #include <Utils_SALOME_Exception.hxx>
39 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
40 #include CORBA_CLIENT_HEADER(SALOME_Component)
44 # if defined LIFECYCLECORBA_EXPORTS || defined SalomeLifeCycleCORBA_EXPORTS
45 # define LIFECYCLECORBA_EXPORT __declspec( dllexport )
47 # define LIFECYCLECORBA_EXPORT __declspec( dllimport )
50 # define LIFECYCLECORBA_EXPORT
54 class SALOME_NamingService;
56 class LIFECYCLECORBA_EXPORT IncompatibleComponent : public SALOME_Exception
59 IncompatibleComponent(void);
60 IncompatibleComponent(const IncompatibleComponent &ex);
63 class LIFECYCLECORBA_EXPORT SALOME_LifeCycleCORBA
66 SALOME_LifeCycleCORBA(SALOME_NamingService *ns = 0);
67 virtual ~SALOME_LifeCycleCORBA();
69 Engines::Component_ptr
70 FindComponent(const Engines::MachineParameters& params,
71 const char *componentName,
74 Engines::Component_ptr
75 LoadComponent(const Engines::MachineParameters& params,
76 const char *componentName,
79 Engines::Component_ptr
80 FindOrLoad_Component(const Engines::MachineParameters& params,
81 const char *componentName,
84 // SALOME 6 - Interface
85 Engines::Component_ptr
86 FindOrLoad_Component(const Engines::ContainerParameters& params,
87 const char *componentName,
90 Engines::Component_ptr
91 FindOrLoad_Component(const char *containerName,
92 const char *componentName); // for compatibility
95 Engines::Component_ptr
96 Load_ParallelComponent(const Engines::ContainerParameters& params,
97 const char *componentName,
100 bool isKnownComponentClass(const char *componentName);
102 bool isMpiContainer(const Engines::ContainerParameters& params)
103 throw(IncompatibleComponent);
105 int NbProc(const Engines::ContainerParameters& params);
107 static void preSet(Engines::MachineParameters& outparams);
108 static void preSet(Engines::ResourceParameters& outparams);
109 static void preSet(Engines::ContainerParameters& outparams);
111 Engines::ContainerManager_ptr getContainerManager();
112 Engines::ResourcesManager_ptr getResourcesManager();
113 SALOME_NamingService * namingService();
114 CORBA::ORB_ptr orb();
115 void copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest);
117 void shutdownServers();
118 static void killOmniNames();
121 // Will be deleted on SALOME 6
122 void convert(const Engines::MachineParameters& params_in,
123 Engines::ContainerParameters& params_out);
126 /*! Establish if a component called "componentName" in a container called
128 * exists among the list of resources in "listOfMachines".
129 * This method uses Naming Service to find the component.
131 Engines::Component_ptr
132 _FindComponent(const Engines::ContainerParameters& params,
133 const char *componentName,
135 const Engines::ResourceList& listOfResources);
137 Engines::Component_ptr
138 _LoadComponent(const Engines::ContainerParameters& params,
139 const char *componentName,
142 SALOME_NamingService *_NS;
143 SALOME_NamingService *_NSnew;
144 Engines::ContainerManager_var _ContManager;
145 Engines::ResourcesManager_var _ResManager;