23#ifndef IPM_INCLUDE_IPM_RECEIVER_HPP_
24#define IPM_INCLUDE_IPM_RECEIVER_HPP_
26#include "cetlib/BasicPluginFactory.h"
27#include "cetlib/compiler_macros.h"
39ERS_DECLARE_ISSUE(ipm, KnownStateForbidsReceive,
"Receiver not in a state to receive data", )
41 UnexpectedNumberOfBytes,
42 connection_name << ": Expected " << bytes1 << " bytes in message but received " << bytes2,
43 ((
std::
string)connection_name)((
int)bytes1)((
int)bytes2))
46 connection_name << ": Unable
to receive within timeout period (timeout period was " << timeout << " milliseconds)",
47 ((
std::
string)connection_name)((
int)timeout))
51#ifndef EXTERN_C_FUNC_DECLARE_START
53#define EXTERN_C_FUNC_DECLARE_START \
63#define DEFINE_DUNE_IPM_RECEIVER(klass) \
64 EXTERN_C_FUNC_DECLARE_START \
65 std::shared_ptr<dunedaq::ipm::Receiver> make() \
67 return std::shared_ptr<dunedaq::ipm::Receiver>(new klass()); \
79 std::string connection_name{
"" };
80 std::string connection_string{
"" };
81 std::vector<std::string> connection_strings{};
85 static constexpr duration_t s_no_block = duration_t::zero();
105 std::string metadata{
"" };
106 std::vector<char> data{};
109 Response receive(
const duration_t& timeout, message_size_t num_bytes = s_any_size,
bool no_tmoexcept_mode =
false);
123 void generate_opmon_data()
override;
128 mutable std::atomic<size_t> m_bytes = { 0 };
129 mutable std::atomic<size_t> m_messages = { 0 };
132inline std::shared_ptr<Receiver>
135 static cet::BasicPluginFactory bpf(
"duneIPM",
"make");
136 return bpf.makePlugin<std::shared_ptr<Receiver>>(plugin_name);
ConnectionInfo m_connection_info
Receiver(const Receiver &)=delete
virtual void unregister_callback()=0
virtual ~Receiver()=default
std::chrono::milliseconds duration_t
Receiver(Receiver &&)=delete
virtual bool data_pending()=0
Receiver & operator=(const Receiver &)=delete
Receiver & operator=(Receiver &&)=delete
virtual Response receive_(const duration_t &timeout, bool no_tmoexcept_mode)=0
virtual bool can_receive() const noexcept=0
virtual void register_callback(std::function< void(Response &)>)=0
virtual std::string connect_for_receives(const ConnectionInfo &connection_info)=0
#define ERS_DECLARE_ISSUE( namespace_name, class_name, message_, attributes)
An ERS Error indicating that an exception was thrown from ZMQ while performing an operation.
std::shared_ptr< Receiver > make_ipm_receiver(std::string const &plugin_name)
Both frame_count_limit and tp_count_limit were set to(disabled) in the TPCRawDataProcessor config. TPs will not send."