WPILibC++ 2024.1.1-beta-4
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

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

Member Function Documentation

◆ back() [1/2]

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

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
inline

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 ( )
inline

Returns begin iterator.

◆ begin() [2/2]

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

Returns begin iterator.

◆ cbegin()

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

Returns begin iterator.

◆ cend()

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

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)
inline

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)
inline

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 ( )
inline

Returns end iterator.

◆ end() [2/2]

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

Returns end iterator.

◆ front() [1/2]

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

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
inline

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)
inline
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
inline
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 ( )
inline

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 ( )
inline

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 ( value)
inline

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 ( value)
inline

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 ( )
inline

Empties internal buffer.

◆ size()

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

Returns number of elements in buffer.


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