3 #include "artdaq/DAQdata/Globals.hh"
4 #define TRACE_NAME (app_name + "_AutodetectTransfer").c_str()
6 #include "artdaq/TransferPlugins/ShmemTransfer.hh"
7 #include "artdaq/TransferPlugins/TCPSocketTransfer.hh"
8 #include "artdaq/TransferPlugins/TransferInterface.hh"
39 size_t receiveTimeout)
override
41 return theTransfer_->receiveFragment(fragment, receiveTimeout);
52 return theTransfer_->receiveFragmentHeader(header, receiveTimeout);
63 return theTransfer_->receiveFragmentData(destination, wordCount);
74 return theTransfer_->transfer_fragment_min_blocking_mode(fragment, send_timeout_usec);
84 return theTransfer_->transfer_fragment_reliable_mode(std::move(fragment));
91 bool isRunning()
override {
return theTransfer_->isRunning(); }
106 std::unique_ptr<TransferInterface> theTransfer_;
113 TLOG(TLVL_INFO) << GetTraceName() <<
"Begin AutodetectTransfer constructor";
119 TLOG(TLVL_INFO) << GetTraceName() <<
"Constructing ShmemTransfer";
120 theTransfer_ = std::make_unique<ShmemTransfer>(pset,
role);
124 TLOG(TLVL_INFO) << GetTraceName() <<
"Constructing TCPSocketTransfer";
125 theTransfer_ = std::make_unique<TCPSocketTransfer>(pset,
role);
bool isRunning() override
Determine whether the TransferInterface plugin is able to send/receive data.
int receiveFragmentHeader(detail::RawFragmentHeader &header, size_t receiveTimeout) override
Receive a Fragment Header from the transport mechanism.
virtual int source_rank() const
Get the source rank for this TransferInterface instance.
Role role() const
Get the TransferInterface::Role of this TransferInterface.
int receiveFragment(artdaq::Fragment &fragment, size_t receiveTimeout) override
Receive a Fragment, using the underlying transfer plugin.
~AutodetectTransfer() override=default
AutodetectTransfer default Destructor.
AutodetectTransfer(const fhicl::ParameterSet &pset, Role role)
AutodetectTransfer Constructor.
CopyStatus transfer_fragment_reliable_mode(artdaq::Fragment &&fragment) override
Send a Fragment in reliable mode, using the underlying transfer plugin.
Role
Used to determine if a TransferInterface is a Sender or Receiver.
CopyStatus transfer_fragment_min_blocking_mode(artdaq::Fragment const &fragment, size_t send_timeout_usec) override
Send a Fragment in non-reliable mode, using the underlying transfer plugin.
void flush_buffers() override
Flush any in-flight data. This should be used by the receiver after the receive loop has ended...
int receiveFragmentData(RawDataType *destination, size_t wordCount) override
Receive the body of a Fragment to the given destination pointer.
This interface defines the functions used to transfer data between artdaq applications.
virtual int destination_rank() const
Get the destination rank for this TransferInterface instance.
hostMap_t MakeHostMap(fhicl::ParameterSet const &pset, hostMap_t map=hostMap_t())
Make a hostMap_t from a HostMap::Config ParameterSet
The AutodetectTransfer TransferInterface plugin sets up a Shmem_transfer plugin or TCPSocket_transfer...
CopyStatus
Returned from the send functions, this enumeration describes the possible return codes. If an exception occurs, it will be thrown and should be handled normally.