[1761] | 1 | #ifndef __SERVER_CONTEXT_HPP__ |
---|
| 2 | #define __SERVER_CONTEXT_HPP__ |
---|
| 3 | #include "xios_spl.hpp" |
---|
| 4 | #include "window_manager.hpp" |
---|
| 5 | #include "mpi.hpp" |
---|
| 6 | |
---|
| 7 | namespace xios |
---|
| 8 | { |
---|
| 9 | class CContext ; |
---|
| 10 | class CService ; |
---|
| 11 | |
---|
| 12 | class CServerContext |
---|
| 13 | { |
---|
| 14 | const int NOTIFY_NOTHING=0 ; |
---|
| 15 | const int NOTIFY_CREATE_INTERCOMM=1 ; |
---|
| 16 | |
---|
| 17 | public: |
---|
| 18 | CServerContext(CService* parentService, MPI_Comm contextComm, const std::string& poolId, const std::string& serviceId, |
---|
| 19 | const int& partitionId, const std::string& contextId) ; |
---|
[1764] | 20 | ~CServerContext() ; |
---|
[1761] | 21 | |
---|
| 22 | bool createIntercomm(const string& poolId, const string& serviceId, const int& partitionId, const string& contextId, |
---|
| 23 | const MPI_Comm& intraComm, MPI_Comm& interCommClient, MPI_Comm& interCommServer, bool wait=true) ; |
---|
| 24 | void createIntercomm(int remoteLeader, const string& sourceContext) ; |
---|
| 25 | |
---|
| 26 | void sendNotification(int rank); |
---|
| 27 | void checkNotifications(void) ; |
---|
| 28 | |
---|
[1764] | 29 | bool eventLoop(bool serviceOnly=false) ; |
---|
[1761] | 30 | void notificationsDumpOut(CBufferOut& buffer) ; |
---|
| 31 | void notificationsDumpIn(CBufferIn& buffer) ; |
---|
| 32 | void finalizeSignal(void) ; |
---|
[1764] | 33 | void freeComm(void) ; |
---|
| 34 | bool isAttachedMode(void) { return isAttachedMode_ ;} |
---|
[1761] | 35 | private: |
---|
| 36 | void createIntercomm(void) ; |
---|
| 37 | |
---|
| 38 | static std::map<std::string, std::tuple<bool, MPI_Comm, MPI_Comm> > overlapedComm_ ; |
---|
| 39 | |
---|
| 40 | MPI_Comm contextComm_ ; |
---|
| 41 | MPI_Comm xiosComm_ ; |
---|
| 42 | |
---|
| 43 | CContext* context_ ; |
---|
| 44 | CService* parentService_ ; |
---|
| 45 | std::string name_ ; |
---|
| 46 | |
---|
| 47 | vector<MPI_Comm> clientsInterComm_ ; |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | const size_t maxBufferSize_=1024*1024 ; |
---|
| 51 | CWindowManager* winNotify_ ; |
---|
[1764] | 52 | int notifyInType_, notifyOutType_ ; |
---|
| 53 | tuple<int, std::string> notifyInCreateIntercomm_, notifyOutCreateIntercomm_ ; |
---|
[1761] | 54 | |
---|
| 55 | const int localLeader_=0 ; |
---|
| 56 | int globalLeader_ ; |
---|
| 57 | bool finalizeSignal_ ; |
---|
[1764] | 58 | bool hasNotification_ ; |
---|
| 59 | bool isAttachedMode_ ; |
---|
[1761] | 60 | |
---|
| 61 | friend class CWindowManager ; |
---|
| 62 | } ; |
---|
| 63 | |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | #endif |
---|