Condy v1.1.0
C++ Asynchronous System Call Layer for Linux
Loading...
Searching...
No Matches
condy::ProvidedBufferQueue Class Reference

Provided buffer queue. More...

#include <provided_buffers.hpp>

Public Member Functions

 ProvidedBufferQueue (uint32_t capacity, unsigned int flags=0)
 Construct a new ProvidedBufferQueue object.
size_t size () const
 Get the current size of the buffer queue.
size_t capacity () const
 Get the capacity of the buffer queue.
template<typename Buffer>
uint16_t push (Buffer &&buffer)
 Push a buffer into the provided buffer queue.

Detailed Description

Provided buffer queue.

A provided buffer queue manages a queue of buffers that can be used in asynchronous operations. User is responsible for pushing buffers into the queue.

Returns
std::pair<int, BufferInfo> When pass to async operations, the return type will be a pair of the operation result and the BufferInfo.

Constructor & Destructor Documentation

◆ ProvidedBufferQueue()

condy::ProvidedBufferQueue::ProvidedBufferQueue ( uint32_t capacity,
unsigned int flags = 0 )
inline

Construct a new ProvidedBufferQueue object.

Parameters
capacityNumber of buffers the queue can hold.
flagsOptional flags for io_uring buffer ring registration (default: 0).

Member Function Documentation

◆ push()

template<typename Buffer>
uint16_t condy::BundledProvidedBufferQueue::push ( Buffer && buffer)
inlineinherited

Push a buffer into the provided buffer queue.

Template Parameters
BufferType of the buffer
Parameters
bufferThe buffer to be pushed
Returns
uint16_t The buffer ID assigned to the pushed buffer.
Exceptions
std::logic_errorif the capacity of the queue is exceeded
Note
The returned buffer ID is always sequentially ordered, starting from 0 and incrementing by 1 for each buffer pushed into the queue, wrapping around when reaching the queue's capacity.

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