DUtils::TimeManager Class Reference

Manages collections of timestamps. More...

#include <TimeManager.h>

List of all members.

Classes

class  iterator
 Iterator of managed data (these data are copied). More...
struct  tEntry
 Single entry of the collection. More...

Public Member Functions

Timestamp operator[] (unsigned int idx)
void add (const Timestamp &t)
void remove (const Timestamp &t, bool decrease_indexes)
void clear ()
bool empty () const
unsigned int size () const
iterator begin (float frequency=-1)
iterator beginAfter (double seconds, float frequency=-1)
iterator beginAt (const Timestamp &t, float frequency=-1)
Timestamp getFirstTimestamp ()
Timestamp getLastTimestamp ()

Protected Member Functions

void sort ()

Static Protected Member Functions

static bool le (const tEntry &a, const tEntry &b)

Protected Attributes

std::vector< tEntrym_entries
 All the entries of the timestamp collection.
bool m_is_sorted
 Flag to tell when the entries are sorted.

Friends

class iterator

Detailed Description

Manages collections of timestamps.


Member Function Documentation

void TimeManager::add ( const Timestamp t  ) 

Adds a timestamp to the collection. This action invalidate the created iterators

Parameters:
t 
TimeManager::iterator TimeManager::begin ( float  frequency = -1  ) 

Returns an iterator to the first item of the sequence. When the interator is incremented, it will according with the desired frequency here

Parameters:
frequency frequency to get the timestamps. It can be -1 to mean all the timestamps
TimeManager::iterator TimeManager::beginAfter ( double  seconds,
float  frequency = -1 
)

Returns an interator to the lower timestamp that is greater or equal to the first timetamp + seconds (first timestamp = the oldest one)

Parameters:
seconds 
frequency frequency of iterator. -1 by default (single step frequency)
TimeManager::iterator TimeManager::beginAt ( const Timestamp t,
float  frequency = -1 
)

Returns an interator to the closest timestamp to the given one

Parameters:
t 
frequency frequency of iterator. -1 by default (single step)
void TimeManager::clear (  ) 

Removes all the timestamps. This action invalidates the created iterators

bool DUtils::TimeManager::empty (  )  const [inline]

Says if the collection is empty

Returns:
true iff empty
Timestamp TimeManager::getFirstTimestamp (  ) 

Returns the first timestamp (in order) of the collection

Returns:
first timestamp
Timestamp TimeManager::getLastTimestamp (  ) 

Returns the last timestmap (in order) of the collection

Returns:
last timestamp
bool TimeManager::le ( const tEntry a,
const tEntry b 
) [static, protected]

Checks if timestamp of a < timestamp of b

Parameters:
a 
b 
Returns:
true iif a < b
Timestamp TimeManager::operator[] ( unsigned int  idx  ) 

Returns the idx-th timestamp after sorting all the timestamps

Parameters:
idx 0 <= idx < size
void TimeManager::remove ( const Timestamp t,
bool  decrease_indexes 
)

Removes the given timestamps from the collection. This can also decrease the insertion index of the timestamps added after the removed one. This action invalidates the created iterators

Parameters:
t 
decrease_indexes if true, indexes of next timestamps are decreased
unsigned int DUtils::TimeManager::size (  )  const [inline]

Returns the number of timestamps in the collection

Returns:
number of entries
void TimeManager::sort (  )  [protected]

Makes the stored timestamps to be sorted in ascending order


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Enumerations Friends
Generated on Thu Feb 7 19:16:00 2013 by  doxygen 1.6.3