Salome HOME
Merge multi-study removal branch.
[modules/kernel.git] / src / LifeCycleCORBA / SALOME_LifeCycleCORBA.hxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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
52 class SALOME_NamingService;
53
54 class LIFECYCLECORBA_EXPORT IncompatibleComponent : public SALOME_Exception
55 {
56 public :
57   IncompatibleComponent(void);
58   IncompatibleComponent(const IncompatibleComponent &ex);
59 };
60
61 class LIFECYCLECORBA_EXPORT SALOME_LifeCycleCORBA
62 {
63 public:
64   SALOME_LifeCycleCORBA(SALOME_NamingService *ns = 0);
65   virtual ~SALOME_LifeCycleCORBA();
66
67   Engines::EngineComponent_ptr 
68   FindComponent(const Engines::ContainerParameters& params,
69                 const char *componentName);
70
71   Engines::EngineComponent_ptr
72   LoadComponent(const Engines::ContainerParameters& params,
73                 const char *componentName);
74
75   Engines::EngineComponent_ptr 
76   FindOrLoad_Component(const Engines::ContainerParameters& params,
77                        const char *componentName);
78
79   Engines::EngineComponent_ptr
80   FindOrLoad_Component(const char *containerName,
81                        const char *componentName);
82   
83   // Parallel extension
84   Engines::EngineComponent_ptr 
85     Load_ParallelComponent(const Engines::ContainerParameters& params,
86                            const char *componentName);
87
88   bool isKnownComponentClass(const char *componentName);
89
90   int NbProc(const Engines::ContainerParameters& params);
91
92   static void preSet(Engines::ResourceParameters& outparams);
93   static void preSet(Engines::ContainerParameters& outparams);
94
95   Engines::ContainerManager_ptr getContainerManager();
96   Engines::ResourcesManager_ptr getResourcesManager();
97   SALOME_NamingService * namingService();
98   CORBA::ORB_ptr orb();
99   void copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest);
100
101   void shutdownServers();
102   static void killOmniNames();
103
104 protected:
105
106   /*! Establish if a component called "componentName" in a container called
107    *  "containerName"
108    *  exists among the list of resources in "listOfMachines".
109    *  This method uses Naming Service to find the component.
110    */
111   Engines::EngineComponent_ptr 
112   _FindComponent(const Engines::ContainerParameters& params,
113                  const char *componentName,
114                  const Engines::ResourceList& listOfResources);
115
116   Engines::EngineComponent_ptr
117   _LoadComponent(const Engines::ContainerParameters& params,
118                  const char *componentName);
119
120   SALOME_NamingService *_NS;
121   SALOME_NamingService *_NSnew;
122   Engines::ContainerManager_var _ContManager;
123   Engines::ResourcesManager_var _ResManager;
124   
125 } ;
126
127 #endif