artdaq  v3_02_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
 

Public Types

enum  : int { DATA_END = -2222, RECV_TIMEOUT = -1111, RECV_SUCCESS = 0 }
 
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...
 

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 copyFragment (artdaq::Fragment &fragment, size_t send_timeout_usec)=0
 Copy a Fragment to the destination. May not necessarily be reliable. More...
 
virtual CopyStatus moveFragment (artdaq::Fragment &&fragment)=0
 Move 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...
 
std::string GetTraceName () const
 Constructs a name suitable for TRACE messages. More...
 

Static Public Member Functions

static std::string CopyStatusToString (CopyStatus in)
 

Protected Member Functions

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

Protected Attributes

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.
 
const short partition_number_
 The partition number of the DAQ.
 

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

anonymous enum : int
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.

RECV_SUCCESS 

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

Definition at line 35 of file TransferInterface.hh.

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 55 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 45 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
roleRole of the TransferInterface (See TransferInterface::Role)
* TransferInterface accepts the following Parameters:
* "source_rank" (Default: my_rank): The rank that data is coming from
* "destination_rank" (Default: my_rank): The rank that data is going to
* "unique_label" (Default: "transfer_between_[source_rank]_and_[destination_rank]"): A label that uniquely identifies the TransferInterface instance
* "buffer_count" (Default: 10): How many Fragments can the TransferInterface handle simultaneously
* "max_fragment_size_words" (Default: 1024): The maximum Fragment size expected. May be used for static memory allocation, and will cause errors
* if larger Fragments are sent.
* "partition_number" (Default: 0): Partition that this TransferInterface is a part of
* 

Definition at line 5 of file TransferInterface.cc.

Member Function Documentation

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

Copy a Fragment to the destination. May not necessarily be reliable.

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

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

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 166 of file TransferInterface.hh.

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

Constructs a name suitable for TRACE messages.

Returns
The unique_label and a SEND/RECV identifier

Definition at line 180 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::NullTransfer, artdaq::ShmemTransfer, and artdaq::RTIDDSTransfer.

Definition at line 172 of file TransferInterface.hh.

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

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

Parameters
fragmentFragment to move
Returns
CopyStatus detailing result of copy

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

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 18 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 198 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 161 of file TransferInterface.hh.

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 155 of file TransferInterface.hh.


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