1 | #ifndef __RESSOURCES_MANAGER_HPP__ |
---|
2 | #define __RESSOURCES_MANAGER_HPP__ |
---|
3 | |
---|
4 | #include "xios_spl.hpp" |
---|
5 | #include "mpi.hpp" |
---|
6 | #include "buffer_in.hpp" |
---|
7 | #include "buffer_out.hpp" |
---|
8 | |
---|
9 | #include <string> |
---|
10 | #include <map> |
---|
11 | #include "window_manager.hpp" |
---|
12 | #include "pool_ressource.hpp" |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | namespace xios |
---|
17 | { |
---|
18 | |
---|
19 | |
---|
20 | class CRessourcesManager |
---|
21 | { |
---|
22 | |
---|
23 | const int NOTIFY_NOTHING=0 ; |
---|
24 | const int NOTIFY_CREATE_POOL=1 ; |
---|
25 | const int NOTIFY_FINALIZE=2 ; |
---|
26 | |
---|
27 | public: |
---|
28 | |
---|
29 | CRessourcesManager(bool isXiosServer) ; |
---|
30 | ~CRessourcesManager() ; |
---|
31 | |
---|
32 | void eventLoop(void) ; |
---|
33 | void createPool(const std::string& id, int size) ; |
---|
34 | void createPool(void) ; |
---|
35 | void finalize(void) ; |
---|
36 | void finalizeSignal(void) ; |
---|
37 | void sendNotification(int rank); |
---|
38 | void checkNotifications(void) ; |
---|
39 | void notificationsDumpOut(CBufferOut& buffer) ; |
---|
40 | void notificationsDumpIn(CBufferIn& buffer) ; |
---|
41 | |
---|
42 | void ressourcesDumpOut(CBufferOut& buffer) ; |
---|
43 | void ressourcesDumpIn(CBufferIn& buffer) ; |
---|
44 | |
---|
45 | int getRessourcesSize(void) ; |
---|
46 | int getFreeRessourcesSize(void) ; |
---|
47 | bool getPoolInfo(const string& poolId, int& size, int& leader) ; |
---|
48 | bool getPoolLeader(const string& poolId, int& leader) ; |
---|
49 | bool getPoolSize(const string& poolId, int& size) ; |
---|
50 | bool hasPool(const string& poolId) ; |
---|
51 | |
---|
52 | void registerServerLeader(int leaderRank) ; |
---|
53 | void registerRessourcesSize(int size) ; |
---|
54 | void registerPool(const std::string& poolId,int size,int leader) ; |
---|
55 | |
---|
56 | int managerGlobalLeader_ ; |
---|
57 | |
---|
58 | CWindowManager* winRessources_ ; |
---|
59 | |
---|
60 | CWindowManager* winNotify_ ; |
---|
61 | |
---|
62 | const size_t maxBufferSize_=1024*1024 ; |
---|
63 | |
---|
64 | MPI_Comm xiosComm_ ; |
---|
65 | |
---|
66 | int notifyType_ ; |
---|
67 | tuple<std::string, int> notifyCreatePool_ ; |
---|
68 | |
---|
69 | std::map<std::string, std::tuple<int,int>> pools_ ; |
---|
70 | int serverLeader_ ; |
---|
71 | int ressourcesSize_ ; |
---|
72 | int freeRessourcesSize_ ; |
---|
73 | |
---|
74 | friend class CWindowManager ; |
---|
75 | } ; |
---|
76 | |
---|
77 | } |
---|
78 | #endif |
---|