Template Class PcBufferReader#
Defined in File PcBufferReader.h
Inheritance Relationships#
Derived Types#
public Coral::PcBuffer< tx_depth, element_t, sizeof(element_t) >(Template Class PcBuffer)public Coral::PcBuffer< rx_depth, element_t, sizeof(element_t) >(Template Class PcBuffer)public Coral::PcBuffer< tx_depth, std::byte, sizeof(std::byte) >(Template Class PcBuffer)public Coral::PcBuffer< rx_depth, std::byte, sizeof(std::byte) >(Template Class PcBuffer)public Coral::PcBuffer< depth, element_t, alignment, Lock >(Template Class PcBuffer)
Class Documentation#
-
template<class T, typename element_t = std::byte>
class PcBufferReader# A producer-consumer buffer-reader interface class.
- Template Parameters:
T – Same as PcBufferWriter.
element_t – Same as PcBufferWriter.
Subclassed by Coral::PcBuffer< tx_depth, element_t, sizeof(element_t) >, Coral::PcBuffer< rx_depth, element_t, sizeof(element_t) >, Coral::PcBuffer< tx_depth, std::byte, sizeof(std::byte) >, Coral::PcBuffer< rx_depth, std::byte, sizeof(std::byte) >, Coral::PcBuffer< depth, element_t, alignment, Lock >
Public Functions
-
inline Result pop(element_t &elem)#
Attempt to read an element from the buffer.
- Parameters:
elem – [out] The element to be written.
- Returns:
Whether or not
elemwas written.
-
template<std::size_t N>
inline Result pop(std::array<element_t, N> &elem_array)# Attempt to read buffer elements into an array.
- Template Parameters:
N – The size of
elem_array.- Parameters:
elem_array – [out] The array to write elements to.
- Returns:
Whether or not
elem_arraywas written. Otherwise no elements are read.
-
inline Result pop(std::span<element_t> &elem_span)#
Attempt to read buffer elements into a span.
- Parameters:
elem_span – [out] The span to write elements to.
- Returns:
Whether or not
elem_arraywas written. Otherwise no elements are read.
-
inline Result pop_n(element_t *elem_array, std::size_t count)#
Attempt to read an array from the buffer.
- Parameters:
elem_array – [out] The array to write data to.
count – [in] The number of elements to read.
- Returns:
Whether or not all
countelements were read. When false, no elements were read.
-
template<std::size_t N>
inline std::size_t try_pop_n(std::array<element_t, N> &elem_array)# Attempt to read an array’s worth of elements from the buffer. Partial progress is made if possible.
- Template Parameters:
N – The size of
elem_array.- Parameters:
elem_array – [out] The array to write elements to.
- Returns:
The number of elements actually read. Always between zero and the size of
elem_array.
-
inline std::size_t try_pop_n(std::span<element_t> &elem_span)#
Attempt to read a span’s worth of elements from the buffer. Partial progress is made if possible.
- Parameters:
elem_span – [out] The span to write elements to.
- Returns:
The number of elements actually read. Always between zero and the size of
elem_array.