[1761] | 1 | #ifndef __POOL_RESSOURCE_HPP__ |
---|
| 2 | #define __POOL_RESSOURCE_HPP__ |
---|
| 3 | |
---|
| 4 | #include "mpi.hpp" |
---|
| 5 | #include "window_manager.hpp" |
---|
| 6 | #include "services_manager.hpp" |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | namespace xios |
---|
| 10 | { |
---|
| 11 | |
---|
| 12 | class CService ; |
---|
| 13 | |
---|
| 14 | class CPoolRessource |
---|
| 15 | { |
---|
| 16 | private: |
---|
| 17 | |
---|
| 18 | const size_t maxBufferSize_=1024*1024 ; |
---|
| 19 | const int localLeader_ = 0 ; |
---|
| 20 | |
---|
| 21 | CWindowManager* winNotify_ ; |
---|
| 22 | |
---|
| 23 | public: |
---|
| 24 | CPoolRessource(MPI_Comm poolComm, const std::string& Id) ; |
---|
[2274] | 25 | ~CPoolRessource() ; |
---|
[1761] | 26 | |
---|
| 27 | void createService(const std::string& serviceId, int type, int size, int nbPartition) ; |
---|
| 28 | void createService(MPI_Comm serviceComm, const std::string& serviceId, int partitionId, int type, int nbPartitions) ; |
---|
| 29 | void createServiceNotify(int rank, const std::string& serviceId, int type, int size, int nbPartitions, bool in) ; |
---|
| 30 | void createServiceDumpOut(CBufferOut& buffer) ; |
---|
| 31 | void createServiceDumpIn(CBufferIn& buffer) ; |
---|
| 32 | void checkCreateServiceNotification(void) ; |
---|
| 33 | void createNewService(const std::string& serviceId, int type, int size, int nbPartitions, bool in) ; |
---|
[1764] | 34 | bool eventLoop(bool serviceOnly=false) ; |
---|
[1761] | 35 | CService* getService(const std::string serviceId, int partitionId) { return services_[make_tuple(serviceId,partitionId)]; } |
---|
| 36 | void finalizeSignal(void) ; |
---|
| 37 | string getId(void) { return Id_; } |
---|
| 38 | |
---|
| 39 | private: |
---|
| 40 | MPI_Comm poolComm_ ; |
---|
| 41 | |
---|
| 42 | std::multimap<int,int> occupancy_ ; |
---|
| 43 | std::list<std::tuple<std::string, int, int, int, bool> > notifications_; |
---|
| 44 | std::map< std::tuple<std::string, int>, CService*> services_ ; |
---|
| 45 | std::string Id_ ; |
---|
| 46 | bool finalizeSignal_ ; |
---|
[2246] | 47 | |
---|
[2260] | 48 | const double eventLoopLatency_=0; |
---|
[2246] | 49 | double lastEventLoop_=0. ; |
---|
[1761] | 50 | }; |
---|
| 51 | |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | #endif |
---|