21namespace jsa::cicuetea {
49 buffer[state] = value;
74 const T&
current()
const {
return buffer[state]; }
80 const T&
last()
const {
return buffer[!state]; }
86 T&
last() {
return buffer[!state]; }
95 std::array<T, 2> buffer;
A double-buffer implementation for storing and switching between two values.
Definition DoubleBuffer.h:30
const T & last() const
Retrieves the last buffer value.
Definition DoubleBuffer.h:80
T & last()
Retrieves the last buffer value.
Definition DoubleBuffer.h:86
T & next()
Advances the buffer state and retrieves the next buffer value.
Definition DoubleBuffer.h:64
void advance()
Advances the buffer state to the next buffer.
Definition DoubleBuffer.h:55
const T & current() const
Retrieves the current buffer value.
Definition DoubleBuffer.h:74
void push(const T &value)
Pushes a value into the buffer and advances the state.
Definition DoubleBuffer.h:46
T & current()
Retrieves the current buffer value.
Definition DoubleBuffer.h:92
void fill(const T &value)
Fills both buffers with the given value.
Definition DoubleBuffer.h:36