OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ > Class Template Reference

#include </home/jenkins/root/workspace/OSVR-Core-Docs/plugins/unifiedvideoinertialtracker/HistoryContainer.h>

Public Types

using value_type = ValueType
 
using timestamp_type = detail::timestamp
 
using full_value_type = detail::full_value_type< value_type >
 
using container_type = detail::inner_container_type< value_type >
 
using size_type = detail::container_size_type< value_type >
 
using iterator = detail::iterator< value_type >
 
using const_iterator = iterator
 
using comparator_type = detail::TimestampPairLessThan< value_type >
 
using subset_range_type = detail::HistorySubsetRange< value_type >
 

Public Member Functions

size_type size () const
 Get number of entries in history.
 
size_type highWaterMark () const
 Get the maximum number of entries ever recorded.
 
bool empty () const
 Gets whether history is empty or not.
 
timestamp_type const & oldest_timestamp () const
 
value_type const & oldest () const
 
timestamp_type const & newest_timestamp () const
 
value_type const & newest () const
 
void pop_oldest ()
 
void pop_newest ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator end () const
 
const_iterator cend () const
 
void clear ()
 
bool is_strictly_newest (timestamp_type const &tv) const
 
bool is_as_new_as_newest (timestamp_type const &tv) const
 
bool is_valid_to_push_newest (timestamp_type const &tv)
 
const_iterator upper_bound (timestamp_type const &tv) const
 
const_iterator lower_bound (timestamp_type const &tv) const
 
const_iterator closest_not_newer (timestamp_type const &tv) const
 
subset_range_type get_range_newer_than (timestamp_type const &tv) const
 
size_type pop_before (timestamp_type const &tv)
 
size_type pop_after (timestamp_type const &tv)
 
void push_newest (osvr::util::time::TimeValue const &tv, value_type const &value)
 

Static Public Member Functions

static comparator_type comparator ()
 

Static Public Attributes

static const bool AllowDuplicateTimes = AllowDuplicateTimes_
 

Detailed Description

template<typename ValueType, bool AllowDuplicateTimes_ = true>
class osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >

Stores values over time, in chronological order, in a deque for two-ended access.

Definition at line 104 of file HistoryContainer.h.

Member Function Documentation

template<typename ValueType , bool AllowDuplicateTimes_ = true>
timestamp_type const& osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::newest_timestamp ( ) const
inline

Returns the newest timestamp in the container. Caveat: throws an exception in an empty container - if you want to actually compare to see if you're at least as new as the newest, see is_as_new_as_newest(), if you want to see if your value is newer than all others, see is_strictly_newest(). Both of these contain special handling for empty containers.

Definition at line 156 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
static comparator_type osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::comparator ( )
inlinestatic

Returns a comparison functor (comparing timestamps) for use with standard algorithms like lower_bound and upper_bound

Definition at line 177 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
bool osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::is_strictly_newest ( timestamp_type const &  tv) const
inline

Returns true if the given timestamp is strictly newer than the newest timestamp in the container, or if the container is empty (thus making the timestamp trivially newest)

Definition at line 201 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
bool osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::is_as_new_as_newest ( timestamp_type const &  tv) const
inline

Returns true if the given timestamp is no older than the newest timestamp in the container, or if the container is empty (thus making the timestamp trivially newest)

Definition at line 208 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
bool osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::is_valid_to_push_newest ( timestamp_type const &  tv)
inline

Returns true if the given timestamp meets the criteria of push_newest: strictly newest if AllowDuplicateTimes is false, as new as newest if AllowDuplicateTimes is true.

Definition at line 215 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
const_iterator osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::upper_bound ( timestamp_type const &  tv) const
inline

Wrapper around std::upper_bound: returns iterator to first element newer than timestamp given or end() if none.

Definition at line 222 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
const_iterator osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::lower_bound ( timestamp_type const &  tv) const
inline

Wrapper around std::lower_bound: returns iterator to first element with timestamp equal or newer than timestamp given or end() if none.

Definition at line 228 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
const_iterator osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::closest_not_newer ( timestamp_type const &  tv) const
inline

Return an iterator to the newest, last pair of timestamp and value that is not newer than the given timestamp. If none meet this criteria, returns end().

This will return one element past where we want. It's OK if that's end(), but not if it's begin().

Definition at line 255 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
subset_range_type osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::get_range_newer_than ( timestamp_type const &  tv) const
inline

Returns a proxy object that can be treated as a range in a range-for loop to iterate over all elements strictly newer than the given timestamp. (Uses upper_bound internally.)

Definition at line 275 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
size_type osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::pop_before ( timestamp_type const &  tv)
inline

Remove all entries in history with timestamps strictly older than the given timestamp.

Returns
number of elements removed.
Todo:
is this right?

Definition at line 295 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
size_type osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::pop_after ( timestamp_type const &  tv)
inline

Remove all entries in history with timestamps strictly newer than the given timestamp.

Returns
number of elements removed.

Definition at line 332 of file HistoryContainer.h.

template<typename ValueType , bool AllowDuplicateTimes_ = true>
void osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::push_newest ( osvr::util::time::TimeValue const &  tv,
value_type const &  value 
)
inline

Adds a new value to history. It must be newer (or equal time, based on template parameters) than the newest (or the history must be empty).

Definition at line 350 of file HistoryContainer.h.

Member Data Documentation

template<typename ValueType , bool AllowDuplicateTimes_ = true>
const bool osvr::vbtracker::history::HistoryContainer< ValueType, AllowDuplicateTimes_ >::AllowDuplicateTimes = AllowDuplicateTimes_
static

Whether multiple entries with the same timestamp are permitted to be pushed.

Definition at line 122 of file HistoryContainer.h.


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