Template Class CircularBuffer

Nested Relationships

Nested Types

Inheritance Relationships

Derived Type

Class Documentation

template<typename T>
class CircularBuffer

A simple circular buffer implementation with forward and reverse iterators.

This implementation is not thread-safe.

Template Parameters:

T – The type of elements stored in the buffer

Subclassed by dai::utility::WindowedAverageBuffer< T >

Public Functions

inline CircularBuffer(size_t size)
virtual ~CircularBuffer() = default
inline T &add(T value)
inline std::vector<T> getBuffer() const
inline T first() const
inline T last() const
inline size_t size() const
inline void clear()
inline T &at(size_t pos)
inline const T &at(size_t pos) const
inline iterator begin()
inline iterator end()
inline reverse_iterator rbegin()
inline reverse_iterator rend()
class iterator

Public Types

using iterator_category = std::forward_iterator_tag
using value_type = T
using difference_type = std::ptrdiff_t
using pointer = T*
using reference = T&

Public Functions

inline iterator(CircularBuffer *parent, size_t pos)
inline reference operator*()
inline pointer operator->()
inline iterator &operator++()
inline iterator operator++(int)
inline bool operator==(const iterator &other) const
inline bool operator!=(const iterator &other) const
class reverse_iterator

Public Types

using iterator_category = std::bidirectional_iterator_tag
using value_type = T
using difference_type = std::ptrdiff_t
using pointer = T*
using reference = T&

Public Functions

inline reverse_iterator(CircularBuffer *parent, size_t pos)
inline reference operator*()
inline pointer operator->()
inline reverse_iterator &operator++()
inline reverse_iterator operator++(int)
inline bool operator==(const reverse_iterator &other) const
inline bool operator!=(const reverse_iterator &other) const