Template Class ToHostReader

Class Documentation

template<class BUF>
class ToHostReader

A ToHost DMA buffer can be read by multiple ToHostReaders. ToHostReader is configured to read data from a set of elinks, data from other elinks is ignored. ToHostReader includes a number of Decoders equal to the number of elinks and one publisher. The publisher runs an eventloop thread, therefore each ToHostReaders runs on a dedicate thread.

Public Functions

ToHostReader(std::shared_ptr<BUF> buffer, const std::vector<Elink> &elinks, std::unique_ptr<Publisher> publisher, int buffer_poll_period_us, bool zerocopy, int l0id_ck)

ToHostReader constructor.

Parameters:
  • buffer -- DMA buffer to be read.

  • elinks -- vector of elinks whose blocks are to be decoded by this reader.

  • publisher -- network publisher.

  • buffer_poll_period_us -- polling period in microseconds.

  • zerocopy -- if zero-copy readout (instead of buffered) is used.

  • l0id_ck -- flag to enable the L0ID sequentiality check.

ToHostReader constructor.

Parameters:
  • buffer -- DMA buffer to be read.

  • elinks_type -- type of elinks whose blocks are to be decoded by this reader.

  • publisher -- network publisher.

  • buffer_poll_period_us -- polling period in microseconds.

  • zerocopy -- if zero-copy readout (instead of buffered) is used.

  • l0id_ck -- flag to enable the L0ID sequentiality check.

ToHostReader(const ToHostReader&) = delete
ToHostReader &operator=(const ToHostReader&) = delete
ToHostReader(ToHostReader&&) noexcept = default
ToHostReader &operator=(ToHostReader&&) noexcept = default
bool read()

read the DMA buffer: decode blocks and publish chunks.

Returns:

true if not all blocks available at the beginning of the call were decoded.

inline size_t get_read_blocks() const
Returns:

the number of blocks read by this reader.

inline void fire_publisher_async_signal()

fire the signal to invoke the configured callback.

Returns:

per-elink monitoring information.

uint32_t get_network_resource_counter()
Returns:

publisher network resource counter (e.g. number of available buffers or completion objects).

uint32_t get_network_subscriptions()
Returns:

Number of subscriptions to the publisher.

Returns:

Number of subscriptions to the publisher.

uint64_t get_network_resource_available_calls()
Returns:

number of callbacks invoked when network resources (e.g. buffers) become available after having been exhausted.

inline uint32_t get_id() const
Returns:

id of the reader