[300] | 1 | #ifndef __CONTEXT_CLIENT_HPP__ |
---|
| 2 | #define __CONTEXT_CLIENT_HPP__ |
---|
| 3 | |
---|
| 4 | #include "xmlioserver_spl.hpp" |
---|
| 5 | #include "buffer_out.hpp" |
---|
| 6 | #include "buffer_client.hpp" |
---|
| 7 | #include "event_client.hpp" |
---|
[382] | 8 | #include "mpi.hpp" |
---|
[300] | 9 | |
---|
[335] | 10 | namespace xios |
---|
[300] | 11 | { |
---|
[345] | 12 | class CContext ; |
---|
[509] | 13 | |
---|
[512] | 14 | /*! |
---|
| 15 | \class CContextClient |
---|
| 16 | A context can be both on client and on server side. In order to differenciate the role of |
---|
| 17 | context on each side, e.x client sending events, server receiving and processing events, there is a need of |
---|
| 18 | concrete "context" classes for both sides. |
---|
| 19 | CContextClient processes and sends events from client to server where CContextServer receives these events |
---|
| 20 | and processes them. |
---|
| 21 | */ |
---|
[300] | 22 | class CContextClient |
---|
| 23 | { |
---|
| 24 | public: |
---|
[512] | 25 | // Contructor |
---|
[511] | 26 | CContextClient(CContext* parent,MPI_Comm intraComm, MPI_Comm interComm, CContext* parentServer = 0) ; |
---|
[300] | 27 | |
---|
[512] | 28 | // Send event to server |
---|
[300] | 29 | void sendEvent(CEventClient& event) ; |
---|
[512] | 30 | void waitEvent(list<int>& ranks) ; |
---|
[300] | 31 | |
---|
[512] | 32 | // Functions relates to set/get buffers |
---|
[300] | 33 | list<CBufferOut*> getBuffers(list<int>& serverlist, list<int>& sizeList) ; |
---|
| 34 | void newBuffer(int rank) ; |
---|
| 35 | bool checkBuffers(list<int>& ranks) ; |
---|
| 36 | bool checkBuffers(void); |
---|
| 37 | void releaseBuffers(void); |
---|
[512] | 38 | |
---|
[300] | 39 | bool isServerLeader(void) ; |
---|
| 40 | int getServerLeader(void) ; |
---|
[512] | 41 | |
---|
| 42 | // Close and finalize context client |
---|
| 43 | void closeContext(void) ; |
---|
[300] | 44 | void finalize(void) ; |
---|
| 45 | |
---|
[509] | 46 | void setBufferSize(const std::map<int, StdSize>& mapSize); |
---|
| 47 | void sendBufferSizeEvent(); |
---|
| 48 | |
---|
[512] | 49 | public: |
---|
| 50 | CContext* context ; //!< Context for client |
---|
[509] | 51 | |
---|
[512] | 52 | size_t timeLine ; //!< Timeline of each event |
---|
[509] | 53 | |
---|
[512] | 54 | int clientRank ; //!< Rank of current client |
---|
[300] | 55 | |
---|
[512] | 56 | int clientSize ; //!< Size of client group |
---|
[300] | 57 | |
---|
[512] | 58 | int serverSize ; //!< Size of server group |
---|
[300] | 59 | |
---|
[512] | 60 | MPI_Comm interComm ; //!< Communicator of server group |
---|
[300] | 61 | |
---|
[512] | 62 | MPI_Comm intraComm ; //!< Communicator of client group |
---|
[300] | 63 | |
---|
[512] | 64 | map<int,CClientBuffer*> buffers ; //!< Buffers for connection to servers |
---|
[300] | 65 | |
---|
[512] | 66 | private: |
---|
| 67 | //! Mapping of server and buffer size for each connection to server |
---|
| 68 | std::map<int, StdSize> mapBufferSize_; |
---|
[300] | 69 | |
---|
[512] | 70 | //! Context for server (Only used in attached mode) |
---|
| 71 | CContext* parentServer; |
---|
| 72 | |
---|
| 73 | public: // Some function should be removed in the future |
---|
| 74 | // void registerEvent(CEventClient& event) ; |
---|
| 75 | // list<CBufferOut*> newEvent(CEventClient& event,list<int>& sizes) ; |
---|
| 76 | // bool locked ; |
---|
| 77 | // set<int> connectedServer ; |
---|
| 78 | |
---|
| 79 | } ; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | #endif // __CONTEXT_CLIENT_HPP__ |
---|