|
| ringbuffer (size_t const max_size) |
| Constructs a ringbuffer with the specified maximum size.
|
bool | enqueue (T const &t) noexcept |
| Enqueue a single element into the buffer.
|
bool | dequeue (T *ret) noexcept |
| Dequeue a single element from the buffer.
|
template<bool _All = true> |
size_t | enqueue (T const *t, size_t size) noexcept |
| Enqueue multiple elements into the buffer.
|
size_t | dequeue (T *ret, size_t size) noexcept |
| Dequeue multiple elements from the buffer.
|
template<typename Func> |
size_t | dequeue (Func const &func, T *ret, size_t size) noexcept |
| Dequeue multiple elements and process them with a functor.
|
template<typename Func> |
size_t | consume_all (Func const &func) noexcept |
| Process all available elements in the buffer using a functor.
|
bool | empty () |
| Check if the buffer is empty.
|
| nocopy ()=default |
| Default constructor.
|
| nocopy (nocopy const &)=delete |
| Deleted copy constructor.
|
| nocopy (nocopy const &&)=delete |
| Deleted move constructor.
|
nocopy & | operator= (nocopy const &)=delete |
| Deleted copy assignment operator.
|
nocopy & | operator= (nocopy &&)=delete |
| Deleted move assignment operator.
|
|
| ringbuffer () |
| Default constructor initializing indices.
|
size_t | read_available (size_t const max_size) const |
| Get the number of elements available for reading.
|
size_t | write_available (size_t const max_size) const |
| Get the number of slots available for writing.
|
bool | enqueue (T const &t, T *buffer, size_t const max_size) |
| Enqueue a single element into the buffer.
|
template<bool _All> |
size_t | enqueue (const T *input_buffer, size_t input_count, T *internal_buffer, size_t const max_size) |
| Enqueue multiple elements into the buffer.
|
size_t | dequeue (T *output_buffer, size_t output_count, T *internal_buffer, size_t const max_size) |
| Dequeue multiple elements from the buffer.
|
template<typename _Func> |
size_t | consume_all (_Func const &functor, T *internal_buffer, size_t max_size) |
| Process all available elements in the buffer using a functor.
|
const T & | front (const T *internal_buffer) const |
| Get a reference to the element at the read index (const version)
|
T & | front (T *internal_buffer) |
| Get a reference to the element at the read index.
|
static size_t | next_index (size_t arg, size_t const max_size) |
| Calculate the next index in the buffer with wrap-around handling.
|
static size_t | read_available (size_t write_index, size_t read_index, size_t const max_size) |
| Calculate how many elements are available for reading.
|
static size_t | write_available (size_t write_index, size_t read_index, size_t const max_size) |
| Calculate how many elements can be written.
|
template<typename T>
class qb::lockfree::spsc::ringbuffer< T, 0 >
Dynamic-size implementation of the SPSC ringbuffer.
This class provides a dynamic-size SPSC ringbuffer implementation with a buffer size specified at runtime.
- Template Parameters
-
T | Type of elements stored in the ringbuffer |