|
ESPHome 2026.4.0-dev
|
Fixed-capacity circular buffer - allocates once at runtime, never reallocates. More...
#include <helpers.h>
Data Structures | |
| class | ConstIterator |
| class | Iterator |
Public Member Functions | |
| FixedRingBuffer ()=default | |
| ~FixedRingBuffer () | |
| FixedRingBuffer (const FixedRingBuffer &)=delete | |
| FixedRingBuffer & | operator= (const FixedRingBuffer &)=delete |
| void | init (index_type capacity) |
| Allocate capacity - can only be called once. | |
| bool | push (const T &value) |
| Push a value. Returns false if full. | |
| void | push_overwrite (const T &value) |
| Push a value, overwriting the oldest if full. | |
| void | pop () |
| Remove the oldest element. | |
| T & | front () |
| const T & | front () const |
| index_type | size () const |
| bool | empty () const |
| index_type | capacity () const |
| bool | full () const |
| void | clear () |
| Clear all elements (reset to empty, keep capacity) | |
| Iterator | begin () |
| Iterator | end () |
| ConstIterator | begin () const |
| ConstIterator | end () const |
Protected Attributes | |
| T * | data_ {nullptr} |
| index_type | head_ {0} |
| index_type | tail_ {0} |
| index_type | count_ {0} |
| index_type | capacity_ {0} |
Fixed-capacity circular buffer - allocates once at runtime, never reallocates.
Runtime-sized equivalent of StaticRingBuffer - use when capacity is only known at initialization. Supports FIFO push/pop and iteration over queued elements. Not thread-safe.
|
default |
|
inline |
|
delete |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
delete |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |