Version: 8.3.0
SALOME_ResourcesCatalog_Parser.hxx
Go to the documentation of this file.
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 
23 // SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
24 // File : SALOME_ResourcesCatalog_Parser.hxx
25 // Author : Estelle Deville
26 // Module : SALOME
27 //$Header$
28 //
29 #ifndef SALOME_RESOURCES_CATALOG_PARSER
30 #define SALOME_RESOURCES_CATALOG_PARSER
31 
33 
34 #include <string>
35 #include <vector>
36 #include <list>
37 #include <map>
38 #include <iostream>
39 
40 #ifdef WIN32
41 #pragma warning(disable:4251) // Warning DLL Interface ...
42 #endif
43 
45 
47 
49 
51 
53 {
54 public:
55  const std::string msg;
56 
57  ResourcesException(const std::string m) : msg(m) {}
58 };
59 
61  {
62 
63  public:
64  std::string _Name;
65  unsigned int _nbOfNodes;
66  unsigned int _nbOfProcPerNode;
67  unsigned int _CPUFreqMHz;
68  unsigned int _memInMB;
69  static unsigned int _nbOfProcWanted;
70  static unsigned int _nbOfNodesWanted;
71  static unsigned int _nbOfProcPerNodeWanted;
72  static unsigned int _CPUFreqMHzWanted;
73  static unsigned int _memInMBWanted;
74 
75  public:
77  ResourceDataToSort(const std::string& name,
78  unsigned int nbOfNodes,
79  unsigned int nbOfProcPerNode,
80  unsigned int CPUFreqMHz,
81  unsigned int memInMB);
82  bool operator< (const ResourceDataToSort& other) const;
83  void Print() const;
84 
85  private:
86  unsigned int GetNumberOfPoints() const;
87  };
88 
90 {
91 public:
93  virtual ~ParserResourcesType();
94 
95  std::string getAccessProtocolTypeStr() const;
96  std::string getResourceTypeStr() const;
97  std::string getBatchTypeStr() const;
98  std::string getMpiImplTypeStr() const;
99  std::string getClusterInternalProtocolStr() const;
100  std::string getCanLaunchBatchJobsStr() const;
101  std::string getCanRunContainersStr() const;
102 
103  void setAccessProtocolTypeStr(const std::string & protocolTypeStr);
104  void setResourceTypeStr(const std::string & resourceTypeStr);
105  void setBatchTypeStr(const std::string & batchTypeStr);
106  void setMpiImplTypeStr(const std::string & mpiImplTypeStr);
107  void setClusterInternalProtocolStr(const std::string & internalProtocolTypeStr);
108  void setCanLaunchBatchJobsStr(const std::string & canLaunchBatchJobsStr);
109  void setCanRunContainersStr(const std::string & canRunContainersStr);
110 
112  std::string Name;
113  std::string HostName;
119  std::string UserName;
120  std::string AppliPath;
121  std::vector<std::string> ComponentsList;
122  std::vector<std::string> ModulesList;
123  std::string OS;
124  std::string batchQueue;
125  std::string userCommands;
126  std::string use;
127  std::list<ParserResourcesType> ClusterMembersList;
128  unsigned int nbOfProc;
131  std::string working_directory;
132 
133 protected:
134 
135  static std::string protocolToString(AccessProtocolType protocol);
136  static AccessProtocolType stringToProtocol(const std::string & protocolStr);
137 
138  RESOURCESMANAGER_EXPORT friend std::ostream & operator<<(std::ostream &os,
139  const ParserResourcesType &rt);
140 
141 };
142 
143 typedef std::map<std::string, ParserResourcesType> MapOfParserResourcesType;
144 typedef std::map<std::string, ParserResourcesType>::iterator MapOfParserResourcesType_it;
145 
146 #endif //SALOME_RESOURCES_CATALOG_PARSER