1 | #ifndef __CONTEXT_SERVER_HPP__ |
---|
2 | #define __CONTEXT_SERVER_HPP__ |
---|
3 | #include "xios_spl.hpp" |
---|
4 | #include "event_server.hpp" |
---|
5 | #include "buffer_server.hpp" |
---|
6 | #include "mpi.hpp" |
---|
7 | |
---|
8 | namespace xios |
---|
9 | { |
---|
10 | class CContext ; |
---|
11 | |
---|
12 | class CContextServer |
---|
13 | { |
---|
14 | public: |
---|
15 | |
---|
16 | CContextServer(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; |
---|
17 | bool eventLoop(bool enableEventsProcessing = true); |
---|
18 | void listen(void) ; |
---|
19 | bool listenPendingRequest(MPI_Message &message, MPI_Status& status) ; |
---|
20 | void checkPendingProbe(void) ; |
---|
21 | void checkPendingRequest(void) ; |
---|
22 | void processRequest(int rank, char* buff,int count) ; |
---|
23 | void processEvents(void) ; |
---|
24 | bool hasFinished(void); |
---|
25 | void dispatchEvent(CEventServer& event) ; |
---|
26 | void setPendingEvent(void) ; |
---|
27 | bool hasPendingEvent(void) ; |
---|
28 | |
---|
29 | MPI_Comm intraComm ; |
---|
30 | int intraCommSize ; |
---|
31 | int intraCommRank ; |
---|
32 | |
---|
33 | MPI_Comm interComm ; |
---|
34 | int commSize ; |
---|
35 | |
---|
36 | map<int,CServerBuffer*> buffers ; |
---|
37 | map<int, list<std::pair<MPI_Message,MPI_Status> > > pendingProbe; |
---|
38 | map<int,MPI_Request> pendingRequest ; |
---|
39 | map<int,char*> bufferRequest ; |
---|
40 | |
---|
41 | map<size_t,CEventServer*> events ; |
---|
42 | size_t currentTimeLine ; |
---|
43 | CContext* context ; |
---|
44 | |
---|
45 | bool finished ; |
---|
46 | bool pendingEvent ; |
---|
47 | bool scheduled ; /*!< event of current timeline is alreading scheduled ? */ |
---|
48 | size_t hashId ; |
---|
49 | |
---|
50 | ~CContextServer() ; |
---|
51 | |
---|
52 | private: |
---|
53 | std::map<int, StdSize> mapBufferSize_; |
---|
54 | } ; |
---|
55 | |
---|
56 | } |
---|
57 | |
---|
58 | #endif |
---|