Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/kernel.git] / src / ResourcesManager / SALOME_ResourcesCatalog_Parser.hxx
1 //  SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
2 //
3 //  Copyright (C) 2003  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 //
23 //
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
32 #include <string>
33 #include <vector>
34 #include <map>
35 #include <iostream>
36
37 enum AccessProtocolType {rsh, ssh};
38
39 enum AccessModeType {interactive, batch};
40
41 enum BatchType {none, pbs, lsf, slurm};
42
43 enum MpiImplType {indif, lam, mpich1, mpich2, openmpi};
44
45 class ResourceDataToSort
46   {
47
48   public:
49     std::string _hostName;
50     unsigned int _nbOfNodes;
51     unsigned int _nbOfProcPerNode;
52     unsigned int _CPUFreqMHz;
53     unsigned int _memInMB;
54     static unsigned int _nbOfNodesWanted;
55     static unsigned int _nbOfProcPerNodeWanted;
56     static unsigned int _CPUFreqMHzWanted;
57     static unsigned int _memInMBWanted;
58
59   public:
60     ResourceDataToSort();
61     ResourceDataToSort(const std::string& hostname,
62                        unsigned int nbOfNodes,
63                        unsigned int nbOfProcPerNode,
64                        unsigned int CPUFreqMHz,
65                        unsigned int memInMB);
66     bool operator< (const ResourceDataToSort& other) const;
67     void Print() const;
68
69   private:
70     unsigned int GetNumberOfPoints() const;
71   };
72
73 struct ParserResourcesType
74   {
75     ResourceDataToSort DataForSort;
76     std::string Alias;
77     AccessProtocolType Protocol;
78     AccessModeType Mode;
79     BatchType Batch;
80     MpiImplType mpi;
81     std::string UserName;
82     std::string AppliPath;
83     std::vector<std::string> ModulesList;
84     std::string OS;
85
86     void Print() const;
87     void Clear();
88   };
89
90 typedef std::map<std::string, ParserResourcesType> MapOfParserResourcesType;
91
92 #endif //SALOME_RESOURCES_CATALOG_PARSER