artdaq  v3_04_00
artdaq::TransferInterface Class Referenceabstract

This interface defines the functions used to transfer data between artdaq applications. More...

#include <artdaq/TransferPlugins/TransferInterface.hh>

Inheritance diagram for artdaq::TransferInterface:
artdaq::AutodetectTransfer artdaq::MulticastTransfer artdaq::NullTransfer artdaq::RTIDDSTransfer artdaq::ShmemTransfer artdaq::TCPSocketTransfer

Classes

struct  Config
 Configuration of the TransferInterface. May be used for parameter validation More...
 

Public Types

enum  ReceiveReturnCode : int { DATA_END = -2222, RECV_TIMEOUT = -1111, NO_RANK_INFO = -1, RECV_SUCCESS = 0 }
 Return codes from receive operations More...
 
enum  Role { Role::kSend, Role::kReceive }
 Used to determine if a TransferInterface is a Sender or Receiver. More...
 
enum  CopyStatus { CopyStatus::kSuccess, CopyStatus::kTimeout, CopyStatus::kErrorNotRequiringException }
 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. More...
 
using Parameters = fhicl::WrappedTable< Config >
 

Public Member Functions

 TransferInterface (const fhicl::ParameterSet &ps, Role role)
 TransferInterface Constructor. More...
 
 TransferInterface (const TransferInterface &)=delete
 Copy Constructor is deleted.
 
TransferInterfaceoperator= (const TransferInterface &)=delete
 Copy Assignment operator is deleted. More...
 
virtual ~TransferInterface ()=default
 Default virtual Destructor.
 
virtual int receiveFragment (artdaq::Fragment &fragment, size_t receiveTimeout)
 Receive a Fragment from the transport mechanism. More...
 
virtual int receiveFragmentHeader (detail::RawFragmentHeader &header, size_t receiveTimeout)=0
 Receive a Fragment Header from the transport mechanism. More...
 
virtual int receiveFragmentData (RawDataType *destination, size_t wordCount)=0
 Receive the body of a Fragment to the given destination pointer. More...
 
virtual CopyStatus transfer_fragment_min_blocking_mode (artdaq::Fragment const &fragment, size_t send_timeout_usec)=0
 Transfer a Fragment to the destination. May not necessarily be reliable, but will not block longer than send_timeout_usec. More...
 
virtual CopyStatus transfer_fragment_reliable_mode (artdaq::Fragment &&fragment)=0
 Transfer a Fragment to the destination. This should be reliable, if the underlying transport mechanism supports reliable sending. More...
 
std::string uniqueLabel () const
 Get the unique label of this TransferInterface instance. More...
 
virtual int source_rank () const
 Get the source rank for this TransferInterface instance. More...
 
virtual int destination_rank () const
 Get the destination rank for this TransferInterface instance. More...
 
virtual bool isRunning ()
 Determine whether the TransferInterface plugin is able to send/receive data. More...
 
virtual void flush_buffers ()=0
 Flush any in-flight data. This should be used by the receiver after the receive loop has ended.
 

Static Public Member Functions

static std::string CopyStatusToString (CopyStatus in)
 Convert a CopyStatus variable to its string represenatation More...
 

Protected Member Functions

Role role () const
 Get the TransferInterface::Role of this TransferInterface. More...
 

Protected Attributes

const Role role_
 Whether this instance of TransferInterface is a sender or receiver.
 
const int source_rank_
 Rank of source.
 
const int destination_rank_
 Rank of destination.
 
const std::string unique_label_
 Unique label of transfer (ideally the same on sender and receiver)
 
size_t buffer_count_
 The number of Fragment transfers the TransferInterface can handle simultaneously.
 
const size_t max_fragment_size_words_
 The maximum size of the transferred Fragment objects, in artdaq::Fragment::RawDataType words.
 

Detailed Description

This interface defines the functions used to transfer data between artdaq applications.

Definition at line 18 of file TransferInterface.hh.

Member Enumeration Documentation

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.

Enumerator
kSuccess 

The send operation completed successfully.

kTimeout 

The send operation timed out.

kErrorNotRequiringException 

Some error occurred, but no exception was thrown.

Definition at line 63 of file TransferInterface.hh.

Return codes from receive operations

Enumerator
DATA_END 

Value that is to be returned when a Transfer plugin determines that no more data will be arriving.

RECV_TIMEOUT 

Value to be returned upon receive timeout.

NO_RANK_INFO 

Will be returned from a successful receive that does not know the source rank (Transfer to OM art process)

RECV_SUCCESS 

For code clarity, things checking for successful receive should check retval >= NO_RANK_INFO.

Definition at line 42 of file TransferInterface.hh.

Used to determine if a TransferInterface is a Sender or Receiver.

Enumerator
kSend 

This TransferInterface is a Sender.

kReceive 

This TransferInterface is a Receiver.

Definition at line 53 of file TransferInterface.hh.

Constructor & Destructor Documentation

artdaq::TransferInterface::TransferInterface ( const fhicl::ParameterSet &  ps,
Role  role 
)

TransferInterface Constructor.

Parameters
psParameterSet used for configuring the TransferInterface. See artdaq::TransferInterface::Config
roleRole of the TransferInterface (See TransferInterface::Role)

Definition at line 7 of file TransferInterface.cc.

Member Function Documentation

static std::string artdaq::TransferInterface::CopyStatusToString ( CopyStatus  in)
inlinestatic

Convert a CopyStatus variable to its string represenatation

Parameters
inCopyStatus to convert
Returns
String representation of CopyStatus

Definition at line 75 of file TransferInterface.hh.

virtual int artdaq::TransferInterface::destination_rank ( ) const
inlinevirtual

Get the destination rank for this TransferInterface instance.

Returns
The destination rank for this TransferInterface instance

Definition at line 167 of file TransferInterface.hh.

virtual bool artdaq::TransferInterface::isRunning ( )
inlinevirtual

Determine whether the TransferInterface plugin is able to send/receive data.

Returns
True if the TransferInterface plugin is currently able to send/receive data

Reimplemented in artdaq::MulticastTransfer, artdaq::TCPSocketTransfer, artdaq::AutodetectTransfer, artdaq::ShmemTransfer, artdaq::RTIDDSTransfer, and artdaq::NullTransfer.

Definition at line 173 of file TransferInterface.hh.

TransferInterface& artdaq::TransferInterface::operator= ( const TransferInterface )
delete

Copy Assignment operator is deleted.

Returns
TransferInterface Copy
int artdaq::TransferInterface::receiveFragment ( artdaq::Fragment &  fragment,
size_t  receiveTimeout 
)
virtual

Receive a Fragment from the transport mechanism.

Parameters
[out]fragmentReceived Fragment
receiveTimeoutTimeout for receive
Returns
The rank the Fragment was received from (should be source_rank), or RECV_TIMEOUT

Reimplemented in artdaq::MulticastTransfer, artdaq::RTIDDSTransfer, artdaq::AutodetectTransfer, and artdaq::NullTransfer.

Definition at line 19 of file TransferInterface.cc.

virtual int artdaq::TransferInterface::receiveFragmentData ( RawDataType *  destination,
size_t  wordCount 
)
pure virtual

Receive the body of a Fragment to the given destination pointer.

Parameters
destinationPointer to memory region where Fragment data should be stored
wordCountNumber of words of Fragment data to receive
Returns
The rank the Fragment was received from (should be source_rank), or RECV_TIMEOUT

The precondition for calling this function is that you have received a valid header, therefore it does not have a , as the Fragment data should immediately be available.

Implemented in artdaq::MulticastTransfer, artdaq::TCPSocketTransfer, artdaq::ShmemTransfer, artdaq::AutodetectTransfer, and artdaq::NullTransfer.

virtual int artdaq::TransferInterface::receiveFragmentHeader ( detail::RawFragmentHeader &  header,
size_t  receiveTimeout 
)
pure virtual

Receive a Fragment Header from the transport mechanism.

Parameters
[out]headerReceived Fragment Header
receiveTimeoutTimeout for receive
Returns
The rank the Fragment was received from (should be source_rank), or RECV_TIMEOUT

Implemented in artdaq::MulticastTransfer, artdaq::TCPSocketTransfer, artdaq::ShmemTransfer, artdaq::AutodetectTransfer, and artdaq::NullTransfer.

Role artdaq::TransferInterface::role ( ) const
inlineprotected

Get the TransferInterface::Role of this TransferInterface.

Returns
The Role of this TransferInterface

Definition at line 200 of file TransferInterface.hh.

virtual int artdaq::TransferInterface::source_rank ( ) const
inlinevirtual

Get the source rank for this TransferInterface instance.

Returns
The source rank for this Transferinterface instance

Definition at line 162 of file TransferInterface.hh.

virtual CopyStatus artdaq::TransferInterface::transfer_fragment_min_blocking_mode ( artdaq::Fragment const &  fragment,
size_t  send_timeout_usec 
)
pure virtual

Transfer a Fragment to the destination. May not necessarily be reliable, but will not block longer than send_timeout_usec.

Parameters
fragmentFragment to transfer
send_timeout_usecTimeout for send, in microseconds
Returns
CopyStatus detailing result of transfer

Implemented in artdaq::MulticastTransfer, artdaq::AutodetectTransfer, artdaq::RTIDDSTransfer, and artdaq::NullTransfer.

virtual CopyStatus artdaq::TransferInterface::transfer_fragment_reliable_mode ( artdaq::Fragment &&  fragment)
pure virtual

Transfer a Fragment to the destination. This should be reliable, if the underlying transport mechanism supports reliable sending.

Parameters
fragmentFragment to transfer
Returns
CopyStatus detailing result of copy

Implemented in artdaq::MulticastTransfer, artdaq::AutodetectTransfer, artdaq::RTIDDSTransfer, and artdaq::NullTransfer.

std::string artdaq::TransferInterface::uniqueLabel ( ) const
inline

Get the unique label of this TransferInterface instance.

Returns
The unique label of this TransferInterface instance

Definition at line 156 of file TransferInterface.hh.


The documentation for this class was generated from the following files: