]> SALOME platform Git repositories - modules/kernel.git/blob - src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx
Salome HOME
PR: merge from tag mergeto_trunk_20Jan05
[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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
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 typedef std::map<std::string, std::string> MapOfModulesPath;
38
39 enum AccessProtocolType {rsh, ssh};
40
41 enum AccessModeType {interactive, batch};
42
43 class ResourceDataToSort {
44 public:
45   std::string _hostName;
46   unsigned int _nbOfNodes;
47   unsigned int _nbOfProcPerNode;
48   unsigned int _CPUFreqMHz;
49   unsigned int _memInMB;
50   static unsigned int _nbOfNodesWanted;
51   static unsigned int _nbOfProcPerNodeWanted;
52   static unsigned int _CPUFreqMHzWanted;
53   static unsigned int _memInMBWanted;
54 public:
55   ResourceDataToSort();
56   ResourceDataToSort(const std::string& hostname,unsigned int nbOfNodes,unsigned int nbOfProcPerNode,unsigned int CPUFreqMHz,unsigned int memInMB);
57   bool operator< (const ResourceDataToSort& other) const;
58   void Print() const;
59 private:
60   unsigned int GetNumberOfPoints() const;
61 //   friend class SALOME_ResourcesCatalog_Handler;
62 //   friend class SALOME_ResourcesManager;
63 //   friend struct ParserResourcesType;
64 };
65
66 struct ParserResourcesType {
67   ResourceDataToSort DataForSort;
68   std::string Alias;
69   AccessProtocolType Protocol;
70   AccessModeType Mode;
71   std::string UserName;
72   MapOfModulesPath ModulesPath;
73   std::string PreReqFilePath;
74   std::string OS;
75
76   void Print(){
77     std::cout << "##############*****" << std::endl; 
78     std::cout << "HostName : " << DataForSort._hostName << std::endl;
79     std::cout << "Alias : " << Alias << std::endl;
80     std::cout << "Protocol : " << Protocol << std::endl;
81     std::cout << "Mode : " << Mode << std::endl;
82     std::cout << "UserName : " << UserName << std::endl;
83     std::cout << "Modules : " << std::endl;
84     int i=1;
85     for(std::map<std::string, std::string>::iterator iter=ModulesPath.begin();iter!=ModulesPath.end();iter++)
86         {
87           std::cout << "    Module " << i++ << " called : " << (*iter).first << " with path : " << (*iter).second << std::endl;
88         }
89     std::cout << "PreReqFilePath : " << PreReqFilePath << std::endl;
90     std::cout << "OS : " << OS << std::endl;
91     DataForSort.Print();
92   }
93 };
94
95 typedef std::map<std::string, ParserResourcesType> MapOfParserResourcesType;
96
97 #endif //SALOME_RESOURCES_CATALOG_PARSER