52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
/**
|
|
* @file zeromq/ReqRep.h
|
|
* @brief Request-reply proxy
|
|
* @copyright 2015 Dual Inventive Technology Centre B.V.
|
|
*
|
|
* Request-reply proxy
|
|
*/
|
|
|
|
#ifndef INCLUDE_ZEROMQ_REQREP_H_
|
|
#define INCLUDE_ZEROMQ_REQREP_H_
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
#include <deque>
|
|
#include <di/Zmq.h>
|
|
|
|
class LogInterface;
|
|
|
|
class ReqRep {
|
|
public:
|
|
/**
|
|
* constructor for request reply
|
|
* @param cfg config for the Request reply socket
|
|
* @param l pointer to logging interface
|
|
*/
|
|
ReqRep(const std::shared_ptr<Di::Configuration> &cfg, const std::shared_ptr<LogInterface> &l);
|
|
|
|
/**
|
|
* destuctor for request reply
|
|
*/
|
|
~ReqRep();
|
|
|
|
|
|
std::shared_ptr<Di::Zmq::Socket> getInternalSocket();
|
|
void join(void);
|
|
|
|
private:
|
|
std::string __frontendBind;
|
|
std::shared_ptr<std::thread> __proxyThread;
|
|
std::shared_ptr<Di::Zmq::Context> __zmqFrontendContext;
|
|
std::shared_ptr<Di::Zmq::Context> __zmqBackendContext;
|
|
std::shared_ptr<Di::Zmq::Socket> __deviceSocket; /**< device-facing socket */
|
|
std::shared_ptr<Di::Zmq::Socket> __backendSocket; /**< server-facing socket (e.g. business-logic) */
|
|
std::shared_ptr<Di::Zmq::Socket> __logSocket;
|
|
|
|
std::deque<std::shared_ptr<std::string>> __workerQueue;
|
|
|
|
void __run(void);
|
|
};
|
|
|
|
#endif // INCLUDE_ZEROMQ_REQREP_H_
|