1 #include "artdaq/TransferPlugins/TransferInterface.hh"
2 #include "artdaq/TransferPlugins/TCPSocketTransfer.hh"
3 #include "artdaq/TransferPlugins/ShmemTransfer.hh"
35 size_t receiveTimeout)
override
37 return theTransfer_->receiveFragment(fragment, receiveTimeout);
47 size_t send_timeout_usec = std::numeric_limits<size_t>::max())
override
49 return theTransfer_->copyFragment(fragment, send_timeout_usec);
59 size_t send_timeout_usec = std::numeric_limits<size_t>::max())
override
61 return theTransfer_->moveFragment(std::move(fragment), send_timeout_usec);
65 std::unique_ptr<TransferInterface> theTransfer_;
72 TLOG_DEBUG(
uniqueLabel()) <<
"Begin AutodetectTransfer constructor" << TLOG_ENDL;
73 std::string srcHost, destHost;
74 auto hosts = pset.get<std::vector<fhicl::ParameterSet>>(
"host_map");
75 for (
auto& ps : hosts)
77 auto rank = ps.get<
int>(
"rank", -1);
80 srcHost = ps.get<std::string>(
"host",
"localhost");
84 destHost = ps.get<std::string>(
"host",
"localhost");
87 TLOG_DEBUG(
uniqueLabel()) <<
"ADT: srcHost=" << srcHost <<
", destHost=" << destHost << TLOG_ENDL;
88 if (srcHost == destHost)
90 TLOG_DEBUG(
uniqueLabel()) <<
"ADT: Constructing ShmemTransfer" << TLOG_ENDL;
95 TLOG_DEBUG(
uniqueLabel()) <<
"ADT: Constructing TCPSocketTransfer" << TLOG_ENDL;
virtual int source_rank() const
Get the source rank for this TransferInterface instance.
Role role() const
Get the TransferInterface::Role of this TransferInterface.
virtual ~AutodetectTransfer()=default
AutodetectTransfer default Destructor.
CopyStatus copyFragment(artdaq::Fragment &fragment, size_t send_timeout_usec=std::numeric_limits< size_t >::max()) override
Send a Fragment in non-reliable mode, using the underlying transfer plugin.
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.
Role
Used to determine if a TransferInterface is a Sender or Receiver.
std::string uniqueLabel() const
Get the unique label of this TransferInterface instance.
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.
CopyStatus moveFragment(artdaq::Fragment &&fragment, size_t send_timeout_usec=std::numeric_limits< size_t >::max()) override
Send a Fragment in reliable mode, using the underlying transfer plugin.
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.