1 #include "artdaq/TransferPlugins/TransferInterface.hh"
3 #include "artdaq/RTIDDS/RTIDDS.hh"
7 #include "artdaq-core/Utilities/ExceptionHandler.hh"
36 , rtidds_reader_(std::make_unique<artdaq::
RTIDDS>(
"RTIDDSTransfer_reader", artdaq::
RTIDDS::IOType::reader))
37 , rtidds_writer_(std::make_unique<artdaq::
RTIDDS>(
"RTIDDSTransfer_writer", artdaq::
RTIDDS::IOType::writer)) {}
46 size_t receiveTimeout)
override;
55 size_t send_timeout_usec = std::numeric_limits<size_t>::max())
override;
73 return rtidds_writer_ !=
nullptr;
75 return rtidds_reader_ !=
nullptr;
86 std::unique_ptr<artdaq::RTIDDS> rtidds_reader_;
87 std::unique_ptr<artdaq::RTIDDS> rtidds_writer_;
92 size_t receiveTimeout)
94 bool receivedFragment =
false;
102 receivedFragment = rtidds_reader_->octets_listener_.receiveFragmentFromDDS(fragment, receiveTimeout);
106 ExceptionHandler(ExceptionHandlerRethrow::yes,
107 "Error in RTIDDS transfer plugin: caught exception in call to OctetsListener::receiveFragmentFromDDS, rethrowing");
131 rtidds_writer_->transfer_fragment_reliable_mode_via_DDS_(std::move(fragment));
132 return CopyStatus::kSuccess;
137 size_t send_timeout_usec)
139 (void)&send_timeout_usec;
141 rtidds_writer_->transfer_fragment_min_blocking_mode_via_DDS_(fragment);
142 return CopyStatus::kSuccess;
CopyStatus transfer_fragment_reliable_mode(artdaq::Fragment &&fragment) override
Transfer a Fragment to the destination. This should be reliable, if the underlying transport mechanis...
DDS Transport Implementation.
virtual int source_rank() const
Get the source rank for this TransferInterface instance.
Role role() const
Get the TransferInterface::Role of this TransferInterface.
CopyStatus transfer_fragment_min_blocking_mode(artdaq::Fragment const &fragment, size_t send_timeout_usec=std::numeric_limits< size_t >::max()) override
Transfer a Fragment to the destination. May not necessarily be reliable, but will not block longer th...
This TransferInterface is a Receiver.
bool isRunning() override
Determine whether the TransferInterface plugin is able to send/receive data.
void flush_buffers() override
Flush any in-flight data. This should be used by the receiver after the receive loop has ended...
This TransferInterface is a Sender.
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.
Value to be returned upon receive timeout.
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.