1 | #ifndef __SERVICE_HPP__ |
---|
2 | #define __SERVICE_HPP__ |
---|
3 | |
---|
4 | #include "xios_spl.hpp" |
---|
5 | #include "mpi.hpp" |
---|
6 | #include "services_manager.hpp" |
---|
7 | #include "event_scheduler.hpp" |
---|
8 | |
---|
9 | namespace xios |
---|
10 | { |
---|
11 | |
---|
12 | class CServerContext ; |
---|
13 | |
---|
14 | class CService |
---|
15 | { |
---|
16 | public: |
---|
17 | |
---|
18 | CService(MPI_Comm serviceComm, const std::string& poolId, const std::string& serviceId, const int& partitionId, |
---|
19 | int type, int nbPartitions) ; |
---|
20 | bool eventLoop(void) ; |
---|
21 | void createContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ; |
---|
22 | void checkCreateContextNotification(void) ; |
---|
23 | void createContextNotify(int rank, const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ; |
---|
24 | void createContextDumpOut(CBufferOut& buffer) ; |
---|
25 | void createContextDumpIn(CBufferIn& buffer) ; |
---|
26 | void createNewContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ; |
---|
27 | CServerContext* getServerContext(const std::string& contextId) { return contexts_[contextId]; } |
---|
28 | void finalizeSignal(void) ; |
---|
29 | CEventScheduler* getEventScheduler(void) ; |
---|
30 | |
---|
31 | std::string getPoolId(void) {return poolId_;} |
---|
32 | std::string getServiceId(void) {return serviceId_;} |
---|
33 | int getPartitionId(void) {return partitionId_;} |
---|
34 | int getType(void) {return type_;} |
---|
35 | int getNbPartitions(void) {return nbPartitions_;} |
---|
36 | |
---|
37 | private: |
---|
38 | |
---|
39 | MPI_Comm serviceComm_ ; |
---|
40 | MPI_Comm globalComm_ ; |
---|
41 | |
---|
42 | const size_t maxBufferSize_=1024*1024 ; |
---|
43 | const int localLeader_=0 ; |
---|
44 | int globalLeader_ ; |
---|
45 | CWindowManager* winNotify_ ; |
---|
46 | std::list<std::tuple<std::string, std::string, int, std::string>> notifications_; |
---|
47 | std::map<std::string, CServerContext*> contexts_ ; |
---|
48 | bool finalizeSignal_ ; |
---|
49 | CEventScheduler* eventScheduler_ ; |
---|
50 | |
---|
51 | std::string poolId_ ; |
---|
52 | std::string serviceId_ ; |
---|
53 | int partitionId_ ; |
---|
54 | int type_ ; |
---|
55 | int nbPartitions_ ; |
---|
56 | |
---|
57 | }; |
---|
58 | |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | #endif |
---|