artdaq  v2_02_03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Public Member Functions | List of all members
artdaq::TCPSocketTransfer Class Reference

TransferInterface implementation plugin that sends data using TCP sockets. More...

#include <artdaq/TransferPlugins/TCPSocketTransfer.hh>

+ Inheritance diagram for artdaq::TCPSocketTransfer:

Public Member Functions

 TCPSocketTransfer (fhicl::ParameterSet const &ps, Role role)
 TCPSocketTransfer Constructor. More...
 
int receiveFragment (Fragment &frag, size_t timeout_usec=0) override
 Receive a Fragment using TCP. More...
 
CopyStatus copyFragment (Fragment &frag, size_t timeout_usec) override
 Copy a Fragment to the destination. Same implementation as moveFragment, as TCP is always reliable. More...
 
CopyStatus moveFragment (Fragment &&frag, size_t timeout_usec) override
 Move a Fragment to the destination. More...
 
- 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.
 
virtual int receiveFragment (artdaq::Fragment &fragment, size_t receiveTimeout)=0
 Receive a Fragment from the transport mechanism. More...
 
virtual CopyStatus copyFragment (artdaq::Fragment &fragment, size_t send_timeout_usec=std::numeric_limits< size_t >::max())=0
 Copy a Fragment to the destination. May not necessarily be reliable. More...
 
virtual CopyStatus moveFragment (artdaq::Fragment &&fragment, size_t send_timeout_usec=std::numeric_limits< size_t >::max())=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...
 
int source_rank () const
 Get the source rank for this TransferInterface instance. More...
 
int destination_rank () const
 Get the destination rank for this TransferInterface instance. More...
 

Additional Inherited Members

- Public Types inherited from artdaq::TransferInterface
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...
 
- Static Public Attributes inherited from artdaq::TransferInterface
static const int RECV_TIMEOUT = 0xfedcba98
 Value to be returned upon receive timeout. Because receivers otherwise return rank, this is also the limit on the number of ranks that artdaq currently supports.
 
- Protected Member Functions inherited from artdaq::TransferInterface
Role role () const
 Get the TransferInterface::Role of this TransferInterface. More...
 
- Protected Attributes inherited from artdaq::TransferInterface
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

TransferInterface implementation plugin that sends data using TCP sockets.

Definition at line 41 of file TCPSocketTransfer.hh.

Constructor & Destructor Documentation

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

TCPSocketTransfer Constructor.

Parameters
psParameterSet used to configure TCPSocketTransfer
roleRole of this TCPSocketTransfer instance (kSend or kReceive)
* TCPSocketTransfer accepts the following Parameters:
* "tcp_receive_buffer_size" (Default: 0): The TCP buffer size on the receive socket
* "host_map" (REQUIRED): List of FHiCL tables containing information about other hosts in the system.
*   Each table should contain:
*   "rank" (Default: RECV_TIMEOUT): Rank of this host
*   "host" (Default: "localhost"): Hostname of this host
*   "portOffset" (Default: 5500): To avoid collisions, each destination should specify its own port offset.
*     All TCPSocketTransfers sending to that destination will add their own rank to make a unique port number.
* 

TCPSocketTransfer also requires all Parameters for configuring a TransferInterface

Definition at line 34 of file TCPSocket_transfer.cc.

Member Function Documentation

CopyStatus artdaq::TCPSocketTransfer::copyFragment ( Fragment &  frag,
size_t  timeout_usec 
)
inlineoverride

Copy a Fragment to the destination. Same implementation as moveFragment, as TCP is always reliable.

Parameters
fragFragment to copy
timeout_usecTimeout for send, in microseconds
Returns
CopyStatus detailing result of copy

Definition at line 79 of file TCPSocketTransfer.hh.

CopyStatus artdaq::TCPSocketTransfer::moveFragment ( Fragment &&  frag,
size_t  timeout_usec 
)
inlineoverride

Move a Fragment to the destination.

Parameters
fragFragment to move
timeout_usecTimeout for send, in microseconds
Returns
CopyStatus detailing result of copy

Definition at line 87 of file TCPSocketTransfer.hh.

int artdaq::TCPSocketTransfer::receiveFragment ( Fragment &  frag,
size_t  timeout_usec = 0 
)
override

Receive a Fragment using TCP.

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

Definition at line 431 of file TCPSocket_transfer.cc.


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