Belle II Software  release-08-01-10
ZMQNoIdMessage.cc
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 #include <framework/pcore/zmq/messages/ZMQNoIdMessage.h>
9 
10 #include <framework/logging/Logger.h>
11 
12 using namespace Belle2;
13 
15 std::string ZMQNoIdMessage::getData() const
16 {
17  B2ASSERT("The message is an event message",
18  not isMessage(EMessageTypes::c_eventMessage));
19  return getMessagePartAsString<c_data>();
20 }
21 
23 bool ZMQNoIdMessage::isMessage(const EMessageTypes isType) const
24 {
25  const auto& type = getMessagePartAsString<c_type>();
26  return type.size() == 1 and type[0] == static_cast<char>(isType);
27 }
std::string getData() const
Get the data as string.
bool isMessage(EMessageTypes isType) const
The if the message is of a given type.
EMessageTypes
Type the messages can have.
Abstract base class for different kinds of events.