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"
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()); \
109 Response receive(
const duration_t& timeout, message_size_t num_bytes = s_any_size,
bool no_tmoexcept_mode =
false);
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
static constexpr duration_t s_block
std::chrono::milliseconds duration_t
static constexpr message_size_t s_any_size
Receiver(Receiver &&)=delete
virtual bool data_pending()=0
Receiver & operator=(const Receiver &)=delete
std::atomic< size_t > m_bytes
static constexpr duration_t s_no_block
void generate_opmon_data() override
Receiver & operator=(Receiver &&)=delete
virtual Response receive_(const duration_t &timeout, bool no_tmoexcept_mode)=0
virtual bool can_receive() const noexcept=0
std::atomic< size_t > m_messages
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)
ERS_DECLARE_ISSUE(cmdlib, MalformedUri, "Malformed uri: "<< error<< " uri:"<< uri,((std::string) error)((std::string) uri)) ERS_DECLARE_ISSUE(cmdlib
cmdlib specific issues
std::vector< std::string > connection_strings
std::string connection_name
std::string connection_string