1 #include "artdaq/DAQdata/Globals.hh"
2 #define TRACE_NAME (app_name + "_AutodetectTransfer").c_str()
4 #include "artdaq/TransferPlugins/ShmemTransfer.hh"
5 #include "artdaq/TransferPlugins/TCPSocketTransfer.hh"
6 #include "artdaq/TransferPlugins/TransferInterface.hh"
37 size_t receiveTimeout)
override
39 return theTransfer_->receiveFragment(fragment, receiveTimeout);
50 return theTransfer_->receiveFragmentHeader(header, receiveTimeout);
61 return theTransfer_->receiveFragmentData(destination, wordCount);
72 return theTransfer_->transfer_fragment_min_blocking_mode(fragment, send_timeout_usec);
82 return theTransfer_->transfer_fragment_reliable_mode(std::move(fragment));
89 bool isRunning()
override {
return theTransfer_->isRunning(); }
98 std::unique_ptr<TransferInterface> theTransfer_;
105 TLOG(TLVL_INFO) << GetTraceName() <<
": Begin AutodetectTransfer constructor";
111 TLOG(TLVL_INFO) << GetTraceName() <<
": Constructing ShmemTransfer";
116 TLOG(TLVL_INFO) << GetTraceName() <<
": Constructing TCPSocketTransfer";
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.
hostMap_t MakeHostMap(fhicl::ParameterSet pset, hostMap_t map=hostMap_t())
Make a hostMap_t from a HostMap::Config ParameterSet
virtual ~AutodetectTransfer()=default
AutodetectTransfer default Destructor.
int receiveFragment(artdaq::Fragment &fragment, size_t receiveTimeout) override
Receive a Fragment, using the underlying transfer plugin.
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.
A TransferInterface implementation plugin that transfers data using Shared Memory.
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.
TransferInterface implementation plugin that sends data using TCP sockets.
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.