Back to index

salome-kernel  6.5.0
SALOME_LifeCycleCORBA.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 //  File   : SALOME_LifeCycleCORBA.hxx
00023 //  Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
00024 //  Module : SALOME
00025 
00026 #ifndef _SALOME_LIFECYCLECORBA_HXX_
00027 #define _SALOME_LIFECYCLECORBA_HXX_
00028 
00029 #include <stdlib.h>
00030 #ifndef WIN32
00031 #include <unistd.h>
00032 #endif
00033 #include <string>
00034 
00035 #include <SALOMEconfig.h>
00036 #include <Utils_SALOME_Exception.hxx>
00037 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
00038 #include CORBA_CLIENT_HEADER(SALOME_Component)
00039 #include <iostream>
00040 
00041 #ifdef WIN32
00042 # if defined LIFECYCLECORBA_EXPORTS || defined SalomeLifeCycleCORBA_EXPORTS
00043 #  define LIFECYCLECORBA_EXPORT __declspec( dllexport )
00044 # else
00045 #  define LIFECYCLECORBA_EXPORT __declspec( dllimport )
00046 # endif
00047 #else
00048 # define LIFECYCLECORBA_EXPORT
00049 #endif
00050 
00051 
00052 class SALOME_NamingService;
00053 
00054 class LIFECYCLECORBA_EXPORT IncompatibleComponent : public SALOME_Exception
00055 {
00056 public :
00057   IncompatibleComponent(void);
00058   IncompatibleComponent(const IncompatibleComponent &ex);
00059 };
00060 
00061 class LIFECYCLECORBA_EXPORT SALOME_LifeCycleCORBA
00062 {
00063 public:
00064   SALOME_LifeCycleCORBA(SALOME_NamingService *ns = 0);
00065   virtual ~SALOME_LifeCycleCORBA();
00066 
00067   Engines::EngineComponent_ptr 
00068   FindComponent(const Engines::MachineParameters& params,
00069                 const char *componentName,
00070                 int studyId=0);
00071 
00072   Engines::EngineComponent_ptr
00073   LoadComponent(const Engines::MachineParameters& params,
00074                 const char *componentName,
00075                 int studyId=0);
00076 
00077   Engines::EngineComponent_ptr 
00078   FindOrLoad_Component(const Engines::MachineParameters& params,
00079                        const char *componentName,
00080                        int studyId =0);
00081 
00082   // SALOME 6 - Interface
00083   Engines::EngineComponent_ptr 
00084   FindOrLoad_Component(const Engines::ContainerParameters& params,
00085                        const char *componentName,
00086                        int studyId =0);
00087 
00088   Engines::EngineComponent_ptr
00089   FindOrLoad_Component(const char *containerName,
00090                        const char *componentName); // for compatibility
00091   
00092   // Parallel extension
00093   Engines::EngineComponent_ptr 
00094     Load_ParallelComponent(const Engines::ContainerParameters& params,
00095                            const char *componentName,
00096                            int studyId);
00097 
00098   bool isKnownComponentClass(const char *componentName);
00099 
00100   bool isMpiContainer(const Engines::ContainerParameters& params)
00101     throw(IncompatibleComponent);
00102 
00103   int NbProc(const Engines::ContainerParameters& params);
00104 
00105   static void preSet(Engines::MachineParameters& outparams);
00106   static void preSet(Engines::ResourceParameters& outparams);
00107   static void preSet(Engines::ContainerParameters& outparams);
00108 
00109   Engines::ContainerManager_ptr getContainerManager();
00110   Engines::ResourcesManager_ptr getResourcesManager();
00111   SALOME_NamingService * namingService();
00112   CORBA::ORB_ptr orb();
00113   void copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest);
00114 
00115   void shutdownServers();
00116   static void killOmniNames();
00117 
00118   // For SALOME 5.1.x
00119   // Will be deleted on SALOME 6
00120   void convert(const Engines::MachineParameters& params_in, 
00121                Engines::ContainerParameters& params_out);
00122 protected:
00123 
00129   Engines::EngineComponent_ptr 
00130   _FindComponent(const Engines::ContainerParameters& params,
00131                  const char *componentName,
00132                  int studyId,
00133                  const Engines::ResourceList& listOfResources);
00134 
00135   Engines::EngineComponent_ptr
00136   _LoadComponent(const Engines::ContainerParameters& params,
00137                  const char *componentName,
00138                  int studyId);
00139 
00140   SALOME_NamingService *_NS;
00141   SALOME_NamingService *_NSnew;
00142   Engines::ContainerManager_var _ContManager;
00143   Engines::ResourcesManager_var _ResManager;
00144   
00145 } ;
00146 
00147 #endif