boost::capy::circular_dynamic_buffer
A fixed‐capacity circular buffer satisfying DynamicBuffer.
Description
This class implements a circular ( ring ) buffer with fixed capacity determined at construction. Unlike linear buffers, data can wrap around from the end to the beginning, enabling efficient FIFO operations without memory copies.
Example
char storage[1024];
circular_dynamic_buffer cb( storage, sizeof( storage ) );
// Write data
auto mb = cb.prepare( 100 );
std::memcpy( mb.data(), "hello", 5 );
cb.commit( 5 );
// Read data
auto cb_data = cb.data();
// process cb_data...
cb.consume( 5 );
Types
Name |
Description |
The ConstBufferSequence type for readable bytes. |
|
Indicates this is a DynamicBuffer adapter over external storage. |
|
The MutableBufferSequence type for writable bytes. |
Member Functions
Name |
Description |
|
Constructors |
Copy assignment. |
|
Return the number of writable bytes without reallocation. |
|
Move bytes from the output to the input sequence. |
|
Remove bytes from the beginning of the input sequence. |
|
Return a buffer sequence representing the readable bytes. |
|
Return the maximum number of bytes the buffer can hold. |
|
Return a buffer sequence for writing. |
|
Return the number of readable bytes. |
See Also
flat_dynamic_buffer, string_dynamic_buffer
Created with MrDocs