Stores some number of values in a ring buffer, overwriting the earliest-pushed-remaining element if out of room.
More...
|
| bool | empty () const noexcept |
| | Is the buffer empty? More...
|
| |
| size_t | size () const noexcept |
| | How many elements are in the buffer? More...
|
| |
| void | push_back (const T &element) |
| | Put something at the back, overwriting whatever was at the front if necessary. More...
|
| |
| bool | pop_back () noexcept |
| | Logically remove the newest element from the buffer. More...
|
| |
| void | pop_front () noexcept |
| | Logically remove the oldest element from the buffer. More...
|
| |
| T * | get_at_age (size_t age) noexcept |
| | Use a value at a given age, where age 0 is the most recent value, age 1 precedes it, etc. More...
|
| |
| const T * | get_at_age (size_t age) const noexcept |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
|
| |
| T * | get_at_clamped_age (size_t age) noexcept |
| | Like get_at_age() but values larger than the oldest age are clamped. More...
|
| |
| const T * | get_at_clamped_age (size_t age) const noexcept |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
|
| |
| T * | get_at_index (size_t index) noexcept |
| | Use a value at a given index, where 0 is the least-recent value still stored, index 1 follows it, etc. More...
|
| |
| const T * | get_at_index (size_t index) const noexcept |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
|
| |
| const_iterator | cbegin () const noexcept |
| | Get a const iterator for the oldest element. More...
|
| |
| const_iterator | cend () const noexcept |
| | Get a "past the end" (past the newest) const iterator. More...
|
| |
| const_iterator | begin () const noexcept |
| | Get a const iterator for the oldest element. More...
|
| |
| const_iterator | end () const noexcept |
| | Get a "past the end" (past the newest) const iterator. More...
|
| |
| iterator | begin () noexcept |
| | Get an iterator for the oldest element. More...
|
| |
| iterator | end () noexcept |
| | Get a "past the end" (past the newest) iterator. More...
|
| |
| T & | front () |
| | Gets a reference to the front (oldest) element in the buffer. More...
|
| |
| const T & | front () const |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
|
| |
| T & | back () |
| | Gets a reference to the back (newest) element in the buffer. More...
|
| |
| const T & | back () const |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
|
| |
|
void | clear () |
| |
template<typename T,
size_t MaxSize>
class xrt::auxiliary::util::HistoryBuffer< T, MaxSize >
Stores some number of values in a ring buffer, overwriting the earliest-pushed-remaining element if out of room.
Note this should only store value types, since there's no way to destroy elements other than overwriting them, and all elements are default-initialized upon construction of the container.
- Note
- Unlike m_relation_history which is based on this, this data structure is not inherently safe for concurrent/threaded use: there are no locks built-in.