WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
frc::circular_buffer< T > Class Template Reference

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

#include <circular_buffer.h>

Public Types

using value_type = T
 
using reference = value_type &
 
using const_reference = const value_type &
 
using pointer = value_type *
 
using size_type = size_t
 
using iterator_category = std::forward_iterator_tag
 
using difference_type = std::ptrdiff_t
 

Public Member Functions

 circular_buffer (size_t size)
 
size_type size () const
 Returns number of elements in buffer.
 
T & front ()
 Returns value at front of buffer.
 
const T & front () const
 Returns value at front of buffer.
 
T & back ()
 Returns value at back of buffer.
 
const T & back () const
 Returns value at back of buffer.
 
void push_front (T value)
 Push new value onto front of the buffer. More...
 
void push_back (T value)
 Push new value onto back of the buffer. More...
 
pop_front ()
 Pop value at front of buffer.
 
pop_back ()
 Pop value at back of buffer.
 
void resize (size_t size)
 Resizes internal buffer to given size.
 
void reset ()
 Sets internal buffer contents to zero.
 
T & operator[] (size_t index)
 
const T & operator[] (size_t index) const
 

Detailed Description

template<class T>
class frc::circular_buffer< T >

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

Member Function Documentation

template<class T >
T & frc::circular_buffer< T >::operator[] ( size_t  index)
Returns
Element at index starting from front of buffer.
template<class T >
const T & frc::circular_buffer< T >::operator[] ( size_t  index) const
Returns
Element at index starting from front of buffer.
template<class T>
void frc::circular_buffer< T >::push_back ( value)

Push new value onto back of the buffer.

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

template<class T>
void frc::circular_buffer< T >::push_front ( value)

Push new value onto front of the buffer.

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


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