1 /* 2 * Distributed under the OSI-approved Apache License, Version 2.0. See 3 * accompanying file Copyright.txt for details. 4 * 5 * ZmqReqRep.h 6 * 7 * Created on: Oct 1, 2018 8 * Author: Jason Wang wangr1@ornl.gov 9 */ 10 11 #ifndef ADIOS2_TOOLKIT_ZMQ_ZMQREQREP_H_ 12 #define ADIOS2_TOOLKIT_ZMQ_ZMQREQREP_H_ 13 14 #include "adios2/core/IO.h" 15 #include "adios2/core/Operator.h" 16 17 #include <zmq.h> 18 19 namespace adios2 20 { 21 namespace zmq 22 { 23 24 class ZmqReqRep 25 { 26 27 public: 28 ZmqReqRep(); 29 ~ZmqReqRep(); 30 31 // requester 32 void OpenRequester(const int timeout, const size_t receiverBufferSize); 33 void OpenRequester(const std::string &address, const int timeout, 34 const size_t receiverBufferSize); 35 std::shared_ptr<std::vector<char>> 36 Request(const void *request, const size_t size, const std::string &address); 37 std::shared_ptr<std::vector<char>> Request(const void *request, 38 const size_t size); 39 40 // replier 41 void OpenReplier(const std::string &address, const int timeout, 42 const size_t receiverBufferSize); 43 std::shared_ptr<std::vector<char>> ReceiveRequest(); 44 void SendReply(std::shared_ptr<std::vector<char>> reply); 45 void SendReply(const void *reply, const size_t size); 46 47 private: 48 int m_Verbosity = 0; 49 int m_Timeout; 50 51 std::vector<char> m_ReceiverBuffer; 52 void *m_Context = nullptr; 53 void *m_Socket = nullptr; 54 }; 55 56 } // end namespace zmq 57 } // end namespace adios2 58 59 #endif /* ADIOS2_TOOLKIT_ZMQ_ZMQREQREP_H_ */ 60