ReadBuffer Class Template
Read-only buffer for consuming messages in a double-buffered system. More...
Declaration
Friends Index
template <typename T> | |
| class | ReadWriteDoubleBuffer< T > |
Public Member Functions Index
template <typename T> | |
| auto | read () const noexcept -> std::span< const T > |
|
Returns a read-only view of all buffered messages. More... | |
template <typename T> | |
| ReadBuffer & | reserve (size_t size) |
|
Pre-allocates memory for the specified number of messages. More... | |
template <typename T> | |
| ReadBuffer & | clear () |
|
Removes all messages from the buffer. More... | |
Private Member Functions Index
template <typename T> | |
| auto | bufferData () -> std::vector< T > & |
|
Returns a mutable reference to the internal buffer. More... | |
Private Member Attributes Index
template <typename T> | |
| std::vector< T > | bufferData_ |
|
Internal storage for buffered messages. More... | |
Description
Read-only buffer for consuming messages in a double-buffered system.
ReadBuffer is the consumer-side of a double-buffered message system. After a swap operation, this buffer contains messages that were pushed to the corresponding WriteBuffer during the previous frame. Consumers iterate over these messages via the read() method.
The internal storage is only accessible to ReadWriteDoubleBuffer for swap operations.
- Template Parameters
-
T The message type stored in the buffer.
Definition at line 31 of file ReadBuffer.ixx.
Friends
ReadWriteDoubleBuffer< T >
|
Definition at line 1 of file ReadBuffer.ixx.
Public Member Functions
clear()
| inline |
Removes all messages from the buffer.
- Returns
Reference to this buffer for method chaining.
Definition at line 79 of file ReadBuffer.ixx.
Reference helios::core::container::buffer::ReadBuffer< T >::clear.
Referenced by helios::core::container::buffer::ReadBuffer< T >::clear.
read()
| inline noexcept |
Returns a read-only view of all buffered messages.
- Returns
A span over all messages in the buffer.
Definition at line 58 of file ReadBuffer.ixx.
reserve()
| inline |
Pre-allocates memory for the specified number of messages.
- Parameters
-
size The number of messages to reserve capacity for.
- Returns
Reference to this buffer for method chaining.
Definition at line 69 of file ReadBuffer.ixx.
Reference helios::core::container::buffer::ReadBuffer< T >::reserve.
Referenced by helios::core::container::buffer::ReadBuffer< T >::reserve.
Private Member Functions
bufferData()
| inline nodiscard |
Returns a mutable reference to the internal buffer.
Only accessible to ReadWriteDoubleBuffer for swap operations.
- Returns
Reference to the internal vector.
Definition at line 47 of file ReadBuffer.ixx.
Private Member Attributes
bufferData_
|
Internal storage for buffered messages.
Definition at line 38 of file ReadBuffer.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.