Holds a Span of AsyncBufferView (allocated by user) holding available memory for the streams.
More...
#include <AsyncStreams.h>
|
| void | refBuffer (AsyncBufferView::ID bufferID) |
| | Increments a buffer reference count.
|
| |
| void | unrefBuffer (AsyncBufferView::ID bufferID) |
| | Decrements a buffer reference count.
|
| |
| Result | getReadableData (AsyncBufferView::ID bufferID, Span< const char > &data) |
| | Access data span owned by the buffer.
|
| |
| Result | getWritableData (AsyncBufferView::ID bufferID, Span< char > &data) |
| | Access data span owned by the buffer.
|
| |
| AsyncBufferView * | getBuffer (AsyncBufferView::ID bufferID) |
| | Access the raw AsyncBufferView (if any) at a given bufferID (or nullptr if invalid)
|
| |
| Result | requestNewBuffer (size_t minimumSizeInBytes, AsyncBufferView::ID &bufferID, Span< char > &data) |
| | Requests a new available buffer that is at least minimumSizeInBytes, incrementing its refcount.
|
| |
| void | setNewBufferSize (AsyncBufferView::ID bufferID, size_t newSizeInBytes) |
| | Sets the new size in bytes for the buffer.
|
| |
| Result | pushBuffer (AsyncBufferView &&buffer, AsyncBufferView::ID &bufferID) |
| | Adds a buffer to the pool in any empty slot (found by scanning from start to end)
|
| |
| void | setBuffers (Span< AsyncBufferView > newBuffers) |
| | Sets memory for the new buffers.
|
| |
| size_t | getNumBuffers () const |
| | Gets size of buffers held by the pool.
|
| |
| Result | createChildView (AsyncBufferView::ID parentBufferID, size_t offset, size_t length, AsyncBufferView::ID &outChildBufferID) |
| | Creates a child view that references a slice of the parent buffer.
|
| |
|
| static Result | sliceInEqualParts (Span< AsyncBufferView > buffers, Span< char > memory, size_t numSlices) |
| | Splits a span of memory in equally sized slices, assigning them to buffers and marking them as reusable.
|
| |
Holds a Span of AsyncBufferView (allocated by user) holding available memory for the streams.
- Note
- User must fill the AsyncBuffersPool::buffers with a
Span of AsyncBufferView
◆ createChildView()
Creates a child view that references a slice of the parent buffer.
◆ getBuffer()
Access the raw AsyncBufferView (if any) at a given bufferID (or nullptr if invalid)
◆ getNumBuffers()
| size_t SC::AsyncBuffersPool::getNumBuffers |
( |
| ) |
const |
|
inlinenodiscard |
Gets size of buffers held by the pool.
◆ getReadableData()
| Result SC::AsyncBuffersPool::getReadableData |
( |
AsyncBufferView::ID | bufferID, |
|
|
Span< const char > & | data ) |
Access data span owned by the buffer.
◆ getWritableData()
| Result SC::AsyncBuffersPool::getWritableData |
( |
AsyncBufferView::ID | bufferID, |
|
|
Span< char > & | data ) |
Access data span owned by the buffer.
◆ pushBuffer()
Adds a buffer to the pool in any empty slot (found by scanning from start to end)
◆ refBuffer()
Increments a buffer reference count.
◆ requestNewBuffer()
| Result SC::AsyncBuffersPool::requestNewBuffer |
( |
size_t | minimumSizeInBytes, |
|
|
AsyncBufferView::ID & | bufferID, |
|
|
Span< char > & | data ) |
Requests a new available buffer that is at least minimumSizeInBytes, incrementing its refcount.
◆ setBuffers()
| void SC::AsyncBuffersPool::setBuffers |
( |
Span< AsyncBufferView > | newBuffers | ) |
|
|
inline |
Sets memory for the new buffers.
◆ setNewBufferSize()
| void SC::AsyncBuffersPool::setNewBufferSize |
( |
AsyncBufferView::ID | bufferID, |
|
|
size_t | newSizeInBytes ) |
Sets the new size in bytes for the buffer.
◆ sliceInEqualParts()
| static Result SC::AsyncBuffersPool::sliceInEqualParts |
( |
Span< AsyncBufferView > | buffers, |
|
|
Span< char > | memory, |
|
|
size_t | numSlices ) |
|
static |
Splits a span of memory in equally sized slices, assigning them to buffers and marking them as reusable.
◆ unrefBuffer()
Decrements a buffer reference count.
When reference count becomes zero the buffer will be re-used
The documentation for this struct was generated from the following file: