CiCueTea v0.0.1
Loading...
Searching...
No Matches
jsa::cicuetea::DoubleBuffer< T > Class Template Reference

A double-buffer implementation for storing and switching between two values. More...

#include <DoubleBuffer.h>

Public Member Functions

void fill (const T &value)
 Fills both buffers with the given value.
void push (const T &value)
 Pushes a value into the buffer and advances the state.
void advance ()
 Advances the buffer state to the next buffer.
T & next ()
 Advances the buffer state and retrieves the next buffer value.
const T & current () const
 Retrieves the current buffer value.
const T & last () const
 Retrieves the last buffer value.
T & last ()
 Retrieves the last buffer value.
T & current ()
 Retrieves the current buffer value.

Detailed Description

template<typename T>
class jsa::cicuetea::DoubleBuffer< T >

A double-buffer implementation for storing and switching between two values.

Template Parameters
TThe type of the values stored in the buffer.

Member Function Documentation

◆ current() [1/2]

template<typename T>
T & jsa::cicuetea::DoubleBuffer< T >::current ( )
inline

Retrieves the current buffer value.

Returns
A reference to the current buffer value.

◆ current() [2/2]

template<typename T>
const T & jsa::cicuetea::DoubleBuffer< T >::current ( ) const
inline

Retrieves the current buffer value.

Returns
A const reference to the current buffer value.

◆ fill()

template<typename T>
void jsa::cicuetea::DoubleBuffer< T >::fill ( const T & value)
inline

Fills both buffers with the given value.

Parameters
valueThe value to fill the buffers with.

◆ last() [1/2]

template<typename T>
T & jsa::cicuetea::DoubleBuffer< T >::last ( )
inline

Retrieves the last buffer value.

Returns
A reference to the last buffer value.

◆ last() [2/2]

template<typename T>
const T & jsa::cicuetea::DoubleBuffer< T >::last ( ) const
inline

Retrieves the last buffer value.

Returns
A const reference to the last buffer value.

◆ next()

template<typename T>
T & jsa::cicuetea::DoubleBuffer< T >::next ( )
inline

Advances the buffer state and retrieves the next buffer value.

Returns
A reference to the next buffer value.

◆ push()

template<typename T>
void jsa::cicuetea::DoubleBuffer< T >::push ( const T & value)
inline

Pushes a value into the buffer and advances the state.

Parameters
valueThe value to push into the buffer.

The documentation for this class was generated from the following file: