![]() |
Belle II Software
light-2303-iriomote
|
A helper class for communicating over ZMQ. Includes a multicast and (if needed) also a data socket. More...
#include <ZMQClient.h>

Public Member Functions | |
| template<int AZMQType> | |
| void | initialize (const std::string &pubSocketAddress, const std::string &subSocketAddress, const std::string &socketName, bool bind) |
| Initialize the multicast and a data socket of the given type. | |
| void | initialize (const std::string &pubSocketAddress, const std::string &subSocketAddress) |
| Initialize only the multicast. | |
| void | terminate (bool sendGoodbye=true) |
| Terminate the sockets properly. | |
| void | reset () |
| Reset the sockets. ATTENTION: this does not close the sockets! Use only after forks to not clean up to times. | |
| void | subscribe (EMessageTypes messageType) |
| Subscribe to the given multicast message type. | |
| template<class AZMQMessage > | |
| void | send (AZMQMessage message) const |
| Send a message over the data socket. | |
| void | send (zmq::message_t &message) const |
| Send a zmq message over the data socket. ATTENTION: we are taking ownership here! | |
| template<class AZMQMessage > | |
| void | publish (AZMQMessage message) const |
| Publish the message to the multicast. | |
| bool | isOnline () const |
| Check if the client was initialized and not terminated. | |
| template<class AMulticastAnswer , class ASocketAnswer > | |
| int | poll (unsigned int timeout, AMulticastAnswer multicastAnswer, ASocketAnswer socketAnswer) const |
| Poll both the multicast and the data socket until, either: More... | |
| template<class ASocketAnswer > | |
| int | pollSocket (unsigned int timeout, ASocketAnswer socketAnswer) const |
| Poll method to only the data socket. More... | |
| template<class AMulticastAnswer > | |
| int | pollMulticast (unsigned int timeout, AMulticastAnswer multicastAnswer) const |
| Poll method to only the multicast socket. More... | |
Static Private Member Functions | |
| static int | pollSocketVector (const std::vector< zmq::socket_t * > &socketList, int timeout) |
| Internal poll function. | |
Private Attributes | |
| std::unique_ptr< zmq::context_t > | m_context |
| ZMQ context. | |
| std::vector< zmq::socket_t * > | m_pollSocketPtrList |
| Will use this vector for polling. | |
| std::unique_ptr< zmq::socket_t > | m_pubSocket |
| ZMQ Pub socket. | |
| std::unique_ptr< zmq::socket_t > | m_subSocket |
| ZMQ sub socket. | |
| std::unique_ptr< zmq::socket_t > | m_socket |
| ZMQ socket. | |
A helper class for communicating over ZMQ. Includes a multicast and (if needed) also a data socket.
Definition at line 22 of file ZMQClient.h.