1 #define TRACE_NAME "AutodetectTransfer"
3 #include "artdaq/TransferPlugins/TransferInterface.hh"
4 #include "artdaq/TransferPlugins/TCPSocketTransfer.hh"
5 #include "artdaq/TransferPlugins/ShmemTransfer.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_->copyFragment(fragment, send_timeout_usec);
83 return theTransfer_->moveFragment(std::move(fragment));
87 std::unique_ptr<TransferInterface> theTransfer_;
94 TLOG(TLVL_INFO) <<
GetTraceName() <<
": Begin AutodetectTransfer constructor" ;
95 std::string srcHost, destHost;
96 auto hosts = pset.get<std::vector<fhicl::ParameterSet>>(
"host_map");
97 for (
auto& ps : hosts)
99 auto rank = ps.get<
int>(
"rank", -1);
102 srcHost = ps.get<std::string>(
"host",
"localhost");
106 destHost = ps.get<std::string>(
"host",
"localhost");
109 TLOG(TLVL_DEBUG) <<
GetTraceName() <<
": srcHost=" << srcHost <<
", destHost=" << destHost ;
110 if (srcHost == destHost)
112 TLOG(TLVL_INFO) <<
GetTraceName() <<
": Constructing ShmemTransfer" ;
117 TLOG(TLVL_INFO) <<
GetTraceName() <<
": Constructing TCPSocketTransfer" ;
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.
virtual ~AutodetectTransfer()=default
AutodetectTransfer default Destructor.
int receiveFragment(artdaq::Fragment &fragment, size_t receiveTimeout) override
Receive a Fragment, using the underlying transfer plugin.
std::string GetTraceName() const
Constructs a name suitable for TRACE messages.
AutodetectTransfer(const fhicl::ParameterSet &pset, Role role)
AutodetectTransfer Constructor.
CopyStatus copyFragment(artdaq::Fragment &fragment, size_t send_timeout_usec) override
Send a Fragment in non-reliable mode, using the underlying transfer plugin.
Role
Used to determine if a TransferInterface is a Sender or Receiver.
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.
CopyStatus moveFragment(artdaq::Fragment &&fragment) override
Send a Fragment in reliable mode, using the underlying transfer plugin.
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.