Monado OpenXR Runtime
|
Stores some number of values in a ring buffer, overwriting the earliest-pushed-remaining element if out of room. More...
#include <util/u_template_historybuf.hpp>
Public Types | |
using | iterator = detail::HistoryBufIterator< T, MaxSize > |
using | const_iterator = detail::HistoryBufConstIterator< T, MaxSize > |
Public Member Functions | |
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 () |
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.
|
inline |
Gets a reference to the back (newest) element in the buffer.
std::logic_error | if buffer is empty |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlinenoexcept |
Get a const iterator for the oldest element.
|
inlinenoexcept |
Get an iterator for the oldest element.
|
inlinenoexcept |
Get a const iterator for the oldest element.
|
inlinenoexcept |
Get a "past the end" (past the newest) const iterator.
|
inlinenoexcept |
Is the buffer empty?
|
inlinenoexcept |
Get a "past the end" (past the newest) const iterator.
|
inlinenoexcept |
Get a "past the end" (past the newest) iterator.
|
inline |
Gets a reference to the front (oldest) element in the buffer.
std::logic_error | if buffer is empty |
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlinenoexcept |
Use a value at a given age, where age 0 is the most recent value, age 1 precedes it, etc.
(reverse chronological order)
Out of bounds accesses will return nullptr.
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References xrt::auxiliary::util::detail::RingBufferHelper::clamped_age_to_inner_index().
|
inlinenoexcept |
Like get_at_age() but values larger than the oldest age are clamped.
References xrt::auxiliary::util::detail::RingBufferHelper::clamped_age_to_inner_index().
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inlinenoexcept |
Use a value at a given index, where 0 is the least-recent value still stored, index 1 follows it, etc.
(chronological order)
Out of bounds accesses will return nullptr.
|
inlinenoexcept |
Logically remove the newest element from the buffer.
This is permitted to invalidate iterators. They won't be poisoned, but they will return something you don't expect.
References xrt::auxiliary::util::detail::RingBufferHelper::pop_back().
|
inlinenoexcept |
Logically remove the oldest element from the buffer.
The value still remains in the backing container until overwritten, but it isn't accessible anymore.
This invalidates iterators. They won't be poisoned, but they will return something you don't expect.
References xrt::auxiliary::util::detail::RingBufferHelper::pop_front().
|
inline |
Put something at the back, overwriting whatever was at the front if necessary.
This is permitted to invalidate iterators. They won't be poisoned, but they will return something you don't expect.
|
inlinenoexcept |
How many elements are in the buffer?