[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) ; |
---|
[2274] | 26 | ~CServersRessource() ; |
---|
[1761] | 27 | void createPool(const string& poolId, const int size) ; |
---|
| 28 | void createPool(void) ; |
---|
[1764] | 29 | bool eventLoop(bool serviceOnly=false) ; |
---|
[1761] | 30 | void sendNotification(int rank) ; |
---|
| 31 | void notificationsDumpOut(CBufferOut& buffer) ; |
---|
| 32 | void notificationsDumpIn(CBufferIn& buffer) ; |
---|
| 33 | void checkNotifications(void) ; |
---|
| 34 | CPoolRessource* getPoolRessource(void) { return poolRessource_; } |
---|
| 35 | bool isServerLeader(void) ; |
---|
| 36 | void finalize(void) ; |
---|
| 37 | void finalizeSignal(void) ; |
---|
| 38 | |
---|
| 39 | const int localLeader_=0 ; |
---|
| 40 | vector<int> freeRessourcesRank_ ; // only for leader |
---|
| 41 | MPI_Comm serverComm_ ; |
---|
| 42 | MPI_Comm freeRessourcesComm_ ; |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | const size_t maxBufferSize_=1024*1024 ; |
---|
| 46 | CWindowManager* winNotify_ ; |
---|
[1764] | 47 | |
---|
| 48 | int notifyInType_,notifyOutType_ ; |
---|
| 49 | std::tuple<std::string, bool> notifyInCreatePool_,notifyOutCreatePool_ ; |
---|
[1761] | 50 | CPoolRessource* poolRessource_ ; |
---|
| 51 | bool finalizeSignal_ ; |
---|
| 52 | |
---|
[2260] | 53 | const double eventLoopLatency_=0; |
---|
[2246] | 54 | double lastEventLoop_=0. ; |
---|
| 55 | |
---|
[1761] | 56 | friend class CWindowManager ; |
---|
| 57 | } ; |
---|
| 58 | |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | #endif |
---|