Belle II Software development
ZMQIdMessage.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <framework/pcore/zmq/messages/ZMQModuleMessage.h>
11#include <framework/pcore/zmq/messages/ZMQDefinitions.h>
12
13#include <zmq.hpp>
14
15namespace Belle2 {
21 class ZMQIdMessage : public ZMQModuleMessage<4> {
22 friend class ZMQMessageFactory;
23
24 public:
26 static constexpr const unsigned int c_identity = 0;
28 static constexpr const unsigned int c_type = 1;
30 static constexpr const unsigned int c_data = 2;
32 static constexpr const unsigned int c_additionalData = 3;
33
35 bool isMessage(const EMessageTypes isType) const
36 {
37 const auto& type = getMessagePartAsString<c_type>();
38 return type.size() == 1 and type[0] == static_cast<char>(isType);
39 }
40
42 std::string getIdentity() const
43 {
45 }
46
48 zmq::message_t& getDataMessage()
49 {
51 }
52
54 zmq::message_t& getAdditionalDataMessage()
55 {
57 }
58
59 private:
62 };
63
64}
A message with the socket ID. Needed in input<->worker communication.
bool isMessage(const EMessageTypes isType) const
The if the message is of a given type.
std::string getIdentity() const
Get the identity part.
static constexpr const unsigned int c_additionalData
Where the additional data is stored.
zmq::message_t & getDataMessage()
Get the data part.
static constexpr const unsigned int c_data
Where the data is stored.
ZMQModuleMessage(const ZMQModuleMessage &)=delete
Copy the constructor from the base class.
static constexpr const unsigned int c_identity
Where the identity is stored.
static constexpr const unsigned int c_type
Where the type of the message is stored.
zmq::message_t & getAdditionalDataMessage()
Get the additional data part.
const zmq::message_t & getMessagePart() const
ZMQModuleMessage(const ZMQModuleMessage &)=delete
Do not allow to copy a message.
std::string getMessagePartAsString() const
EMessageTypes
Type the messages can have.
Abstract base class for different kinds of events.