Salome HOME
Merge from mergeto_V5_1_main_19Jan10
[modules/kernel.git] / src / ResourcesManager / SALOME_ResourcesCatalog_Parser.hxx
1 //  Copyright (C) 2007-2008  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.
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 //  SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
23 //  File   : SALOME_ResourcesCatalog_Parser.hxx
24 //  Author : Estelle Deville
25 //  Module : SALOME
26 //$Header$
27 //
28 #ifndef SALOME_RESOURCES_CATALOG_PARSER
29 #define SALOME_RESOURCES_CATALOG_PARSER
30
31 #include "ResourcesManager_Defs.hxx"
32
33 #include <string>
34 #include <vector>
35 #include <list>
36 #include <map>
37 #include <iostream>
38
39 enum AccessProtocolType {rsh, ssh};
40
41 enum AccessModeType {interactive, batch};
42
43 enum BatchType {none, pbs, lsf, sge, ssh_batch};
44
45 enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, slurm, prun};
46
47 class RESOURCESMANAGER_EXPORT ResourceDataToSort
48   {
49
50   public:
51     std::string _Name;
52     unsigned int _nbOfNodes;
53     unsigned int _nbOfProcPerNode;
54     unsigned int _CPUFreqMHz;
55     unsigned int _memInMB;
56     static unsigned int _nbOfProcWanted;
57     static unsigned int _nbOfNodesWanted;
58     static unsigned int _nbOfProcPerNodeWanted;
59     static unsigned int _CPUFreqMHzWanted;
60     static unsigned int _memInMBWanted;
61
62   public:
63     ResourceDataToSort();
64     ResourceDataToSort(const std::string& name,
65                        unsigned int nbOfNodes,
66                        unsigned int nbOfProcPerNode,
67                        unsigned int CPUFreqMHz,
68                        unsigned int memInMB);
69     bool operator< (const ResourceDataToSort& other) const;
70     void Print() const;
71
72   private:
73     unsigned int GetNumberOfPoints() const;
74   };
75
76 struct RESOURCESMANAGER_EXPORT ParserResourcesClusterMembersType
77 {
78   std::string HostName;
79   AccessProtocolType Protocol;
80   AccessProtocolType ClusterInternalProtocol;
81   std::string UserName;
82   std::string AppliPath;
83   ResourceDataToSort DataForSort;
84 };
85
86 struct RESOURCESMANAGER_EXPORT ParserResourcesType
87 {
88   ResourceDataToSort DataForSort;
89   std::string Name;
90   std::string HostName;
91   AccessProtocolType Protocol;
92   AccessProtocolType ClusterInternalProtocol;
93   AccessModeType Mode;
94   BatchType Batch;
95   MpiImplType mpi;
96   std::string UserName;
97   std::string AppliPath;
98   std::vector<std::string> ComponentsList;
99   std::vector<std::string> ModulesList;
100   std::string OS;
101   std::string batchQueue;
102   std::string userCommands;
103   std::string use;
104   std::list<ParserResourcesClusterMembersType> ClusterMembersList;
105   unsigned int nbOfProc;
106
107   void Print();
108   void Clear();
109
110   std::string PrintAccessProtocolType() const;
111   std::string PrintAccessModeType() const;
112   std::string PrintBatchType() const;
113   std::string PrintMpiImplType() const;
114   std::string PrintClusterInternalProtocol() const;
115 };
116
117 typedef std::map<std::string, ParserResourcesType> MapOfParserResourcesType;
118 typedef std::map<std::string, ParserResourcesType>::iterator MapOfParserResourcesType_it;
119
120 #endif //SALOME_RESOURCES_CATALOG_PARSER