10#include <framework/pcore/zmq/utils/ZMQLogger.h>
11#include <framework/pcore/zmq/utils/ZMQParent.h>
45 static bool poll(
const std::map<const ZMQConnection*, ReactorFunction>& connectionList,
int timeout);
56 virtual std::vector<zmq::socket_t*>
getSockets()
const = 0;
69 std::vector<zmq::socket_t*>
getSockets()
const final;
Specialized connection over a ZMQ socket.
std::string getEndPoint() const
Return the connection string for this socket.
std::shared_ptr< ZMQParent > m_parent
The shared ZMQParent instance.
std::unique_ptr< zmq::socket_t > m_socket
The memory of the socket. Needs to be initialized in a derived class.
std::vector< zmq::socket_t * > getSockets() const final
The socket used for polling is just the stored socket.
Base class for every connection with virtual functions to be implemented:
virtual bool isReady() const
Return true of this connection is able to send messages right now. Can be overloaded in derived class...
virtual ~ZMQConnection()=default
Virtual default destructor.
std::function< void(void)> ReactorFunction
Typedef of a function which will be called if a connection has a message.
static bool hasMessage(const ZMQConnection *connection)
Check if the given connection as an incoming message (right now, no waiting).
virtual std::vector< zmq::socket_t * > getSockets() const =0
Return the list of sockets which should be polled on to check for incoming messages....
static bool poll(const std::map< const ZMQConnection *, ReactorFunction > &connectionList, int timeout)
Poll on the given connections and call the attached function if a messages comes in.
Base class for the ZMQ connection to help monitor and log certain values.
Abstract base class for different kinds of events.