src.dualinventive.com/dinet/sec-multi-proxy/include/zeromq/SubscribeInterface.h

44 lines
1.1 KiB
C++

/*
* SubscribeInterface.h
*/
#ifndef INCLUDE_ZEROMQ_SUBSCRIBEINTERFACE_H_
#define INCLUDE_ZEROMQ_SUBSCRIBEINTERFACE_H_
#include <string>
#include <memory>
#include <mutex>
#include <di/Zmq.h>
#include <thread>
#include <di/rpc/Reader.h>
#include <device/DeviceFacade.h>
class LogInterface;
class SubscribeInterface {
public:
/**
* constructor for subsribe
* @param cfg config for the subscribe socket
* @param deviceFacade pointer to device facade
*/
explicit SubscribeInterface(const std::shared_ptr<Di::Configuration> &cfg,
const std::shared_ptr<LogInterface> &l,
const std::shared_ptr<DeviceFacade> &deviceFacade);
~SubscribeInterface();
void join(void);
private:
std::shared_ptr<DeviceFacade> __deviceFacade;
std::shared_ptr<Di::Zmq::Context> __zmqContext;
std::shared_ptr<Di::Zmq::Socket> __zmqSocket;
std::shared_ptr<Di::Zmq::Socket> __logSocket;
std::shared_ptr<std::thread> __proxyThread;
Di::Rpc::Reader __reader;
void __run(void);
void __processMessage(const std::shared_ptr<std::string> &msg);
};
#endif // INCLUDE_ZEROMQ_SUBSCRIBEINTERFACE_H_