Belle II Software  release-08-01-10
ZMQNoIdMessage.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 
15 namespace Belle2 {
21  class ZMQNoIdMessage : public ZMQModuleMessage<3> {
22  friend class ZMQMessageFactory;
23 
24  public:
26  static constexpr const unsigned int c_type = 0;
28  static constexpr const unsigned int c_data = 1;
30  static constexpr const unsigned int c_additionalData = 2;
31 
33  std::string getData() const;
34 
36  zmq::message_t& getDataMessage()
37  {
38  return getMessagePart<c_data>();
39  }
40 
42  zmq::message_t& getAdditionalDataMessage()
43  {
44  return getMessagePart<c_additionalData>();
45  }
46 
48  bool isMessage(EMessageTypes isType) const;
49 
50  private:
53  };
55 }
Helper class for creating new ID/No-ID messages.
A general message with as many parts as given as template argument.
ZMQModuleMessage()=default
Do not allow to create a new message from scratch publicly.
A message without an associated socket ID. Is used in most cases.
static constexpr const unsigned int c_additionalData
Where the additional data is stored.
std::string getData() const
Get the data as string.
static constexpr const unsigned int c_data
Where the data is stored.
bool isMessage(EMessageTypes isType) const
The if the message is of a given type.
zmq::message_t & getDataMessage()
Get the data part.
static constexpr const unsigned int c_type
Where the type is stored.
zmq::message_t & getAdditionalDataMessage()
Get the additional data part.
EMessageTypes
Type the messages can have.
Abstract base class for different kinds of events.