ethzasl-msf - Modular Sensor Fusion
Time delay compensated single and multi sensor fusion framework based on an EKF
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Types | Private Attributes
msf_core::SortedContainer< T, PrototypeInvalidT > Class Template Reference

Manages a sorted container with strict less than ordering used to store state and measurement objects which can then be queried for closest states/measurements to a given time instant.

#include <msf_sortedContainer.h>

Public Types

typedef shared_ptr< T > Ptr_T
typedef ListT::iterator iterator_T

Public Member Functions

 SortedContainer ()
shared_ptr< T > & getInvalid ()
 To be called to signal that a request could not be satisfied.
void clear ()
 Clears the internal container, dropping all the contents.
ListT::size_type size ()
 Returns the size of the internal container.
ListT::iterator insert (const shared_ptr< T > &value)
 Insert an object to the internal container to the position not violating the internal strict less than ordering by time.
ListT::iterator getIteratorBegin ()
 Returns the iterator at the beginning of the internal container.
ListT::iterator getIteratorBeforeBegin ()
 Returns the iterator before the beginning of the internal container.
ListT::iterator getIteratorEnd ()
 Returns the iterator at the end of the internal container.
ListT::iterator getIteratorAtValue (const shared_ptr< T > &value, bool warnIfNotExistant=true)
 Returns the iterator at the specific time instant of the supplied object or an invalid object if the request cannot be satisfied.
ListT::iterator getIteratorAtValue (const double &time, bool warnIfNotExistant=true)
 Returns the iterator at a specific time instant or an invalid object if the request cannot be satisfied.
ListT::iterator getIteratorClosestBefore (const double &statetime)
 Returns the iterator closest before a specific time instant.
ListT::iterator getIteratorClosestAfter (const double &statetime)
 Returns the iterator closest after a specific time instant.
ListT::iterator getIteratorClosest (const double &statetime)
 Returns the iterator closest to a specific time instant.
shared_ptr< T > & getClosestBefore (const double &statetime)
 Returns a pointer to the closest object before a specific time instant.
shared_ptr< T > & getClosestAfter (const double &statetime)
 Returns a pointer to the closest after a specific time instant or an invalid object if the request cannot be satisfied.
shared_ptr< T > & getValueAt (const double &statetime)
 Returns a pointer to the object at a specific time instant or an invalid object if the request cannot be satisfied.
shared_ptr< T > & getClosest (const double &statetime)
 Returns a pointer to the closest to a specific time instant.
void clearOlderThan (double age)
 Clears all objects having a time stamp older than the supplied time in seconds.
shared_ptr< T > & getLast ()
 Returns a pointer to the last object in the container or an invalid object if the container is empty.
shared_ptr< T > & getFirst ()
 Returns a pointer to the first object in the container or an invalid object if the container is empty.
shared_ptr< T > updateTime (double timeOld, double timeNew) __attribute__((warn_unused_result))
 This function updates the time of an object in the container this function effectively changes the map ordering, so the previous iterators are invalidated the attribute unused can be eliminated for non gcc compilers, its just a little more verbose in cases where the updated value is not used.
std::string echoBufferContentTimes ()
 Debug output the contents of the container in a human readable time format.

Private Types

typedef std::map< double, Ptr_TListT
 The container type in which to store the data.

Private Attributes

ListT stateList
 The container in which all the data is stored.
Ptr_T invalid
 A object to signal requests which cannot be satisfied.

Member Typedef Documentation

template<typename T, typename PrototypeInvalidT = T>
typedef ListT::iterator msf_core::SortedContainer< T, PrototypeInvalidT >::iterator_T
template<typename T, typename PrototypeInvalidT = T>
typedef std::map<double, Ptr_T> msf_core::SortedContainer< T, PrototypeInvalidT >::ListT
private
template<typename T, typename PrototypeInvalidT = T>
typedef shared_ptr<T> msf_core::SortedContainer< T, PrototypeInvalidT >::Ptr_T

Constructor & Destructor Documentation

template<typename T, typename PrototypeInvalidT = T>
msf_core::SortedContainer< T, PrototypeInvalidT >::SortedContainer ( )
inline

Member Function Documentation

template<typename T, typename PrototypeInvalidT = T>
void msf_core::SortedContainer< T, PrototypeInvalidT >::clear ( )
inline
template<typename T, typename PrototypeInvalidT = T>
void msf_core::SortedContainer< T, PrototypeInvalidT >::clearOlderThan ( double  age)
inline
Parameters
timeThe maximum age of states in the container.
Returns
shared pointer of the object.
template<typename T, typename PrototypeInvalidT = T>
std::string msf_core::SortedContainer< T, PrototypeInvalidT >::echoBufferContentTimes ( )
inline
Returns
String of the buffer contents with line breaks after every entry.
template<typename T, typename PrototypeInvalidT = T>
shared_ptr<T>& msf_core::SortedContainer< T, PrototypeInvalidT >::getClosest ( const double &  statetime)
inline
Parameters
timeThe time where we want to get the value at.
Returns
shared pointer of the object.
template<typename T, typename PrototypeInvalidT = T>
shared_ptr<T>& msf_core::SortedContainer< T, PrototypeInvalidT >::getClosestAfter ( const double &  statetime)
inline
Parameters
timeThe time where we want to get the value at
Returns
shared pointer of the object.
template<typename T, typename PrototypeInvalidT = T>
shared_ptr<T>& msf_core::SortedContainer< T, PrototypeInvalidT >::getClosestBefore ( const double &  statetime)
inline
Parameters
Timethe time where we want to get the value at.
Returns
shared pointer of the object.
template<typename T, typename PrototypeInvalidT = T>
shared_ptr<T>& msf_core::SortedContainer< T, PrototypeInvalidT >::getFirst ( )
inline
Returns
shared pointer of the object.
template<typename T, typename PrototypeInvalidT = T>
shared_ptr<T>& msf_core::SortedContainer< T, PrototypeInvalidT >::getInvalid ( )
inline
Returns
an object of the "invalid" type
template<typename T, typename PrototypeInvalidT = T>
ListT::iterator msf_core::SortedContainer< T, PrototypeInvalidT >::getIteratorAtValue ( const shared_ptr< T > &  value,
bool  warnIfNotExistant = true 
)
inline
Parameters
valueThe value to get the iterator for.
Returns
iterator.
template<typename T, typename PrototypeInvalidT = T>
ListT::iterator msf_core::SortedContainer< T, PrototypeInvalidT >::getIteratorAtValue ( const double &  time,
bool  warnIfNotExistant = true 
)
inline
Parameters
timeThe time where we want to get an iterator at.
Returns
iterator.
template<typename T, typename PrototypeInvalidT = T>
ListT::iterator msf_core::SortedContainer< T, PrototypeInvalidT >::getIteratorBeforeBegin ( )
inline
template<typename T, typename PrototypeInvalidT = T>
ListT::iterator msf_core::SortedContainer< T, PrototypeInvalidT >::getIteratorBegin ( )
inline
template<typename T, typename PrototypeInvalidT = T>
ListT::iterator msf_core::SortedContainer< T, PrototypeInvalidT >::getIteratorClosest ( const double &  statetime)
inline
Parameters
timeThe time where we want to get an iterator at.
Returns
iterator.
template<typename T, typename PrototypeInvalidT = T>
ListT::iterator msf_core::SortedContainer< T, PrototypeInvalidT >::getIteratorClosestAfter ( const double &  statetime)
inline
Parameters
timeThe time where we want to get an iterator at.
Returns
iterator.
template<typename T, typename PrototypeInvalidT = T>
ListT::iterator msf_core::SortedContainer< T, PrototypeInvalidT >::getIteratorClosestBefore ( const double &  statetime)
inline
Parameters
timeThe time where we want to get an iterator at.
Returns
iterator.
template<typename T, typename PrototypeInvalidT = T>
ListT::iterator msf_core::SortedContainer< T, PrototypeInvalidT >::getIteratorEnd ( )
inline
template<typename T, typename PrototypeInvalidT = T>
shared_ptr<T>& msf_core::SortedContainer< T, PrototypeInvalidT >::getLast ( )
inline
Returns
shared pointer of the object.
template<typename T, typename PrototypeInvalidT = T>
shared_ptr<T>& msf_core::SortedContainer< T, PrototypeInvalidT >::getValueAt ( const double &  statetime)
inline
Parameters
timeThe time where we want to get the value at.
Returns
shared pointer of the object.
template<typename T, typename PrototypeInvalidT = T>
ListT::iterator msf_core::SortedContainer< T, PrototypeInvalidT >::insert ( const shared_ptr< T > &  value)
inline
template<typename T, typename PrototypeInvalidT = T>
ListT::size_type msf_core::SortedContainer< T, PrototypeInvalidT >::size ( )
inline
Returns
Size of the container.
template<typename T, typename PrototypeInvalidT = T>
shared_ptr<T> msf_core::SortedContainer< T, PrototypeInvalidT >::updateTime ( double  timeOld,
double  timeNew 
)
inline
Parameters
timeOldThe time of the value to update.
timeNewThe time to update to.
Returns
shared pointer of the object.

Member Data Documentation

template<typename T, typename PrototypeInvalidT = T>
Ptr_T msf_core::SortedContainer< T, PrototypeInvalidT >::invalid
private
template<typename T, typename PrototypeInvalidT = T>
ListT msf_core::SortedContainer< T, PrototypeInvalidT >::stateList
private

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