CTRE Phoenix 6 C++ 25.0.0-beta-4
|
This is a simple circular buffer so we don't need to "bucket brigade" copy old values. More...
#include <ctre/phoenix6/swerve/utility/circular_buffer.hpp>
Classes | |
class | const_iterator |
class | iterator |
Public Member Functions | |
circular_buffer (size_t size) | |
Constructs a circular buffer. | |
circular_buffer (const circular_buffer &)=default | |
circular_buffer & | operator= (const circular_buffer &)=default |
circular_buffer (circular_buffer &&)=default | |
circular_buffer & | operator= (circular_buffer &&)=default |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
size_t | 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 a new value onto the front of the buffer. | |
void | push_back (T value) |
Push a new value onto the back of the buffer. | |
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. | |
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. | |
T | pop_front () |
Pop value at front of buffer. | |
T | pop_back () |
Pop value at back of buffer. | |
void | resize (size_t size) |
Resizes internal buffer to given size. | |
void | reset () |
Empties internal buffer. | |
T & | operator[] (size_t index) |
const T & | operator[] (size_t index) const |
This is a simple circular buffer so we don't need to "bucket brigade" copy old values.
T | Buffer element type. |
|
inlineexplicit |
Constructs a circular buffer.
size | Maximum number of buffer elements. |
|
default |
|
default |
|
inline |
Returns value at back of buffer.
If there are no elements in the buffer, calling this function results in undefined behavior.
|
inline |
Returns value at back of buffer.
If there are no elements in the buffer, calling this function results in undefined behavior.
|
inline |
|
inline |
|
inline |
|
inline |
|
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.
|
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.
|
inline |
|
inline |
|
inline |
Returns value at front of buffer.
|
inline |
Returns value at front of buffer.
|
default |
|
default |
|
inline |
|
inline |
|
inline |
Pop value at back of buffer.
If there are no elements in the buffer, calling this function results in undefined behavior.
|
inline |
Pop value at front of buffer.
If there are no elements in the buffer, calling this function results in undefined behavior.
|
inline |
Push a new value onto the back of the buffer.
The value at the front is overwritten if the buffer is full.
|
inline |
Push a new value onto the front of the buffer.
The value at the back is overwritten if the buffer is full.
|
inline |
Empties internal buffer.
|
inline |
Resizes internal buffer to given size.
|
inline |
Returns number of elements in buffer.