A general message with as many parts as given as template argument.
More...
#include <ZMQModuleMessage.h>
|
| ZMQModuleMessage (const ZMQModuleMessage &)=delete |
| Do not allow to copy a message.
|
|
void | operator= (const ZMQModuleMessage &)=delete |
| Do not allow to copy a message.
|
|
MessageParts & | getMessageParts () |
| Get a reference to the message parts.
|
|
const MessageParts & | getMessageParts () const |
| Get a const reference to the message parts.
|
|
template<unsigned int index> |
const zmq::message_t & | getMessagePart () const |
| Get the message part with the given index (const version)
|
|
template<unsigned int index> |
const char * | getMessagePartAsCharArray () const |
| Get the message part with the given index as char* (const version)
|
|
template<unsigned int index> |
std::string | getMessagePartAsString () const |
| Get the message part with the given index as string (const version)
|
|
template<unsigned int index> |
zmq::message_t & | getMessagePart () |
| Get the message part with the given index.
|
|
template<unsigned int index> |
char * | getMessagePartAsCharArray () |
| Get the message part with the given index as char*.
|
|
|
static void | toSocket (std::unique_ptr< ZMQModuleMessage > message, const std::unique_ptr< zmq::socket_t > &socket) |
| Send the message to the given socket. As the message is nullified, you have to move it in here.
|
|
|
static constexpr unsigned int | c_messageParts = AMessageFrameNumber |
| The number of message parts this message carries.
|
|
|
| ZMQModuleMessage ()=default |
| Do not allow to create a new message from scratch publicly.
|
|
template<class ... T> |
| ZMQModuleMessage (T &&... arguments) |
| Constructor out of different parts.
|
|
|
MessageParts | m_messageParts |
| The content of this message as an array of zmq messages. Will be set during constructor or when coming from a socket.
|
|
template<unsigned int AMessageFrameNumber>
class Belle2::ZMQModuleMessage< AMessageFrameNumber >
A general message with as many parts as given as template argument.
Definition at line 24 of file ZMQModuleMessage.h.
◆ MessageParts
template<unsigned int AMessageFrameNumber>
◆ ZMQModuleMessage()
template<unsigned int AMessageFrameNumber>
template<class ... T>
Constructor out of different parts.
Definition at line 104 of file ZMQModuleMessage.h.
104 :
105 m_messageParts({ZMQMessageHelper::createZMQMessage(std::forward<T>(arguments)) ... })
106 {
107 }
◆ getMessagePart() [1/2]
template<unsigned int AMessageFrameNumber>
template<unsigned int index>
zmq::message_t & getMessagePart |
( |
| ) |
|
|
inline |
Get the message part with the given index.
Definition at line 85 of file ZMQModuleMessage.h.
86 {
87 return m_messageParts[index];
88 }
◆ getMessagePart() [2/2]
template<unsigned int AMessageFrameNumber>
template<unsigned int index>
const zmq::message_t & getMessagePart |
( |
| ) |
const |
|
inline |
Get the message part with the given index (const version)
Definition at line 62 of file ZMQModuleMessage.h.
63 {
64 return m_messageParts[index];
65 }
◆ getMessagePartAsCharArray() [1/2]
template<unsigned int AMessageFrameNumber>
template<unsigned int index>
char * getMessagePartAsCharArray |
( |
| ) |
|
|
inline |
Get the message part with the given index as char*.
Definition at line 92 of file ZMQModuleMessage.h.
93 {
94 auto& messagePart = getMessagePart<index>();
95 return static_cast<char*>(messagePart.data());
96 }
◆ getMessagePartAsCharArray() [2/2]
template<unsigned int AMessageFrameNumber>
template<unsigned int index>
const char * getMessagePartAsCharArray |
( |
| ) |
const |
|
inline |
Get the message part with the given index as char* (const version)
Definition at line 69 of file ZMQModuleMessage.h.
70 {
71 const auto& messagePart = getMessagePart<index>();
72 return static_cast<const char*>(messagePart.data());
73 }
◆ getMessagePartAsString()
template<unsigned int AMessageFrameNumber>
template<unsigned int index>
std::string getMessagePartAsString |
( |
| ) |
const |
|
inline |
Get the message part with the given index as string (const version)
Definition at line 77 of file ZMQModuleMessage.h.
78 {
79 const auto& messagePart = getMessagePart<index>();
80 return std::string(static_cast<const char*>(messagePart.data()), messagePart.size());
81 }
◆ getMessageParts() [1/2]
template<unsigned int AMessageFrameNumber>
Get a reference to the message parts.
Definition at line 49 of file ZMQModuleMessage.h.
50 {
51 return m_messageParts;
52 };
◆ getMessageParts() [2/2]
template<unsigned int AMessageFrameNumber>
Get a const reference to the message parts.
Definition at line 55 of file ZMQModuleMessage.h.
56 {
57 return m_messageParts;
58 };
◆ toSocket()
template<unsigned int AMessageFrameNumber>
static void toSocket |
( |
std::unique_ptr< ZMQModuleMessage< AMessageFrameNumber > > | message, |
|
|
const std::unique_ptr< zmq::socket_t > & | socket ) |
|
inlinestatic |
Send the message to the given socket. As the message is nullified, you have to move it in here.
Definition at line 35 of file ZMQModuleMessage.h.
36 {
37 for (unsigned int i = 0; i < c_messageParts - 1; i++) {
38 socket->send(message->m_messageParts[i], zmq::send_flags::sndmore);
39 }
40 socket->send(message->m_messageParts[c_messageParts - 1], zmq::send_flags::none);
41 }
◆ ZMQMessageFactory
template<unsigned int AMessageFrameNumber>
◆ c_messageParts
template<unsigned int AMessageFrameNumber>
unsigned int c_messageParts = AMessageFrameNumber |
|
staticconstexpr |
◆ m_messageParts
template<unsigned int AMessageFrameNumber>
The content of this message as an array of zmq messages. Will be set during constructor or when coming from a socket.
Definition at line 111 of file ZMQModuleMessage.h.
The documentation for this class was generated from the following file: