Muster SDK  8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MPools.h
Go to the documentation of this file.
1 /*****************************************************************************
2  **
3  ** Header file for Muster API Pools object
4  **
5  ** Name : MPools.h
6  ** Author : Leonardo Bernardini
7  ** Version : 1.0, Sat Mar 2nd 2013
8  **
9  ** Copyright 2000-2014, Virtual Vertex
10  ** All Rights Reserved.
11  **
12  ** This file contains UNPUBLISHED PROPRIETARY SOURCE CODE.
13  ** The contents of this file may not be disclosed to third parties, copied
14  ** or duplicated in any form, in whole or in part, without the prior written
15  ** permission of the author.
16  **
17  *****************************************************************************/
18 #ifndef MPOOLS_H
19 #define MPOOLS_H
20 
21 #ifdef WIN32
22 // Windows definitions
23 #ifdef MCLIENTLIB_EXPORTS
24 #define MCLIENTLIB_API __declspec(dllexport)
25 #else
26 #define MCLIENTLIB_API __declspec(dllimport)
27 #endif
28 #else
29 
30 #ifndef MCLIENTLIB_EXPORTS
31 #ifdef LINUX
32 #define MCLIENTLIB_API
33 #else
34 #define MCLIENTLIB_API
35 #endif
36 #else
37 #define MCLIENTLIB_API
38 #endif
39 #endif
40 
41 #include <MClientLib/MTimeRule.h>
42 
43 // Disable STL Export warning, member is private, we don't need direct access from the DLL client
44 #if defined(_WIN32)
45 #pragma warning(disable: 4251)
46 #endif // _WIN32
47 
48 #include <string>
49 #include <list>
50 #include <vector>
51 
52 namespace MClientLib {
53 
58  private:
59  std::string hostName;
60  std::string hostIp;
61  public:
62  MPoolItem();
63  std::string getHostName() ;
64  void setHostName(const std::string& _hostName);
65  std::string getHostIp();
66  void setHostIp(const std::string& _hostIp);
67  };
68 
73  private:
74  std::string poolName;
75  int nodesPriority;
76  int jobsPriority;
77  bool hasNodesPriority;
78  bool hasJobsPriority;
79  std::string autoPoolIpFilter;
80  std::string autoPoolHostnameFilter;
81  std::list<MPoolItem*> childs;
82  std::list<MClientLib::MTimeRule*> timeRules;
83  public:
84  MPool();
85  ~MPool();
86 #ifndef SWIG
87  MPool& operator=( const MPool& src );
88  MPool(const MPool &src);
89 #endif
90  std::string getName();
91  void setName(const std::string& _name);
92  int getNodesPriority();
93  void setNodesPriority(int _nodesPriority);
94  int getJobsPriority();
95  void setJobsPriority(int _jobsPriority);
96  bool getHasNodesPriority();
97  void setHasNodesPriority(bool _hasNodesPriority);
98  bool getHasJobsPriority();
99  void setHasJobsPriority(bool _hasJobsPriority);
100  std::string getAutoPoolIpFilter();
101  void setAutoPoolIpFilter(const std::string& _autoPoolIpFilter);
102  std::string getAutoPoolHostnameFilter();
103  void setAutoPoolHostnameFilter(const std::string& _autoPoolHostnameFilter);
104 
105  bool containsNode(const std::string& hostName, const std::string& hostIp);
106  bool removeNode(const std::string& hostName, const std::string& hostIp);
107  void addNode(const std::string& hostName, const std::string& hostIp);
108  std::vector<MPoolItem*> getNodes();
109  void setNodes(std::vector<MPoolItem*>);
110 
111  std::vector<MClientLib::MTimeRule*> getTimeRules();
112  void setTimeRules(std::vector<MClientLib::MTimeRule*>);
114 
115  };
116 
121  private:
122  std::list<MPool*> pools;
123  public:
124 #ifndef SWIG
125  MPools(const MPools &src);
126  MPools& operator=( const MPools& src );
127 #endif
128  MPools();
129  ~MPools();
130 
131 
132  bool containsNode(const std::string& poolName,const std::string& hostName, const std::string& hostIp);
133  bool removeNode(const std::string& poolName,const std::string& hostName, const std::string& hostIp);
134  void addNode(const std::string& poolName,const std::string& hostName, const std::string& hostIp);
135 
136  void addPool(const std::string& poolName);
137  bool removePool(const std::string& poolName);
138  bool containsPool(const std::string& poolName);
139  MPool* getPool(const std::string& pool);
140 
141  std::vector<MPool*> getPools();
142  void clear();
143 
144  };
145 }
146 
147 #endif