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 | #include "event_scheduler.hpp" |
---|
8 | |
---|
9 | namespace xios |
---|
10 | { |
---|
11 | class CContext ; |
---|
12 | class CContextClient; |
---|
13 | |
---|
14 | class CContextServer |
---|
15 | { |
---|
16 | public: |
---|
17 | |
---|
18 | enum ETransport { generic, legacy, oneSided} ; |
---|
19 | |
---|
20 | template<ETransport transport=generic> |
---|
21 | static CContextServer* getNew(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; |
---|
22 | |
---|
23 | CContextServer(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; |
---|
24 | ~CContextServer() {} |
---|
25 | bool isAttachedModeEnabled() const ; |
---|
26 | void setAssociatedClient(CContextClient* associatedClient) {associatedClient_=associatedClient ;} |
---|
27 | CContextClient* getAssociatedClient(void) { return associatedClient_ ;} |
---|
28 | int getIntraCommRank(void) { return intraCommRank ;} |
---|
29 | int getIntraCommSize(void) { return intraCommSize ;} |
---|
30 | |
---|
31 | virtual bool eventLoop(bool enableEventsProcessing = true) = 0 ; |
---|
32 | virtual void releaseBuffers(void)=0; |
---|
33 | |
---|
34 | protected : |
---|
35 | |
---|
36 | MPI_Comm intraComm ; |
---|
37 | int intraCommSize ; |
---|
38 | int intraCommRank ; |
---|
39 | |
---|
40 | MPI_Comm interComm ; |
---|
41 | int commSize ; |
---|
42 | int clientSize_ ; |
---|
43 | |
---|
44 | bool attachedMode ; //! true if attached mode is enabled otherwise false |
---|
45 | |
---|
46 | CContext* context ; |
---|
47 | CContextClient* associatedClient_ ; |
---|
48 | |
---|
49 | size_t hashId ; |
---|
50 | CEventScheduler* eventScheduler_=nullptr ; |
---|
51 | } ; |
---|
52 | |
---|
53 | template<> |
---|
54 | CContextServer* CContextServer::getNew<CContextServer::generic>(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; |
---|
55 | |
---|
56 | template<> |
---|
57 | CContextServer* CContextServer::getNew<CContextServer::oneSided>(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; |
---|
58 | |
---|
59 | template<> |
---|
60 | CContextServer* CContextServer::getNew<CContextServer::legacy>(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; |
---|
61 | |
---|
62 | } |
---|
63 | |
---|
64 | #endif |
---|