SALOME documentation central

src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx

00001 //  Copyright (C) 2007-2008  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 //  SALOME LifeCycleCORBA : implementation of containers and engines life cycle both in Python and C++
00023 //  File   : SALOME_LifeCycleCORBA.hxx
00024 //  Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
00025 //  Module : SALOME
00026 //  $Header$
00027 //
00028 #ifndef _SALOME_LIFECYCLECORBA_HXX_
00029 #define _SALOME_LIFECYCLECORBA_HXX_
00030 
00031 #include <stdlib.h>
00032 #ifndef WIN32
00033 #include <unistd.h>
00034 #endif
00035 #include <string>
00036 
00037 #include <SALOMEconfig.h>
00038 #include <Utils_SALOME_Exception.hxx>
00039 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
00040 #include CORBA_CLIENT_HEADER(SALOME_Component)
00041 #include <iostream>
00042 
00043 #ifdef WIN32
00044 # if defined LIFECYCLECORBA_EXPORTS || defined SalomeLifeCycleCORBA_EXPORTS
00045 #  define LIFECYCLECORBA_EXPORT __declspec( dllexport )
00046 # else
00047 #  define LIFECYCLECORBA_EXPORT __declspec( dllimport )
00048 # endif
00049 #else
00050 # define LIFECYCLECORBA_EXPORT
00051 #endif
00052 
00053 
00054 class SALOME_NamingService;
00055 
00056 class LIFECYCLECORBA_EXPORT IncompatibleComponent : public SALOME_Exception
00057 {
00058 public :
00059   IncompatibleComponent(void);
00060   IncompatibleComponent(const IncompatibleComponent &ex);
00061 };
00062 
00063 class LIFECYCLECORBA_EXPORT SALOME_LifeCycleCORBA
00064 {
00065 public:
00066   SALOME_LifeCycleCORBA(SALOME_NamingService *ns = 0);
00067   virtual ~SALOME_LifeCycleCORBA();
00068 
00069   Engines::Component_ptr 
00070   FindComponent(const Engines::MachineParameters& params,
00071           const char *componentName,
00072           int studyId=0);
00073 
00074   Engines::Component_ptr
00075   LoadComponent(const Engines::MachineParameters& params,
00076           const char *componentName,
00077           int studyId=0);
00078 
00079   Engines::Component_ptr 
00080   FindOrLoad_Component(const Engines::MachineParameters& params,
00081                  const char *componentName,
00082                  int studyId =0);
00083 
00084   Engines::Component_ptr
00085   FindOrLoad_Component(const char *containerName,
00086                  const char *componentName); // for compatibility
00087   
00088   // Parallel extension
00089   Engines::Component_ptr 
00090     Load_ParallelComponent(const Engines::MachineParameters& params,
00091                            const char *componentName,
00092                            int studyId);
00093 
00094   bool isKnownComponentClass(const char *componentName);
00095 
00096   bool isMpiContainer(const Engines::MachineParameters& params)
00097     throw(IncompatibleComponent);
00098 
00099   int NbProc(const Engines::MachineParameters& params);
00100 
00101   static void preSet(Engines::MachineParameters& outparams);
00102 
00103   Engines::ContainerManager_ptr getContainerManager();
00104   Engines::ResourcesManager_ptr getResourcesManager();
00105   SALOME_NamingService * namingService();
00106   CORBA::ORB_ptr orb();
00107   void copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest);
00108 
00109   void shutdownServers();
00110   static void killOmniNames();
00111 
00112 protected:
00113 
00119   Engines::Component_ptr 
00120   _FindComponent(const Engines::MachineParameters& params,
00121            const char *componentName,
00122            int studyId,
00123            const Engines::MachineList& listOfMachines);
00124 
00125   Engines::Component_ptr
00126   _LoadComponent(const Engines::MachineParameters& params,
00127            const char *componentName,
00128            int studyId);
00129   
00130   SALOME_NamingService *_NS;
00131   SALOME_NamingService *_NSnew;
00132   Engines::ContainerManager_var _ContManager;
00133   Engines::ResourcesManager_var _ResManager;
00134   
00135 } ;
00136 
00137 #endif