Sane C++ Libraries
C++ Platform Abstraction Libraries
SC::AsyncBuffersPool Struct Reference

Holds a Span of AsyncBufferView (allocated by user) holding available memory for the streams. More...

#include <AsyncStreams.h>

Public Member Functions

void refBuffer (AsyncBufferView::ID bufferID)
 Increments a buffer reference count. More...
 
void unrefBuffer (AsyncBufferView::ID bufferID)
 Decrements a buffer reference count. More...
 
Result getData (AsyncBufferView::ID bufferID, Span< const char > &data)
 Access data span owned by the buffer. More...
 
Result getData (AsyncBufferView::ID bufferID, Span< char > &data)
 Access data span owned by the buffer. More...
 
AsyncBufferViewgetBuffer (AsyncBufferView::ID bufferID)
 Access the raw AsyncBufferView (if any) at a given bufferID (or nullptr if invalid) More...
 
Result requestNewBuffer (size_t minimumSizeInBytes, AsyncBufferView::ID &bufferID, Span< char > &data)
 Requests a new available buffer that is at least minimumSizeInBytes, incrementing its refcount. More...
 
void setNewBufferSize (AsyncBufferView::ID bufferID, size_t newSizeInBytes)
 Sets the new size in bytes for the buffer. More...
 

Public Attributes

Span< AsyncBufferViewbuffers
 Span of buffers to be filled in by the user. More...
 

Detailed Description

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

Member Function Documentation

◆ getBuffer()

AsyncBufferView * SC::AsyncBuffersPool::getBuffer ( AsyncBufferView::ID  bufferID)

Access the raw AsyncBufferView (if any) at a given bufferID (or nullptr if invalid)

◆ getData() [1/2]

Result SC::AsyncBuffersPool::getData ( AsyncBufferView::ID  bufferID,
Span< char > &  data 
)

Access data span owned by the buffer.

◆ getData() [2/2]

Result SC::AsyncBuffersPool::getData ( AsyncBufferView::ID  bufferID,
Span< const char > &  data 
)

Access data span owned by the buffer.

◆ refBuffer()

void SC::AsyncBuffersPool::refBuffer ( AsyncBufferView::ID  bufferID)

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.

◆ setNewBufferSize()

void SC::AsyncBuffersPool::setNewBufferSize ( AsyncBufferView::ID  bufferID,
size_t  newSizeInBytes 
)

Sets the new size in bytes for the buffer.

◆ unrefBuffer()

void SC::AsyncBuffersPool::unrefBuffer ( AsyncBufferView::ID  bufferID)

Decrements a buffer reference count.

When reference count becomes zero the buffer will be re-used

Member Data Documentation

◆ buffers

Span<AsyncBufferView> SC::AsyncBuffersPool::buffers

Span of buffers to be filled in by the user.


The documentation for this struct was generated from the following file: