Belle II Software  release-08-01-10
HLTDs2ZMQ.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 <daq/hbasf2/utils/HLTStreamHelper.h>
13 #include <framework/pcore/zmq/connections/ZMQConfirmedConnection.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 
22 namespace Belle2 {
45  class HLTDs2ZMQModule : public Module {
46  public:
49 
51  void event() override;
53  void endRun() override;
55  void terminate() override;
56 
57  private:
59  std::string m_param_output;
64 
66  std::shared_ptr<ZMQParent> m_parent;
68  std::unique_ptr<ZMQConfirmedOutput> m_output;
69 
73  bool m_firstEvent = true;
74  };
76 }
On every event, serialize the data store and send the binary data out to the connected ZMQ applicatio...
Definition: HLTDs2ZMQ.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: HLTDs2ZMQ.h:73
std::string m_param_output
Module parameter: the ZMQ address of the connected application (to receive the messages)
Definition: HLTDs2ZMQ.h:59
void event() override
On the first event, initialize the streamer and the connection. Serializes and sends out the data sto...
Definition: HLTDs2ZMQ.cc:44
void endRun() override
Send out a run stop message.
Definition: HLTDs2ZMQ.cc:74
std::shared_ptr< ZMQParent > m_parent
ZMQ Parent needed for the connections.
Definition: HLTDs2ZMQ.h:66
void terminate() override
Send out a terminate message.
Definition: HLTDs2ZMQ.cc:91
bool m_param_outputConfirmation
Module parameter: waiting for output confirmation message or not.
Definition: HLTDs2ZMQ.h:63
HLTDs2ZMQModule()
Register the module parameters.
Definition: HLTDs2ZMQ.cc:16
HLTStreamHelper m_streamHelper
Utility class used for serialization.
Definition: HLTDs2ZMQ.h:71
std::unique_ptr< ZMQConfirmedOutput > m_output
Confirmed connection to the ZMQ application.
Definition: HLTDs2ZMQ.h:68
bool m_param_raw
Module paremeter: send out raw data with send header and trailer around the evtmessage instead of jus...
Definition: HLTDs2ZMQ.h:61
Helper class for data store serialization.
Base class for Modules.
Definition: Module.h:72
Abstract base class for different kinds of events.