|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Bounded circular buffer (Aleph::RingBuffer) for FIFO streaming.
More...
#include <cstddef>#include <iterator>#include <memory>#include <type_traits>#include <utility>#include <ah-errors.H>Go to the source code of this file.
Classes | |
| class | Aleph::RingBuffer< T > |
| Fixed-capacity circular FIFO buffer over contiguous storage. More... | |
| class | Aleph::RingBuffer< T >::basic_iterator< IsConst > |
| Random-access iterator over the logical window. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
Bounded circular buffer (Aleph::RingBuffer) for FIFO streaming.
RingBuffer<T> is a fixed-capacity FIFO over one contiguous allocation: put appends at the tail, get extracts from the head, both O(1), and the storage never reallocates after construction. The optional put_overwrite policy silently evicts the oldest element when full, which turns the buffer into a sliding window over a stream — the classic use in producer/consumer stages, telemetry, audio and logging.
How it differs from the existing circular queues:
ArrayQueue grows dynamically (capacity is a power of two) — it is a general-purpose queue, not a bounded window.FixedQueue is fixed-size but performs no checking at all and requires default-constructible elements.RingBuffer has an exact user-chosen capacity, checked operations (Aleph error macros), an explicit overwrite policy, indexed access to the window, and constructs elements in place — T needs no default constructor and move-only types are supported.ArrayQueue) and unchecked fixed (FixedQueue) circular queues.Definition in file tpl_ring_buffer.H.