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) ; |
---|
25 | |
---|
26 | void createService(const std::string& serviceId, int type, int size, int nbPartition) ; |
---|
27 | void createService(MPI_Comm serviceComm, const std::string& serviceId, int partitionId, int type, int nbPartitions) ; |
---|
28 | void createServiceNotify(int rank, const std::string& serviceId, int type, int size, int nbPartitions, bool in) ; |
---|
29 | void createServiceDumpOut(CBufferOut& buffer) ; |
---|
30 | void createServiceDumpIn(CBufferIn& buffer) ; |
---|
31 | void checkCreateServiceNotification(void) ; |
---|
32 | void createNewService(const std::string& serviceId, int type, int size, int nbPartitions, bool in) ; |
---|
33 | bool eventLoop(bool serviceOnly=false) ; |
---|
34 | CService* getService(const std::string serviceId, int partitionId) { return services_[make_tuple(serviceId,partitionId)]; } |
---|
35 | void finalizeSignal(void) ; |
---|
36 | string getId(void) { return Id_; } |
---|
37 | |
---|
38 | private: |
---|
39 | MPI_Comm poolComm_ ; |
---|
40 | |
---|
41 | std::multimap<int,int> occupancy_ ; |
---|
42 | std::list<std::tuple<std::string, int, int, int, bool> > notifications_; |
---|
43 | std::map< std::tuple<std::string, int>, CService*> services_ ; |
---|
44 | std::string Id_ ; |
---|
45 | bool finalizeSignal_ ; |
---|
46 | |
---|
47 | }; |
---|
48 | |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | #endif |
---|