ALBA
Public Types | Public Member Functions | Protected Attributes | List of all members
albaTimeMap< T > Class Template Reference

#include <albaTimeMapUX.h>

Inheritance diagram for albaTimeMap< T >:
Inheritance graph
[legend]
Collaboration diagram for albaTimeMap< T >:
Collaboration graph
[legend]

Public Types

typedef std::map< albaTimeStamp, albaAutoPointer< T > > TimeMap
 
typedef std::pair< albaTimeStamp, albaAutoPointer< T > > mmuTimePair
 
typedef std::map< albaTimeStamp, albaAutoPointer< T > > TimeMap
 
typedef std::pair< albaTimeStamp, albaAutoPointer< T > > mmuTimePair
 

Public Member Functions

 albaTimeMap ()
 
virtual ~albaTimeMap ()
 
 albaTimeMap (const albaTimeMap< T > &)
 
void operator= (const albaTimeMap< T > &)
 
void SetItemTypeName (const char *tname)
 
const char * GetItemTypeName ()
 
virtual void AppendItem (T *m)
 
virtual void AppendAndSetItem (T *m)
 
virtual void PrependItem (T *m)
 
albaTimeMap< T >::TimeMap::iterator FindItem (T *m)
 
virtual void InsertItem (T *m)
 
virtual void RemoveItem (typename albaTimeMap< T >::TimeMap::iterator it)
 
int RemoveItem (int idx)
 
virtual void RemoveAllItems ()
 
albaTimeStamp GetItemTime (int idx)
 
void GetTimeStamps (mmuTimeVector &kframes) const
 
int GetNumberOfItems () const
 
void GetTimeBounds (albaTimeStamp tbounds[2])
 
void DeepCopy (albaTimeMap *vitem)
 
bool Equals (albaTimeMap *vmat)
 
albaTimeMap< T >::TimeMap::iterator FindNearestItem (albaTimeStamp t)
 
albaTimeMap< T >::TimeMap::iterator FindItemBefore (albaTimeStamp t)
 
albaTimeMap< T >::TimeMap::iterator FindItem (albaTimeStamp t)
 
albaTimeMap< T >::TimeMap::iterator FindItemByIndex (int idx)
 
albaID FindItemIndex (albaTimeStamp t)
 
T * GetItem (albaTimeStamp t)
 
T * GetNearestItem (albaTimeStamp t)
 
T * GetItemBefore (albaTimeStamp t)
 
T * GetItemByIndex (int idx)
 
virtual void Print (std::ostream &os, const int tabs=0) const
 
albaTimeMap< T >::TimeMap::iterator Begin ()
 
albaTimeMap< T >::TimeMap::iterator End ()
 
albaTimeMap< T >::TimeMap::iterator Last ()
 
 albaTimeMap ()
 
virtual ~albaTimeMap ()
 
 albaTimeMap (const albaTimeMap< T > &)
 
void operator= (const albaTimeMap< T > &)
 
void SetItemTypeName (const char *tname)
 
const char * GetItemTypeName ()
 
virtual void AppendItem (T *m)
 
virtual void AppendAndSetItem (T *m)
 
virtual void PrependItem (T *m)
 
albaTimeMap< T >::TimeMap::iterator FindItem (T *m)
 
virtual void InsertItem (T *m)
 
virtual void RemoveItem (typename albaTimeMap< T >::TimeMap::iterator it)
 
int RemoveItem (int idx)
 
virtual void RemoveAllItems ()
 
albaTimeStamp GetItemTime (int idx)
 
void GetTimeStamps (mmuTimeVector &kframes) const
 
int GetNumberOfItems () const
 
void GetTimeBounds (albaTimeStamp tbounds[2])
 
void DeepCopy (albaTimeMap *vitem)
 
bool Equals (albaTimeMap *vmat)
 
albaTimeMap< T >::TimeMap::iterator FindNearestItem (albaTimeStamp t)
 
albaTimeMap< T >::TimeMap::iterator FindItemBefore (albaTimeStamp t)
 
albaTimeMap< T >::TimeMap::iterator FindItem (albaTimeStamp t)
 
albaTimeMap< T >::TimeMap::iterator FindItemByIndex (int idx)
 
albaID FindItemIndex (albaTimeStamp t)
 
T * GetItem (albaTimeStamp t)
 
T * GetNearestItem (albaTimeStamp t)
 
T * GetItemBefore (albaTimeStamp t)
 
T * GetItemByIndex (int idx)
 
virtual void Print (std::ostream &os, const int tabs=0) const
 
albaTimeMap< T >::TimeMap::iterator Begin ()
 
albaTimeMap< T >::TimeMap::iterator End ()
 
albaTimeMap< T >::TimeMap::iterator Last ()
 
- Public Member Functions inherited from albaObject
 albaObject ()
 
virtual ~albaObject ()
 
virtual void Delete ()
 
virtual const char * GetTypeName () const
 
virtual bool IsA (const char *type_name) const
 
virtual bool IsA (const albaTypeID &type_id) const
 
virtual albaObjectNewObjectInstance () const =0
 
virtual const albaTypeIDGetTypeId () const
 
virtual void Print (std::ostream &os, const int indent=0) const
 
 albaObject (const albaObject &c)
 
- Public Member Functions inherited from albaTimeStamped
virtual void Modified ()
 
virtual unsigned long GetMTime ()
 

Protected Attributes

TimeMap m_TimeMap
 
albaString m_ItemTypeName
 
- Protected Attributes inherited from albaObject
bool m_HeapFlag
 
- Protected Attributes inherited from albaTimeStamped
albaMTime m_MTime
 

Additional Inherited Members

- Static Public Member Functions inherited from albaObject
static const char * GetStaticTypeName ()
 
static bool IsStaticType (const char *type_name)
 
static bool IsStaticType (const albaTypeID &type_id)
 
static const albaTypeIDGetStaticTypeId ()
 
static albaObjectSafeDownCast (albaObject *o)
 

Detailed Description

template<class T>
class albaTimeMap< T >

a dynamic associative sorted array of timestamped objects indexed by their "timestamp".

This class wraps an STL set (associative sorted array) of timestamped datasets, indexed by "timestamp". Its implementation depends on the undergoing data structure (currently an STL "vector", next release could be based on "map" or "hash_map"). Some utility functions are also provided.

Todo:

This class wraps an STL set (associative sorted array) of timestamped datasets, indexed by "timestamp". Its implementation depends on the undergoing data structure (currently an STL "vector", next release could be based on "map" or "hash_map"). Some utility functions are also provided.

Todo:

Definition at line 48 of file albaTimeMapUX.h.

Member Typedef Documentation

◆ TimeMap [1/2]

template<class T >
typedef std::map<albaTimeStamp, albaAutoPointer<T> > albaTimeMap< T >::TimeMap

Definition at line 51 of file albaTimeMapUX.h.

◆ mmuTimePair [1/2]

template<class T >
typedef std::pair<albaTimeStamp, albaAutoPointer<T> > albaTimeMap< T >::mmuTimePair

Definition at line 52 of file albaTimeMapUX.h.

◆ TimeMap [2/2]

template<class T >
typedef std::map<albaTimeStamp, albaAutoPointer<T> > albaTimeMap< T >::TimeMap

Definition at line 52 of file albaTimeMapWIN.h.

◆ mmuTimePair [2/2]

template<class T >
typedef std::pair<albaTimeStamp, albaAutoPointer<T> > albaTimeMap< T >::mmuTimePair

Definition at line 53 of file albaTimeMapWIN.h.

Constructor & Destructor Documentation

◆ albaTimeMap() [1/4]

template<class T >
albaTimeMap< T >::albaTimeMap

Definition at line 171 of file albaTimeMapUX.h.

◆ ~albaTimeMap() [1/2]

template<class T >
albaTimeMap< T >::~albaTimeMap
virtual

Definition at line 178 of file albaTimeMapUX.h.

◆ albaTimeMap() [2/4]

template<class T >
albaTimeMap< T >::albaTimeMap ( const albaTimeMap< T > &  )

◆ albaTimeMap() [3/4]

template<class T >
albaTimeMap< T >::albaTimeMap ( )

◆ ~albaTimeMap() [2/2]

template<class T >
virtual albaTimeMap< T >::~albaTimeMap ( )
virtual

◆ albaTimeMap() [4/4]

template<class T >
albaTimeMap< T >::albaTimeMap ( const albaTimeMap< T > &  )
inline

Definition at line 58 of file albaTimeMapWIN.h.

Member Function Documentation

◆ operator=() [1/2]

template<class T >
void albaTimeMap< T >::operator= ( const albaTimeMap< T > &  )

◆ SetItemTypeName() [1/2]

template<class T >
void albaTimeMap< T >::SetItemTypeName ( const char *  tname)
inline

set the TypeName of the kind of item accepted by this container

Definition at line 63 of file albaTimeMapUX.h.

◆ GetItemTypeName() [1/2]

template<class T >
const char * albaTimeMap< T >::GetItemTypeName ( )
inline

Definition at line 64 of file albaTimeMapUX.h.

◆ AppendItem() [1/2]

template<class T >
void albaTimeMap< T >::AppendItem ( T *  m)
virtual

Insert an item to the vector trying to append it, anyway the array is kept sorted.

Definition at line 205 of file albaTimeMapUX.h.

References albaErrorMacro.

◆ AppendAndSetItem() [1/2]

template<class T >
void albaTimeMap< T >::AppendAndSetItem ( T *  m)
virtual

append item setting its timestamp to the highest one + 1

Definition at line 185 of file albaTimeMapUX.h.

◆ PrependItem() [1/2]

template<class T >
void albaTimeMap< T >::PrependItem ( T *  m)
virtual

Insert an item to the vector trying to prepend it, anyway the array is kept sorted.

Item's timestamp must be >=0

Definition at line 224 of file albaTimeMapUX.h.

References albaErrorMacro.

◆ FindItem() [1/4]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::FindItem ( T *  m)

Find an item index given its pointer.

Definition at line 422 of file albaTimeMapUX.h.

◆ InsertItem() [1/2]

template<class T >
void albaTimeMap< T >::InsertItem ( T *  m)
virtual

Set the item for a specified time.

If no item with the same time exist the item is inserted in the vector. If an item with the same time exist, it's simply substituted with the new one. The item is always references and not copied. This function also automatically call the UpdateData() member function.

Definition at line 242 of file albaTimeMapUX.h.

References albaErrorMacro.

◆ RemoveItem() [1/4]

template<class T >
void albaTimeMap< T >::RemoveItem ( typename albaTimeMap< T >::TimeMap::iterator  it)
virtual

Remove an item given its iterator.

Definition at line 336 of file albaTimeMapUX.h.

◆ RemoveItem() [2/4]

template<class T >
int albaTimeMap< T >::RemoveItem ( int  idx)

Remove an item given its index.

Definition at line 345 of file albaTimeMapUX.h.

References ALBA_ERROR, and ALBA_OK.

◆ RemoveAllItems() [1/2]

template<class T >
void albaTimeMap< T >::RemoveAllItems
virtual

Remove all the items.

Definition at line 360 of file albaTimeMapUX.h.

◆ GetItemTime() [1/2]

template<class T >
albaTimeStamp albaTimeMap< T >::GetItemTime ( int  idx)

Return the timestamp of the i-th item.

Definition at line 451 of file albaTimeMapUX.h.

◆ GetTimeStamps() [1/2]

template<class T >
void albaTimeMap< T >::GetTimeStamps ( mmuTimeVector kframes) const

Return the list of timestamp of the key matrixes in the given vector.

Definition at line 280 of file albaTimeMapUX.h.

◆ GetNumberOfItems() [1/2]

template<class T >
int albaTimeMap< T >::GetNumberOfItems ( ) const
inline

Return the number of ITEMS stored in this object.

Definition at line 105 of file albaTimeMapUX.h.

Referenced by albaTimeMap< T >::Equals().

◆ GetTimeBounds() [1/2]

template<class T >
void albaTimeMap< T >::GetTimeBounds ( albaTimeStamp  tbounds[2])

Set/Get the Current time for this object.

Return the time bounds for this vector, i.e. minimum and maximum time stamps

Definition at line 262 of file albaTimeMapUX.h.

◆ DeepCopy() [1/2]

template<class T >
void albaTimeMap< T >::DeepCopy ( albaTimeMap< T > *  vitem)

Copy data from another array.

Definition at line 293 of file albaTimeMapUX.h.

References albaTimeMap< T >::Begin(), albaTimeMap< T >::DeepCopy(), and albaTimeMap< T >::End().

Referenced by albaTimeMap< T >::DeepCopy().

Here is the call graph for this function:

◆ Equals() [1/2]

template<class T >
bool albaTimeMap< T >::Equals ( albaTimeMap< T > *  vmat)

Compare two different arrays for equality.

They are considered equivalent if their key matrixes are equivalent.

Definition at line 311 of file albaTimeMapUX.h.

References albaTimeMap< T >::GetNumberOfItems(), and albaTimeMap< T >::m_TimeMap.

Here is the call graph for this function:

◆ FindNearestItem() [1/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::FindNearestItem ( albaTimeStamp  t)

Find the item with the timestamp nearest to t.

Definition at line 369 of file albaTimeMapUX.h.

◆ FindItemBefore() [1/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::FindItemBefore ( albaTimeStamp  t)

Find the item with timestamp <=t.

Definition at line 393 of file albaTimeMapUX.h.

◆ FindItem() [2/4]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::FindItem ( albaTimeStamp  t)

Find the item with the timestamp==t.

Returns the item index, and set "item" to its pointer. Return -1 and NULL if not found. not

Definition at line 414 of file albaTimeMapUX.h.

◆ FindItemByIndex() [1/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::FindItemByIndex ( int  idx)

return iterator of item with given index

Definition at line 461 of file albaTimeMapUX.h.

◆ FindItemIndex() [1/2]

template<class T >
albaID albaTimeMap< T >::FindItemIndex ( albaTimeStamp  t)

return index of the given item.

return -1 if not found.

Definition at line 476 of file albaTimeMapUX.h.

◆ GetItem() [1/2]

template<class T >
T * albaTimeMap< T >::GetItem ( albaTimeStamp  t)

find and return item corresponding to timestamp t.

return NULL if not found.

Definition at line 494 of file albaTimeMapUX.h.

◆ GetNearestItem() [1/2]

template<class T >
T * albaTimeMap< T >::GetNearestItem ( albaTimeStamp  t)

Return the pointer to the item with timestamp nearest the given one.

NULL is returned if not found.

Definition at line 502 of file albaTimeMapUX.h.

◆ GetItemBefore() [1/2]

template<class T >
T * albaTimeMap< T >::GetItemBefore ( albaTimeStamp  t)

Return the pointer to the item with timestamp nearest the given one.

NULL is returned if not found.

Definition at line 510 of file albaTimeMapUX.h.

◆ GetItemByIndex() [1/2]

template<class T >
T * albaTimeMap< T >::GetItemByIndex ( int  idx)

return the item with given its order index.

NULL is returned if not found.

Definition at line 485 of file albaTimeMapUX.h.

◆ Print() [1/2]

template<class T >
void albaTimeMap< T >::Print ( std::ostream &  os,
const int  indent = 0 
) const
virtual

print debug information for this object

Reimplemented from albaObject.

Definition at line 431 of file albaTimeMapUX.h.

◆ Begin() [1/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::Begin ( )
inline

Definition at line 158 of file albaTimeMapUX.h.

Referenced by albaTimeMap< T >::DeepCopy().

◆ End() [1/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::End ( )
inline

Definition at line 159 of file albaTimeMapUX.h.

Referenced by albaTimeMap< T >::DeepCopy().

◆ Last() [1/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::Last ( )
inline

Definition at line 160 of file albaTimeMapUX.h.

◆ operator=() [2/2]

template<class T >
void albaTimeMap< T >::operator= ( const albaTimeMap< T > &  )
inline

Definition at line 59 of file albaTimeMapWIN.h.

◆ SetItemTypeName() [2/2]

template<class T >
void albaTimeMap< T >::SetItemTypeName ( const char *  tname)
inline

set the TypeName of the kind of item accepted by this container

Definition at line 64 of file albaTimeMapWIN.h.

References albaTimeMap< T >::m_ItemTypeName.

◆ GetItemTypeName() [2/2]

template<class T >
const char * albaTimeMap< T >::GetItemTypeName ( )
inline

Definition at line 65 of file albaTimeMapWIN.h.

References albaTimeMap< T >::m_ItemTypeName.

◆ AppendItem() [2/2]

template<class T >
virtual void albaTimeMap< T >::AppendItem ( T *  m)
virtual

Insert an item to the vector trying to append it, anyway the array is kept sorted.

◆ AppendAndSetItem() [2/2]

template<class T >
virtual void albaTimeMap< T >::AppendAndSetItem ( T *  m)
virtual

append item setting its timestamp to the highest one + 1

◆ PrependItem() [2/2]

template<class T >
virtual void albaTimeMap< T >::PrependItem ( T *  m)
virtual

Insert an item to the vector trying to prepend it, anyway the array is kept sorted.

Item's timestamp must be >=0

◆ FindItem() [3/4]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::FindItem ( T *  m)

Find an item index given its pointer.

◆ InsertItem() [2/2]

template<class T >
virtual void albaTimeMap< T >::InsertItem ( T *  m)
virtual

Set the item for a specified time.

If no item with the same time exist the item is inserted in the vector. If an item with the same time exist, it's simply substituted with the new one. The item is always references and not copied. This function also automatically call the UpdateData() member function.

◆ RemoveItem() [3/4]

template<class T >
virtual void albaTimeMap< T >::RemoveItem ( typename albaTimeMap< T >::TimeMap::iterator  it)
virtual

Remove an item given its iterator.

◆ RemoveItem() [4/4]

template<class T >
int albaTimeMap< T >::RemoveItem ( int  idx)

Remove an item given its index.

◆ RemoveAllItems() [2/2]

template<class T >
virtual void albaTimeMap< T >::RemoveAllItems ( )
virtual

Remove all the items.

◆ GetItemTime() [2/2]

template<class T >
albaTimeStamp albaTimeMap< T >::GetItemTime ( int  idx)

Return the timestamp of the i-th item.

◆ GetTimeStamps() [2/2]

template<class T >
void albaTimeMap< T >::GetTimeStamps ( mmuTimeVector kframes) const

Return the list of timestamp of the key matrixes in the given vector.

◆ GetNumberOfItems() [2/2]

template<class T >
int albaTimeMap< T >::GetNumberOfItems ( ) const
inline

Return the number of ITEMS stored in this object.

Definition at line 106 of file albaTimeMapWIN.h.

References albaTimeMap< T >::m_TimeMap.

◆ GetTimeBounds() [2/2]

template<class T >
void albaTimeMap< T >::GetTimeBounds ( albaTimeStamp  tbounds[2])

Set/Get the Current time for this object.

Return the time bounds for this vector, i.e. minimum and maximum time stamps

◆ DeepCopy() [2/2]

template<class T >
void albaTimeMap< T >::DeepCopy ( albaTimeMap< T > *  vitem)

Copy data from another array.

◆ Equals() [2/2]

template<class T >
bool albaTimeMap< T >::Equals ( albaTimeMap< T > *  vmat)

Compare two different arrays for equality.

They are considered equivalent if their key matrixes are equivalent.

◆ FindNearestItem() [2/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::FindNearestItem ( albaTimeStamp  t)

Find the item with the timestamp nearest to t.

◆ FindItemBefore() [2/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::FindItemBefore ( albaTimeStamp  t)

Find the item with timestamp <=t.

◆ FindItem() [4/4]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::FindItem ( albaTimeStamp  t)

Find the item with the timestamp==t.

Returns the item index, and set "item" to its pointer. Return -1 and NULL if not found. not

◆ FindItemByIndex() [2/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::FindItemByIndex ( int  idx)

return iterator of item with given index

◆ FindItemIndex() [2/2]

template<class T >
albaID albaTimeMap< T >::FindItemIndex ( albaTimeStamp  t)

return index of the given item.

return -1 if not found.

◆ GetItem() [2/2]

template<class T >
T * albaTimeMap< T >::GetItem ( albaTimeStamp  t)

find and return item corresponding to timestamp t.

return NULL if not found.

◆ GetNearestItem() [2/2]

template<class T >
T * albaTimeMap< T >::GetNearestItem ( albaTimeStamp  t)

Return the pointer to the item with timestamp nearest the given one.

NULL is returned if not found.

◆ GetItemBefore() [2/2]

template<class T >
T * albaTimeMap< T >::GetItemBefore ( albaTimeStamp  t)

Return the pointer to the item with timestamp nearest the given one.

NULL is returned if not found.

◆ GetItemByIndex() [2/2]

template<class T >
T * albaTimeMap< T >::GetItemByIndex ( int  idx)

return the item with given its order index.

NULL is returned if not found.

◆ Print() [2/2]

template<class T >
virtual void albaTimeMap< T >::Print ( std::ostream &  os,
const int  indent = 0 
) const
virtual

print debug information for this object

Reimplemented from albaObject.

◆ Begin() [2/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::Begin ( )
inline

Definition at line 159 of file albaTimeMapWIN.h.

References albaTimeMap< T >::m_TimeMap.

◆ End() [2/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::End ( )
inline

Definition at line 160 of file albaTimeMapWIN.h.

References albaTimeMap< T >::m_TimeMap.

◆ Last() [2/2]

template<class T >
albaTimeMap< T >::TimeMap::iterator albaTimeMap< T >::Last ( )
inline

Definition at line 161 of file albaTimeMapWIN.h.

References albaTimeMap< T >::m_TimeMap.

Member Data Documentation

◆ m_TimeMap

template<class T >
TimeMap albaTimeMap< T >::m_TimeMap
protected

◆ m_ItemTypeName

template<class T >
albaString albaTimeMap< T >::m_ItemTypeName
protected

the name of the item type accepted by this container

Definition at line 164 of file albaTimeMapUX.h.

Referenced by albaTimeMap< T >::GetItemTypeName(), and albaTimeMap< T >::SetItemTypeName().


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