A message without an associated socket ID. Is used in most cases.
More...
#include <ZMQNoIdMessage.h>
|
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 const unsigned int | c_type = 0 |
| Where the type is stored.
|
|
static constexpr const unsigned int | c_data = 1 |
| Where the data is stored.
|
|
static constexpr const unsigned int | c_additionalData = 2 |
| Where the additional data is stored.
|
|
static constexpr unsigned int | c_messageParts |
| The number of message parts this message carries.
|
|
|
| ZMQModuleMessage (const ZMQModuleMessage &)=delete |
| Copy the constructors.
|
|
| ZMQModuleMessage ()=default |
| Copy the constructors.
|
|
template<class ... T> |
| ZMQModuleMessage (T &&... arguments) |
| Copy the constructors.
|
|
|
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.
|
|
A message without an associated socket ID. Is used in most cases.
Definition at line 21 of file ZMQNoIdMessage.h.
◆ MessageParts
◆ getAdditionalDataMessage()
zmq::message_t & getAdditionalDataMessage |
( |
| ) |
|
|
inline |
Get the additional data part.
Definition at line 42 of file ZMQNoIdMessage.h.
43 {
44 return getMessagePart<c_additionalData>();
45 }
◆ getData()
std::string getData |
( |
| ) |
const |
Get the data as string.
Definition at line 15 of file ZMQNoIdMessage.cc.
16{
17 B2ASSERT("The message is an event message",
18 not
isMessage(EMessageTypes::c_eventMessage));
19 return getMessagePartAsString<c_data>();
20}
bool isMessage(EMessageTypes isType) const
The if the message is of a given type.
◆ getDataMessage()
zmq::message_t & getDataMessage |
( |
| ) |
|
|
inline |
Get the data part.
Definition at line 36 of file ZMQNoIdMessage.h.
37 {
38 return getMessagePart<c_data>();
39 }
◆ getMessagePart() [1/2]
zmq::message_t & getMessagePart |
( |
| ) |
|
|
inlineinherited |
Get the message part with the given index.
Definition at line 85 of file ZMQModuleMessage.h.
86 {
88 }
MessageParts m_messageParts
The content of this message as an array of zmq messages. Will be set during constructor or when comin...
◆ getMessagePart() [2/2]
const zmq::message_t & getMessagePart |
( |
| ) |
const |
|
inlineinherited |
Get the message part with the given index (const version)
Definition at line 62 of file ZMQModuleMessage.h.
◆ getMessagePartAsCharArray() [1/2]
char * getMessagePartAsCharArray |
( |
| ) |
|
|
inlineinherited |
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]
const char * getMessagePartAsCharArray |
( |
| ) |
const |
|
inlineinherited |
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()
std::string getMessagePartAsString |
( |
| ) |
const |
|
inlineinherited |
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]
◆ getMessageParts() [2/2]
◆ isMessage()
The if the message is of a given type.
Definition at line 23 of file ZMQNoIdMessage.cc.
24{
25 const auto& type = getMessagePartAsString<c_type>();
26 return type.size() == 1 and type[0] == static_cast<char>(isType);
27}
◆ toSocket()
static void toSocket |
( |
std::unique_ptr< ZMQModuleMessage< 3 > > |
message, |
|
|
const std::unique_ptr< zmq::socket_t > & |
socket |
|
) |
| |
|
inlinestaticinherited |
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 {
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 }
static constexpr unsigned int c_messageParts
The number of message parts this message carries.
◆ ZMQModuleMessage()
Copy the constructors.
Definition at line 104 of file ZMQModuleMessage.h.
104 :
106 {
107 }
static zmq::message_t createZMQMessage(zmq::message_t message)
Just pass a zmq message.
◆ ZMQMessageFactory
◆ c_additionalData
constexpr const unsigned int c_additionalData = 2 |
|
staticconstexpr |
◆ c_data
constexpr const unsigned int c_data = 1 |
|
staticconstexpr |
◆ c_messageParts
constexpr unsigned int c_messageParts |
|
staticconstexprinherited |
◆ c_type
constexpr const unsigned int c_type = 0 |
|
staticconstexpr |
◆ m_messageParts
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 files: