Version: 9.15.0
SALOME_ResourcesManager.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, 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 
23 #ifndef __SALOME_RESOURCESMANAGER_HXX__
24 #define __SALOME_RESOURCESMANAGER_HXX__
25 
26 #include "Utils_SALOME_Exception.hxx"
27 #include "utilities.h"
28 #include <SALOMEconfig.h>
30 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
31 #include <string>
32 #include <fstream>
33 #include <vector>
34 #include <memory>
35 #include "ResourcesManager.hxx"
36 
38 
39 #ifdef WIN32
40 #pragma warning(disable:4275) // Disable warning interface non dll
41 #endif
42 
43 // --- WARNING ---
44 // The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done
45 // in a critical section to be sure to be clean.
46 // Only one thread should use the SALOME_ResourcesManager class in a SALOME
47 // session.
48 
50  public POA_Engines::ResourcesManager,
51  public PortableServer::RefCountServantBase
52  {
53 
54  public:
55 
56  SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *ns, const char *xmlFilePath);
57  SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *ns);
58 
60 
61  // CORBA Methods
62  Engines::ResourceList * GetFittingResources(const Engines::ResourceParameters& params);
63  char* FindFirst(const Engines::ResourceList& listOfResources);
64  char* Find(const char *policy, const Engines::ResourceList& listOfResources);
65  Engines::ResourceDefinition * GetResourceDefinition(const char * name);
66  void AddResource(const Engines::ResourceDefinition& new_resource,
67  CORBA::Boolean write,
68  const char * xml_file);
69 
70  void RemoveResource(const char * resource_name,
71  CORBA::Boolean write,
72  const char * xml_file);
73  char* getMachineFile(const char * resource_name,
74  CORBA::Long nb_procs,
75  const char * parallelLib);
76  void ListAllAvailableResources(Engines::ResourceList_out machines, Engines::IntegerList_out nbProcsOfMachines);
77 
78  Engines::ResourceList *ListAllResourcesInCatalog();
79 
80  Engines::ResourceList *ListAllResourceEntriesInCatalog() override;
81 
82  // Cpp Methods
83  void Shutdown();
84  std::shared_ptr<ResourcesManager_cpp>& GetImpl() { return _rm; }
85 
86 
87  static const char *_ResourcesManagerNameInNS;
88  protected:
89 
91  CORBA::ORB_var _orb;
92  PortableServer::POA_var _poa;
93  std::shared_ptr<ResourcesManager_cpp> _rm;
94  };
95 
96 #endif // RESSOURCESCATALOG_IMPL_H
#define SALOMERESOURCESMANAGER_EXPORT
Definition: SALOME_ResourcesManager_Common.hxx:33
Definition: SALOME_NamingService_Abstract.hxx:46
Definition: SALOME_ResourcesManager.hxx:52
PortableServer::POA_var _poa
Definition: SALOME_ResourcesManager.hxx:92
CORBA::ORB_var _orb
Definition: SALOME_ResourcesManager.hxx:91
std::shared_ptr< ResourcesManager_cpp > _rm
Definition: SALOME_ResourcesManager.hxx:93
SALOME_NamingService_Abstract * _NS
Definition: SALOME_ResourcesManager.hxx:90
static const char * _ResourcesManagerNameInNS
Definition: SALOME_ResourcesManager.hxx:87
std::shared_ptr< ResourcesManager_cpp > & GetImpl()
Definition: SALOME_ResourcesManager.hxx:84
sequence< string > ResourceList
Type to transmit list of resources.
Definition: SALOME_ResourcesManager.idl:35
poa
Definition: SALOME_ContainerPy.py:377
string name
Definition: pythfilter.py:56
orb
Definition: salome.py:122
Type to describe a resource.
Definition: SALOME_ResourcesManager.idl:106
Type to describe required properties of a resource.
Definition: SALOME_ResourcesManager.idl:42