![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
Lock-free single-producer single-consumer (SPSC) bounded ring buffer. More...
#include <streaming_sink.hpp>
Public Member Functions | |
| SpscRingBuffer () | |
| Construct an empty ring buffer. | |
| SpscRingBuffer (const SpscRingBuffer &)=delete | |
| SpscRingBuffer & | operator= (const SpscRingBuffer &)=delete |
| bool | push (T item) |
| Push a single item. Returns false if the buffer is full. | |
| size_t | push (const T *items, size_t count) |
Bulk push up to count items. Returns the number actually pushed. | |
| bool | pop (T &out) |
Pop a single item into out. Returns false if the buffer is empty. | |
| size_t | pop (T *out, size_t max_count) |
Bulk pop up to max_count items into out. Returns number popped. | |
| size_t | size () const |
| Approximate number of items currently in the buffer. | |
| bool | empty () const |
| True if the buffer appears empty (approximate, no lock). | |
| bool | full () const |
| True if the buffer appears full (approximate, no lock). | |
Static Public Member Functions | |
| static constexpr size_t | capacity () |
| The compile-time capacity of this ring buffer. | |
Lock-free single-producer single-consumer (SPSC) bounded ring buffer.
Uses acquire/release atomic ordering on head and tail pointers for wait-free push/pop. Capacity must be a power of two (enforced by static_assert).
| T | Element type (must be move-constructible). |
| Capacity | Maximum number of elements (must be power of 2). Effective capacity is Capacity - 1. |
Definition at line 132 of file streaming_sink.hpp.
|
inline |
Construct an empty ring buffer.
Definition at line 138 of file streaming_sink.hpp.
|
delete |
|
inlinestaticconstexpr |
The compile-time capacity of this ring buffer.
Definition at line 220 of file streaming_sink.hpp.
|
inline |
True if the buffer appears empty (approximate, no lock).
Definition at line 215 of file streaming_sink.hpp.
|
inline |
True if the buffer appears full (approximate, no lock).
Definition at line 217 of file streaming_sink.hpp.
|
delete |
|
inline |
Pop a single item into out. Returns false if the buffer is empty.
Definition at line 177 of file streaming_sink.hpp.
|
inline |
Bulk pop up to max_count items into out. Returns number popped.
Definition at line 190 of file streaming_sink.hpp.
|
inline |
Bulk push up to count items. Returns the number actually pushed.
Definition at line 163 of file streaming_sink.hpp.
|
inline |
Push a single item. Returns false if the buffer is full.
Definition at line 149 of file streaming_sink.hpp.
|
inline |
Approximate number of items currently in the buffer.
Definition at line 208 of file streaming_sink.hpp.