Belle II Software  release-05-01-25
ZMQROIConnection.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun, Markus Prim *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <framework/pcore/zmq/connections/ZMQRawConnection.h>
13 #include <framework/pcore/zmq/utils/ZMQParent.h>
14 #include <framework/pcore/zmq/messages/ZMQNoIdMessage.h>
15 #include <daq/roisend/h2m.h>
16 
17 #include <zmq.hpp>
18 
19 namespace Belle2 {
33  class ZMQDataAndROIOutput : public ZMQConnection {
34  public:
36  ZMQDataAndROIOutput(const std::string& dataAddress, const std::string& roiAddress, bool addEventSize,
37  const std::shared_ptr<ZMQParent>& parent);
38 
40  std::string getMonitoringJSON() const final;
42  std::string getROIMonitoringJSON() const;
43 
45  void handleEvent(std::unique_ptr<ZMQNoIdMessage> message);
47  void handleIncomingData();
49  bool isReady() const final;
51  std::vector<zmq::socket_t*> getSockets() const final;
52 
53  private:
55  ZMQRawOutput m_dataOutput;
57  ZMQRawOutput m_roiOutput;
58  };
60 }
Belle2::ZMQDataAndROIOutput::handleEvent
void handleEvent(std::unique_ptr< ZMQNoIdMessage > message)
Send the normal data message to raw and the additional message to ROI.
Definition: ZMQROIConnection.cc:19
Belle2::ZMQDataAndROIOutput::ZMQDataAndROIOutput
ZMQDataAndROIOutput(const std::string &dataAddress, const std::string &roiAddress, bool addEventSize, const std::shared_ptr< ZMQParent > &parent)
Initialize the raw and roi connection.
Definition: ZMQROIConnection.cc:15
Belle2::ZMQDataAndROIOutput::getMonitoringJSON
std::string getMonitoringJSON() const final
Get the monitoring JSON from the raw connection.
Definition: ZMQROIConnection.cc:50
Belle2::ZMQDataAndROIOutput::isReady
bool isReady() const final
Ready only when both sockets are ready.
Definition: ZMQROIConnection.cc:40
Belle2::ZMQDataAndROIOutput::m_roiOutput
ZMQRawOutput m_roiOutput
The used ROI connection.
Definition: ZMQROIConnection.h:65
Belle2::ZMQDataAndROIOutput::getSockets
std::vector< zmq::socket_t * > getSockets() const final
Return both sockets for polling.
Definition: ZMQROIConnection.cc:45
Belle2::ZMQDataAndROIOutput::m_dataOutput
ZMQRawOutput m_dataOutput
The used raw connection.
Definition: ZMQROIConnection.h:63
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ZMQDataAndROIOutput::handleIncomingData
void handleIncomingData()
Handle both a socket (dis)connect by raw or ROI.
Definition: ZMQROIConnection.cc:30
Belle2::ZMQDataAndROIOutput::getROIMonitoringJSON
std::string getROIMonitoringJSON() const
Get the monitoring JSON from the ROI connection.
Definition: ZMQROIConnection.cc:55