artdaq  v3_08_00
artdaq::MulticastTransfer Class Reference

MulticastTransfer is a TransferInterface implementation plugin that transfers data using Multicast. More...

Inheritance diagram for artdaq::MulticastTransfer:
artdaq::TransferInterface

Public Types

using byte_t = artdaq::Fragment::byte_t
 Copy Fragment::byte_t into local scope.
 
- Public Types inherited from artdaq::TransferInterface
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 >
 Used for ParameterSet validation (if desired)
 

Public Member Functions

virtual ~MulticastTransfer ()=default
 Default destructor.
 
 MulticastTransfer (fhicl::ParameterSet const &ps, Role role)
 MulticastTransfer Constructor. More...
 
int receiveFragment (artdaq::Fragment &fragment, size_t receiveTimeout) override
 Receive a Fragment using Multicast. More...
 
int receiveFragmentHeader (detail::RawFragmentHeader &header, size_t receiveTimeout) override
 Receive a Fragment Header from the transport mechanism. More...
 
int receiveFragmentData (RawDataType *destination, size_t wordCount) override
 Receive the body of a Fragment to the given destination pointer. More...
 
CopyStatus transfer_fragment_min_blocking_mode (artdaq::Fragment const &fragment, size_t send_timeout_usec) override
 Copy a Fragment to the destination. Multicast is always unreliable. More...
 
CopyStatus transfer_fragment_reliable_mode (artdaq::Fragment &&fragment) override
 Move a Fragment to the destination. Multicast is always unreliable. More...
 
bool isRunning () override
 Determine whether the TransferInterface plugin is able to send/receive data. More...
 
void flush_buffers () override
 Flush any in-flight data. This should be used by the receiver after the receive loop has ended.
 
- Public Member Functions inherited from artdaq::TransferInterface
 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.
 
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...
 

Additional Inherited Members

- Static Public Member Functions inherited from artdaq::TransferInterface
static std::string CopyStatusToString (CopyStatus in)
 Convert a CopyStatus variable to its string represenatation More...
 
- Protected Member Functions inherited from artdaq::TransferInterface
Role role () const
 Get the TransferInterface::Role of this TransferInterface. More...
 
- Protected Attributes inherited from artdaq::TransferInterface
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

MulticastTransfer is a TransferInterface implementation plugin that transfers data using Multicast.

Definition at line 29 of file Multicast_transfer.cc.

Constructor & Destructor Documentation

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

MulticastTransfer Constructor.

Parameters
psParameterSet used to configure MulticastTransfer
roleRole of this MulticastTransfer instance (kSend or kReceive)
* MulticastTransfer accepts the following Parameters:
* "subfragment_size" (REQUIRED): Size of the sub-Fragments
* "subfragments_per_send" (REQUIRED): How many sub-Fragments to send in each batch
* "pause_on_copy_usecs" (Default: 0): Pause after sending a batch of sub-Fragments for this many microseconds
* "multicast_port" (REQUIRED): Port number to connect to
* "multicast_address" (REQUIRED): Multicast address to send to/receive from
* "local_address" (REQUIRED): Local origination address for multicast
* "receive_buffer_size" (Default: 0): The UDP receive buffer size. 0 uses automatic size.
* 

MulticastTransfer also requires all Parameters for configuring a TransferInterface

Definition at line 163 of file Multicast_transfer.cc.

Member Function Documentation

bool artdaq::MulticastTransfer::isRunning ( )
inlineoverridevirtual

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 from artdaq::TransferInterface.

Definition at line 102 of file Multicast_transfer.cc.

int artdaq::MulticastTransfer::receiveFragment ( artdaq::Fragment &  fragment,
size_t  receiveTimeout 
)
overridevirtual

Receive a Fragment using Multicast.

Parameters
[out]fragmentReceived Fragment
receiveTimeoutTimeout for receive, in microseconds
Returns
Rank of sender or RECV_TIMEOUT

Reimplemented from artdaq::TransferInterface.

Definition at line 247 of file Multicast_transfer.cc.

int artdaq::MulticastTransfer::receiveFragmentData ( RawDataType *  destination,
size_t  wordCount 
)
overridevirtual

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

Implements artdaq::TransferInterface.

Definition at line 394 of file Multicast_transfer.cc.

int artdaq::MulticastTransfer::receiveFragmentHeader ( detail::RawFragmentHeader &  header,
size_t  receiveTimeout 
)
overridevirtual

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

Implements artdaq::TransferInterface.

Definition at line 383 of file Multicast_transfer.cc.

artdaq::TransferInterface::CopyStatus artdaq::MulticastTransfer::transfer_fragment_min_blocking_mode ( artdaq::Fragment const &  fragment,
size_t  send_timeout_usec 
)
overridevirtual

Copy a Fragment to the destination. Multicast is always unreliable.

Parameters
fragmentFragment to copy
send_timeout_usecHow long to try to send before discarding data
Returns
CopyStatus detailing result of copy

Implements artdaq::TransferInterface.

Definition at line 413 of file Multicast_transfer.cc.

artdaq::TransferInterface::CopyStatus artdaq::MulticastTransfer::transfer_fragment_reliable_mode ( artdaq::Fragment &&  fragment)
overridevirtual

Move a Fragment to the destination. Multicast is always unreliable.

Parameters
fragmentFragment to move
Returns
CopyStatus detailing result of copy

Implements artdaq::TransferInterface.

Definition at line 407 of file Multicast_transfer.cc.


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