1 #ifndef artdaq_ArtModules_TransferInterface_hh
2 #define artdaq_ArtModules_TransferInterface_hh
4 #include "artdaq/DAQdata/Globals.hh"
5 #include "artdaq-core/Data/Fragment.hh"
6 #include "fhiclcpp/ParameterSet.h"
7 #include "cetlib/compiler_macros.h"
47 static std::string CopyStatusToString(
CopyStatus in)
54 default:
return "UNKNOWN";
98 virtual int receiveFragment(artdaq::Fragment& fragment,
size_t receiveTimeout);
161 const int source_rank_;
162 const int destination_rank_;
163 const std::string unique_label_;
169 int GetPartitionNumber()
const;
185 #ifndef EXTERN_C_FUNC_DECLARE_START
186 #define EXTERN_C_FUNC_DECLARE_START extern "C" {
189 #define DEFINE_ARTDAQ_TRANSFER(klass) \
190 EXTERN_C_FUNC_DECLARE_START \
191 std::unique_ptr<artdaq::TransferInterface> make(fhicl::ParameterSet const & ps, \
192 artdaq::TransferInterface::Role role) { \
193 return std::unique_ptr<artdaq::TransferInterface>(new klass(ps, role)); \
size_t buffer_count_
The number of Fragment transfers the TransferInterface can handle simultaneously. ...
virtual int receiveFragmentHeader(detail::RawFragmentHeader &header, size_t receiveTimeout)=0
Receive a Fragment Header from the transport mechanism.
virtual int source_rank() const
Get the source rank for this TransferInterface instance.
TransferInterface & operator=(const TransferInterface &)=delete
Copy Assignment operator is deleted.
Value to be returned upon receive timeout.
Role role() const
Get the TransferInterface::Role of this TransferInterface.
The send operation timed out.
For code clarity, things checking for successful receive should check retval >= RECV_SUCCESS.
std::string GetTraceName() const
Constructs a name suitable for TRACE messages.
virtual ~TransferInterface()=default
Default virtual Destructor.
This TransferInterface is a Receiver.
const short partition_number_
The partition number of the DAQ.
virtual int receiveFragmentData(RawDataType *destination, size_t wordCount)=0
Receive the body of a Fragment to the given destination pointer.
Value that is to be returned when a Transfer plugin determines that no more data will be arriving...
This TransferInterface is a Sender.
Some error occurred, but no exception was thrown.
Role
Used to determine if a TransferInterface is a Sender or Receiver.
The send operation completed successfully.
std::string uniqueLabel() const
Get the unique label of this TransferInterface instance.
virtual CopyStatus copyFragment(artdaq::Fragment &fragment, size_t send_timeout_usec)=0
Copy a Fragment to the destination. May not necessarily be reliable.
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(const fhicl::ParameterSet &ps, Role role)
TransferInterface Constructor.
virtual int receiveFragment(artdaq::Fragment &fragment, size_t receiveTimeout)
Receive a Fragment from the transport mechanism.
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.
virtual CopyStatus moveFragment(artdaq::Fragment &&fragment)=0
Move a Fragment to the destination. This should be reliable, if the underlying transport mechanism su...
const size_t max_fragment_size_words_
The maximum size of the transferred Fragment objects, in artdaq::Fragment::RawDataType words...