Back to index

salome-kernel  6.5.0
SALOME_ResourcesManager.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 
00023 #ifndef __SALOME_RESOURCESMANAGER_HXX__
00024 #define __SALOME_RESOURCESMANAGER_HXX__
00025 
00026 #include "Utils_SALOME_Exception.hxx"
00027 #include "utilities.h"
00028 #include <SALOMEconfig.h>
00029 #include "SALOME_ResourcesCatalog_Handler.hxx"
00030 #include "SALOME_LoadRateManager.hxx"
00031 #include "SALOME_NamingService.hxx"
00032 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
00033 #include <string>
00034 #include <fstream>
00035 #include <vector>
00036 #include "ResourcesManager.hxx"
00037 
00038 
00039 #ifdef WIN32
00040 # if defined SALOMERESOURCESMANAGER_EXPORTS || defined SalomeResourcesManager_EXPORTS
00041 #  define SALOMERESOURCESMANAGER_EXPORT __declspec( dllexport )
00042 # else
00043 #  define SALOMERESOURCESMANAGER_EXPORT __declspec( dllimport )
00044 # endif
00045 #else
00046 # define SALOMERESOURCESMANAGER_EXPORT
00047 #endif
00048 
00049 #ifdef WNT
00050 #pragma warning(disable:4275) // Disable warning interface non dll
00051 #endif
00052 
00053 // --- WARNING ---
00054 // The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done
00055 // in a critical section to be sure to be clean.
00056 // Only one thread should use the SALOME_ResourcesManager class in a SALOME
00057 // session.
00058 
00059 class SALOMERESOURCESMANAGER_EXPORT SALOME_ResourcesManager:
00060   public POA_Engines::ResourcesManager,
00061   public PortableServer::RefCountServantBase
00062   {
00063 
00064   public:
00065 
00066     SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns, const char *xmlFilePath);
00067     SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns);
00068 
00069     ~SALOME_ResourcesManager();
00070 
00071     // CORBA Methods
00072     Engines::ResourceList * GetFittingResources(const Engines::ResourceParameters& params);
00073     char* FindFirst(const Engines::ResourceList& listOfResources);
00074     char* Find(const char *policy, const Engines::ResourceList& listOfResources);
00075     Engines::ResourceDefinition * GetResourceDefinition(const char * name);
00076     void AddResource(const Engines::ResourceDefinition& new_resource,
00077                      CORBA::Boolean write,
00078                      const char * xml_file);
00079 
00080     void RemoveResource(const char * resource_name,
00081                         CORBA::Boolean write,
00082                         const char * xml_file);
00083 
00084     // Cpp Methods
00085     void Shutdown();
00086     ResourcesManager_cpp *GetImpl() { return &_rm; }
00087     std::string getMachineFile(std::string resource_name, 
00088                                CORBA::Long nb_procs,
00089                                std::string parallelLib);
00090 
00091 
00092     static const char *_ResourcesManagerNameInNS;
00093   protected:
00094 
00095     SALOME_NamingService *_NS;
00096     CORBA::ORB_var _orb;
00097     PortableServer::POA_var _poa;
00098 
00099     //
00101     MapOfParserResourcesType _resourcesBatchList;
00102 
00103     ResourcesManager_cpp _rm;
00104   };
00105 
00106 #endif // RESSOURCESCATALOG_IMPL_H