[1761] | 1 | #ifndef __SERVERS_RESSOURCE_HPP__ |
---|
| 2 | #define __SERVERS_RESSOURCE_HPP__ |
---|
| 3 | |
---|
| 4 | #include "window_manager.hpp" |
---|
| 5 | #include "mpi.hpp" |
---|
| 6 | #include <vector> |
---|
| 7 | #include <string> |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | namespace xios |
---|
| 12 | { |
---|
| 13 | |
---|
| 14 | class CPoolRessource ; |
---|
| 15 | |
---|
| 16 | class CServersRessource |
---|
| 17 | { |
---|
| 18 | |
---|
| 19 | const int NOTIFY_NOTHING=0 ; |
---|
| 20 | const int NOTIFY_CREATE_POOL=1 ; |
---|
| 21 | const int NOTIFY_FINALIZE=2 ; |
---|
| 22 | |
---|
| 23 | public: |
---|
| 24 | |
---|
| 25 | CServersRessource(MPI_Comm serverComm) ; |
---|
| 26 | void createPool(const string& poolId, const int size) ; |
---|
| 27 | void createPool(void) ; |
---|
[1764] | 28 | bool eventLoop(bool serviceOnly=false) ; |
---|
[1761] | 29 | void sendNotification(int rank) ; |
---|
| 30 | void notificationsDumpOut(CBufferOut& buffer) ; |
---|
| 31 | void notificationsDumpIn(CBufferIn& buffer) ; |
---|
| 32 | void checkNotifications(void) ; |
---|
| 33 | CPoolRessource* getPoolRessource(void) { return poolRessource_; } |
---|
| 34 | bool isServerLeader(void) ; |
---|
| 35 | void finalize(void) ; |
---|
| 36 | void finalizeSignal(void) ; |
---|
| 37 | |
---|
| 38 | const int localLeader_=0 ; |
---|
| 39 | vector<int> freeRessourcesRank_ ; // only for leader |
---|
| 40 | MPI_Comm serverComm_ ; |
---|
| 41 | MPI_Comm freeRessourcesComm_ ; |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | const size_t maxBufferSize_=1024*1024 ; |
---|
| 45 | CWindowManager* winNotify_ ; |
---|
[1764] | 46 | |
---|
| 47 | int notifyInType_,notifyOutType_ ; |
---|
| 48 | std::tuple<std::string, bool> notifyInCreatePool_,notifyOutCreatePool_ ; |
---|
[1761] | 49 | CPoolRessource* poolRessource_ ; |
---|
| 50 | bool finalizeSignal_ ; |
---|
| 51 | |
---|
| 52 | friend class CWindowManager ; |
---|
| 53 | } ; |
---|
| 54 | |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | #endif |
---|