Belle II Software development
HLTDs2ZMQRaw.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/core/Module.h>
11
12#include <framework/pcore/zmq/utils/StreamHelper.h>
13#include <framework/pcore/zmq/connections/ZMQRawConnection.h>
14
15#include <framework/pcore/zmq/utils/ZMQParent.h>
16#include <framework/datastore/StoreObjPtr.h>
17#include <framework/dataobjects/EventMetaData.h>
18
19#include <memory>
20#include <zmq.hpp>
21
22namespace Belle2 {
45 class HLTDs2ZMQRawModule : public Module {
46 public:
49
51 void initialize() override;
53 void event() override;
54
55 private:
57 std::string m_param_output;
63 bool m_param_addPersistentDurability, m_param_streamTransientObjects;
64
66 std::shared_ptr<ZMQParent> m_parent;
68 std::unique_ptr<ZMQRawOutput> m_output;
69
73 bool m_firstEvent = false;
74
77 };
79}
On every event, serialize the data store and send the binary data out to the connected ZMQ applicatio...
Definition: HLTDs2ZMQRaw.h:45
bool m_firstEvent
Are we still in the first event? Please note the special handling of the first event in the HLTEventP...
Definition: HLTDs2ZMQRaw.h:73
std::string m_param_output
Module parameter: the ZMQ address of the connected application (to receive the messages)
Definition: HLTDs2ZMQRaw.h:57
ZMQMessageHelper m_messageHelper
Message helper to create zmq::message_t from EventMetaData and EvtMessage.
Definition: HLTDs2ZMQRaw.h:76
HLTDs2ZMQRawModule()
Register the module parameters.
Definition: HLTDs2ZMQRaw.cc:15
void initialize() override
Module initialization, only applied when the initial m_firstEvent is false.
Definition: HLTDs2ZMQRaw.cc:41
void event() override
On the first event, initialize the streamer and the connection. Serializes and sends out the data sto...
Definition: HLTDs2ZMQRaw.cc:51
bool m_param_addEventSize
Module parameter: add event size in the output data or not.
Definition: HLTDs2ZMQRaw.h:61
std::shared_ptr< ZMQParent > m_parent
ZMQ Parent needed for the connections.
Definition: HLTDs2ZMQRaw.h:66
bool m_param_addPersistentDurability
Module parameters for streamHelper.
Definition: HLTDs2ZMQRaw.h:63
std::unique_ptr< ZMQRawOutput > m_output
Raw output connection to the ZMQ application.
Definition: HLTDs2ZMQRaw.h:68
StreamHelper m_streamHelper
Original stream helper.
Definition: HLTDs2ZMQRaw.h:71
bool m_param_raw
Module paremeter: send out raw data with send header and trailer around the evtmessage instead of jus...
Definition: HLTDs2ZMQRaw.h:59
Base class for Modules.
Definition: Module.h:72
Helper class for data store serialization.
Definition: StreamHelper.h:23
Internal helper for creating ZMQ messages (should not be used otherwise).
Abstract base class for different kinds of events.