1 #include "artdaq/TransferPlugins/TransferInterface.hh"
3 #include "artdaq/RTIDDS/RTIDDS.hh"
5 #include "artdaq-core/Utilities/ExceptionHandler.hh"
39 , rtidds_reader_(std::make_unique<artdaq::
RTIDDS>(
"RTIDDSTransfer_reader", artdaq::
RTIDDS::IOType::reader))
40 , rtidds_writer_(std::make_unique<artdaq::
RTIDDS>(
"RTIDDSTransfer_writer", artdaq::
RTIDDS::IOType::writer)) { }
49 size_t receiveTimeout)
override;
58 size_t send_timeout_usec = std::numeric_limits<size_t>::max())
override;
67 size_t send_timeout_usec = std::numeric_limits<size_t>::max())
override;
70 std::unique_ptr<artdaq::RTIDDS> rtidds_reader_;
71 std::unique_ptr<artdaq::RTIDDS> rtidds_writer_;
76 size_t receiveTimeout)
78 bool receivedFragment =
false;
86 receivedFragment = rtidds_reader_->octets_listener_.receiveFragmentFromDDS(fragment, receiveTimeout);
90 ExceptionHandler(ExceptionHandlerRethrow::yes,
91 "Error in RTIDDS transfer plugin: caught exception in call to OctetsListener::receiveFragmentFromDDS, rethrowing");
115 (void)&send_timeout_usec;
117 rtidds_writer_->moveFragmentToDDS_(std::move(fragment));
118 return CopyStatus::kSuccess;
123 size_t send_timeout_usec)
125 (void) &send_timeout_usec;
127 rtidds_writer_->copyFragmentToDDS_(fragment);
128 return CopyStatus::kSuccess;
DDS Transport Implementation.
virtual int source_rank() const
Get the source rank for this TransferInterface instance.
CopyStatus moveFragment(artdaq::Fragment &&fragment, size_t send_timeout_usec=std::numeric_limits< size_t >::max()) override
Move a Fragment to the destination.
Role role() const
Get the TransferInterface::Role of this TransferInterface.
static const int RECV_TIMEOUT
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.
Role
Used to determine if a TransferInterface is a Sender or Receiver.
int receiveFragment(artdaq::Fragment &fragment, size_t receiveTimeout) override
Receive a Fragment using DDS.
RTIDDSTransfer is a TransferInterface implementation plugin that transfers data using RTI DDS...
This interface defines the functions used to transfer data between artdaq applications.
RTIDDSTransfer(fhicl::ParameterSet const &ps, Role role)
RTIDDSTransfer Constructor.
virtual ~RTIDDSTransfer()=default
RTIDDSTransfer default Destructor.
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.
CopyStatus copyFragment(artdaq::Fragment &fragment, size_t send_timeout_usec=std::numeric_limits< size_t >::max()) override
Copy a Fragment to the destination.