WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
wpi::static_circular_buffer< T, N > Class Template Reference

This is a simple circular buffer so we don't need to "bucket brigade" copy old values. More...

#include <wpi/static_circular_buffer.h>

Classes

class  const_iterator
 
class  iterator
 

Public Member Functions

constexpr iterator begin ()
 Returns begin iterator.
 
constexpr iterator end ()
 Returns end iterator.
 
constexpr const_iterator begin () const
 Returns begin iterator.
 
constexpr const_iterator end () const
 Returns end iterator.
 
constexpr const_iterator cbegin () const
 Returns begin iterator.
 
constexpr const_iterator cend () const
 Returns end iterator.
 
constexpr size_t size () const
 Returns number of elements in buffer.
 
constexpr T & front ()
 Returns value at front of buffer.
 
constexpr const T & front () const
 Returns value at front of buffer.
 
constexpr T & back ()
 Returns value at back of buffer.
 
constexpr const T & back () const
 Returns value at back of buffer.
 
constexpr void push_front (T value)
 Push a new value onto the front of the buffer.
 
constexpr void push_back (T value)
 Push a new value onto the back of the buffer.
 
template<class... Args>
constexpr void emplace_front (Args &&... args)
 Push a new value onto the front of the buffer that is constructed with the provided constructor arguments.
 
template<class... Args>
constexpr void emplace_back (Args &&... args)
 Push a new value onto the back of the buffer that is constructed with the provided constructor arguments.
 
constexpr T pop_front ()
 Pop value at front of buffer.
 
constexpr T pop_back ()
 Pop value at back of buffer.
 
constexpr void reset ()
 Empties internal buffer.
 
constexpr T & operator[] (size_t index)
 
constexpr const T & operator[] (size_t index) const
 

Detailed Description

template<class T, size_t N>
class wpi::static_circular_buffer< T, N >

This is a simple circular buffer so we don't need to "bucket brigade" copy old values.

Template Parameters
TBuffer element type.
NMaximum number of buffer elements.

Member Function Documentation

◆ back() [1/2]

template<class T , size_t N>
T & wpi::static_circular_buffer< T, N >::back ( )
inlineconstexpr

Returns value at back of buffer.

If there are no elements in the buffer, calling this function results in undefined behavior.

◆ back() [2/2]

template<class T , size_t N>
const T & wpi::static_circular_buffer< T, N >::back ( ) const
inlineconstexpr

Returns value at back of buffer.

If there are no elements in the buffer, calling this function results in undefined behavior.

◆ begin() [1/2]

template<class T , size_t N>
iterator wpi::static_circular_buffer< T, N >::begin ( )
inlineconstexpr

Returns begin iterator.

◆ begin() [2/2]

template<class T , size_t N>
const_iterator wpi::static_circular_buffer< T, N >::begin ( ) const
inlineconstexpr

Returns begin iterator.

◆ cbegin()

template<class T , size_t N>
const_iterator wpi::static_circular_buffer< T, N >::cbegin ( ) const
inlineconstexpr

Returns begin iterator.

◆ cend()

template<class T , size_t N>
const_iterator wpi::static_circular_buffer< T, N >::cend ( ) const
inlineconstexpr

Returns end iterator.

◆ emplace_back()

template<class T , size_t N>
template<class... Args>
void wpi::static_circular_buffer< T, N >::emplace_back ( Args &&... args)
inlineconstexpr

Push a new value onto the back of the buffer that is constructed with the provided constructor arguments.

The value at the front is overwritten if the buffer is full.

◆ emplace_front()

template<class T , size_t N>
template<class... Args>
void wpi::static_circular_buffer< T, N >::emplace_front ( Args &&... args)
inlineconstexpr

Push a new value onto the front of the buffer that is constructed with the provided constructor arguments.

The value at the back is overwritten if the buffer is full.

◆ end() [1/2]

template<class T , size_t N>
iterator wpi::static_circular_buffer< T, N >::end ( )
inlineconstexpr

Returns end iterator.

◆ end() [2/2]

template<class T , size_t N>
const_iterator wpi::static_circular_buffer< T, N >::end ( ) const
inlineconstexpr

Returns end iterator.

◆ front() [1/2]

template<class T , size_t N>
T & wpi::static_circular_buffer< T, N >::front ( )
inlineconstexpr

Returns value at front of buffer.

◆ front() [2/2]

template<class T , size_t N>
const T & wpi::static_circular_buffer< T, N >::front ( ) const
inlineconstexpr

Returns value at front of buffer.

◆ operator[]() [1/2]

template<class T , size_t N>
T & wpi::static_circular_buffer< T, N >::operator[] ( size_t index)
inlineconstexpr
Returns
Element at index starting from front of buffer.

◆ operator[]() [2/2]

template<class T , size_t N>
const T & wpi::static_circular_buffer< T, N >::operator[] ( size_t index) const
inlineconstexpr
Returns
Element at index starting from front of buffer.

◆ pop_back()

template<class T , size_t N>
T wpi::static_circular_buffer< T, N >::pop_back ( )
inlineconstexpr

Pop value at back of buffer.

If there are no elements in the buffer, calling this function results in undefined behavior.

◆ pop_front()

template<class T , size_t N>
T wpi::static_circular_buffer< T, N >::pop_front ( )
inlineconstexpr

Pop value at front of buffer.

If there are no elements in the buffer, calling this function results in undefined behavior.

◆ push_back()

template<class T , size_t N>
void wpi::static_circular_buffer< T, N >::push_back ( T value)
inlineconstexpr

Push a new value onto the back of the buffer.

The value at the front is overwritten if the buffer is full.

◆ push_front()

template<class T , size_t N>
void wpi::static_circular_buffer< T, N >::push_front ( T value)
inlineconstexpr

Push a new value onto the front of the buffer.

The value at the back is overwritten if the buffer is full.

◆ reset()

template<class T , size_t N>
void wpi::static_circular_buffer< T, N >::reset ( )
inlineconstexpr

Empties internal buffer.

◆ size()

template<class T , size_t N>
size_t wpi::static_circular_buffer< T, N >::size ( ) const
inlineconstexpr

Returns number of elements in buffer.


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