[2343] | 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 | |
---|
[2556] | 18 | enum ETransport { generic, legacy, p2p, oneSided} ; |
---|
[2343] | 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) ; |
---|
[2564] | 24 | virtual ~CContextServer() {} |
---|
[2343] | 25 | void setAssociatedClient(CContextClient* associatedClient) {associatedClient_=associatedClient ;} |
---|
| 26 | CContextClient* getAssociatedClient(void) { return associatedClient_ ;} |
---|
| 27 | int getIntraCommRank(void) { return intraCommRank ;} |
---|
| 28 | int getIntraCommSize(void) { return intraCommSize ;} |
---|
| 29 | |
---|
| 30 | virtual bool eventLoop(bool enableEventsProcessing = true) = 0 ; |
---|
| 31 | virtual void releaseBuffers(void)=0; |
---|
| 32 | |
---|
| 33 | protected : |
---|
| 34 | |
---|
| 35 | MPI_Comm intraComm ; |
---|
| 36 | int intraCommSize ; |
---|
| 37 | int intraCommRank ; |
---|
| 38 | |
---|
| 39 | MPI_Comm interComm ; |
---|
| 40 | int commSize ; |
---|
| 41 | int clientSize_ ; |
---|
| 42 | |
---|
| 43 | CContext* context ; |
---|
| 44 | CContextClient* associatedClient_ ; |
---|
| 45 | |
---|
| 46 | size_t hashId ; |
---|
[2404] | 47 | shared_ptr<CEventScheduler> eventScheduler_=nullptr ; |
---|
[2343] | 48 | } ; |
---|
| 49 | |
---|
| 50 | template<> |
---|
| 51 | CContextServer* CContextServer::getNew<CContextServer::generic>(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; |
---|
| 52 | |
---|
| 53 | template<> |
---|
| 54 | CContextServer* CContextServer::getNew<CContextServer::oneSided>(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; |
---|
| 55 | |
---|
| 56 | template<> |
---|
[2556] | 57 | CContextServer* CContextServer::getNew<CContextServer::p2p>(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; |
---|
| 58 | |
---|
| 59 | template<> |
---|
[2343] | 60 | CContextServer* CContextServer::getNew<CContextServer::legacy>(CContext* parent,MPI_Comm intraComm,MPI_Comm interComm) ; |
---|
| 61 | |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | #endif |
---|