ReadWriteBuffer Class Template
Combined read-write buffer with immediate visibility. More...
Declaration
Base class
| class | Buffer |
|
Abstract base class for type-erased buffer implementations. More... | |
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... Args> | |
| ReadWriteBuffer & | push (Args &&... args) |
|
Constructs and appends a message to the buffer. More... | |
template <typename T> | |
| ReadWriteBuffer & | reserve (size_t size) |
|
Pre-allocates memory for the specified number of messages. More... | |
template <typename T> | |
| void | clear () override |
|
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
Combined read-write buffer with immediate visibility.
Unlike the double-buffered ReadBuffer/WriteBuffer pair, ReadWriteBuffer provides immediate access to pushed messages within the same frame. Messages are visible to readers as soon as they are pushed.
Use this when message producers and consumers operate in the same phase and immediate visibility is required. For cross-phase communication, prefer ReadWriteDoubleBuffer.
- Template Parameters
-
T The message type stored in the buffer.
Definition at line 30 of file ReadWriteBuffer.ixx.
Public Member Functions
clear()
| inline virtual |
Removes all messages from the buffer.
Definition at line 87 of file ReadWriteBuffer.ixx.
push()
| inline |
Constructs and appends a message to the buffer.
- Template Parameters
-
Args Constructor argument types for T.
- Parameters
-
args Arguments forwarded to T's constructor.
- Returns
Reference to this buffer for method chaining.
Definition at line 67 of file ReadWriteBuffer.ixx.
read()
| inline noexcept |
Returns a read-only view of all buffered messages.
- Returns
A span over all messages in the buffer.
Definition at line 53 of file ReadWriteBuffer.ixx.
Referenced by helios::core::container::buffer::TypeIndexedReadWriteBuffer< Indexer >::read.
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 79 of file ReadWriteBuffer.ixx.
Reference helios::core::container::buffer::ReadWriteBuffer< T >::reserve.
Referenced by helios::core::container::buffer::ReadWriteBuffer< T >::reserve.
Private Member Functions
bufferData()
| inline nodiscard |
Returns a mutable reference to the internal buffer.
- Returns
Reference to the internal vector.
Definition at line 42 of file ReadWriteBuffer.ixx.
Private Member Attributes
bufferData_
|
Internal storage for buffered messages.
Definition at line 35 of file ReadWriteBuffer.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.