Monado OpenXR Runtime
xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize > Class Template Reference

Class template for iterator for HistoryBuffer. More...

Inheritance diagram for xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >:
Collaboration diagram for xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >:

Public Types

using Self = HistoryBufIterator< T, MaxSize >
 
using container_type = HistoryBuffer< T, MaxSize >
 
using value_type = T
 
using pointer = T *
 
using reference = T &
 
- Public Types inherited from xrt::auxiliary::util::RandomAccessIteratorBase< const RingBufferHelper >
using iterator_category = std::random_access_iterator_tag
 
using difference_type = std::ptrdiff_t
 
using const_iterator_base = std::conditional_t< std::is_const< const RingBufferHelper >::value, RandomAccessIteratorBase, RandomAccessIteratorBase< std::add_const_t< const RingBufferHelper > > >
 

Public Member Functions

 HistoryBufIterator ()=default
 Default-construct an (invalid) iterator. More...
 
 HistoryBufIterator (HistoryBufIterator const &)=default
 
 HistoryBufIterator (HistoryBufIterator &&) noexcept=default
 
HistoryBufIteratoroperator= (HistoryBufIterator const &)=default
 
HistoryBufIteratoroperator= (HistoryBufIterator &&) noexcept=default
 
bool valid () const noexcept
 Is this iterator valid? More...
 
 operator bool () const noexcept
 Is this iterator valid? More...
 
container_typecontainer () const noexcept
 Get the associated container: for internal use. More...
 
reference operator* () const
 Dereference operator: throws std::out_of_range if invalid. More...
 
pointer operator-> () const noexcept
 Smart pointer operator: returns nullptr if invalid. More...
 
Selfoperator++ ()
 Pre-increment: Advance, then return self. More...
 
Self operator++ (int)
 Post-increment: return a copy of initial state after incrementing self. More...
 
Selfoperator-- ()
 Pre-decrement: Subtract, then return self. More...
 
Self operator-- (int)
 Post-decrement: return a copy of initial state after decrementing self. More...
 
Selfoperator+= (std::ptrdiff_t n) noexcept
 Increment by an arbitrary amount. More...
 
Selfoperator-= (std::ptrdiff_t n) noexcept
 Decrement by an arbitrary amount. More...
 
Self operator+ (std::ptrdiff_t n) const noexcept
 Increment a copy of the iterator by an arbitrary amount. More...
 
Self operator- (std::ptrdiff_t n) const noexcept
 Decrement a copy of the iterator by an arbitrary amount. More...
 
- Public Member Functions inherited from xrt::auxiliary::util::RandomAccessIteratorBase< const RingBufferHelper >
bool valid () const noexcept
 Is this iterator valid? More...
 
 operator bool () const noexcept
 Is this iterator valid? More...
 
size_t index () const noexcept
 What is the index stored by this iterator? More...
 
bool is_past_the_end () const noexcept
 Is this iterator pointing "past the end" of the container? More...
 
bool is_cleared () const noexcept
 True if this iterator is "irrecoverably" invalid (that is, cleared or default constructed). More...
 
std::ptrdiff_t operator- (const RandomAccessIteratorBase< const RingBufferHelper > &other) const
 Compute the difference between two iterators. More...
 
RandomAccessIteratorBase operator- (std::ptrdiff_t n) const
 Subtract some arbitrary amount from a copy of this iterator. More...
 
RandomAccessIteratorBaseoperator+= (std::ptrdiff_t n)
 Increment by an arbitrary value. More...
 
RandomAccessIteratorBaseoperator-= (std::ptrdiff_t n)
 Decrement by an arbitrary value. More...
 
RandomAccessIteratorBase operator+ (std::ptrdiff_t n) const
 Add some arbitrary amount to a copy of this iterator. More...
 
 RandomAccessIteratorBase ()=default
 Default constructor - initializes to "cleared" (that is, irrecoverably invalid - because we have no reference to a container) More...
 
 RandomAccessIteratorBase (const RingBufferHelper &container, size_t index)
 Constructor from a helper/container and index. More...
 
const_iterator_base as_const () const
 Get a const iterator base pointing to the same element as this element. More...
 

Friends

class HistoryBuffer< T, MaxSize >
 

Additional Inherited Members

- Static Public Member Functions inherited from xrt::auxiliary::util::RandomAccessIteratorBase< const RingBufferHelper >
static RandomAccessIteratorBase begin (const RingBufferHelper &container)
 Factory function: construct the "begin" iterator. More...
 
static RandomAccessIteratorBase end (const RingBufferHelper &container)
 Factory function: construct the "past the end" iterator that can be decremented safely. More...
 
- Protected Member Functions inherited from xrt::auxiliary::util::RandomAccessIteratorBase< const RingBufferHelper >
 RandomAccessIteratorBase (const RingBufferHelper *container, size_t index)
 for internal use More...
 
void increment_n (std::size_t n)
 Increment an arbitrary amount. More...
 
void decrement_n (std::size_t n)
 Decrement an arbitrary amount. More...
 
const RingBufferHelper * container () const noexcept
 Get the associated container or helper. More...
 

Detailed Description

template<typename T, size_t MaxSize>
class xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >

Class template for iterator for HistoryBuffer.

Template Parameters
TContainer element type - must match HistoryBuffer
MaxSizeMaximum number of elements - must match HistoryBuffer

Constructor & Destructor Documentation

◆ HistoryBufIterator()

template<typename T , size_t MaxSize>
xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::HistoryBufIterator ( )
default

Default-construct an (invalid) iterator.

Member Function Documentation

◆ container()

template<typename T , size_t MaxSize>
container_type * xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::container ( ) const
inlinenoexcept

Get the associated container: for internal use.

◆ operator bool()

template<typename T , size_t MaxSize>
xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator bool ( ) const
inlineexplicitnoexcept

◆ operator*()

template<typename T , size_t MaxSize>
HistoryBufIterator< T, MaxSize >::reference xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator*
inline

Dereference operator: throws std::out_of_range if invalid.

◆ operator+()

template<typename T , size_t MaxSize>
HistoryBufIterator< T, MaxSize > xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator+ ( std::ptrdiff_t  n) const
inlinenoexcept

Increment a copy of the iterator by an arbitrary amount.

◆ operator++() [1/2]

template<typename T , size_t MaxSize>
HistoryBufIterator< T, MaxSize > & xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator++
inline

Pre-increment: Advance, then return self.

◆ operator++() [2/2]

template<typename T , size_t MaxSize>
Self xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator++ ( int  )
inline

Post-increment: return a copy of initial state after incrementing self.

References xrt::auxiliary::util::RandomAccessIteratorBase< const RingBufferHelper >::increment_n().

◆ operator+=()

template<typename T , size_t MaxSize>
HistoryBufIterator< T, MaxSize > & xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator+= ( std::ptrdiff_t  n)
inlinenoexcept

Increment by an arbitrary amount.

◆ operator-()

template<typename T , size_t MaxSize>
HistoryBufIterator< T, MaxSize > xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator- ( std::ptrdiff_t  n) const
inlinenoexcept

Decrement a copy of the iterator by an arbitrary amount.

◆ operator--() [1/2]

template<typename T , size_t MaxSize>
HistoryBufIterator< T, MaxSize > & xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator--
inline

Pre-decrement: Subtract, then return self.

◆ operator--() [2/2]

template<typename T , size_t MaxSize>
Self xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator-- ( int  )
inline

Post-decrement: return a copy of initial state after decrementing self.

References xrt::auxiliary::util::RandomAccessIteratorBase< const RingBufferHelper >::decrement_n().

◆ operator-=()

template<typename T , size_t MaxSize>
HistoryBufIterator< T, MaxSize > & xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator-= ( std::ptrdiff_t  n)
inlinenoexcept

Decrement by an arbitrary amount.

◆ operator->()

template<typename T , size_t MaxSize>
HistoryBufIterator< T, MaxSize >::pointer xrt::auxiliary::util::detail::HistoryBufIterator< T, MaxSize >::operator->
inlinenoexcept

Smart pointer operator: returns nullptr if invalid.

◆ valid()


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