16#ifndef __albaTimeMapScalar_h
17#define __albaTimeMapScalar_h
19#define ALBA_SCALAR_MIN -1.0e+299
20#define ALBA_SCALAR_MAX 1.0e+299
92 int RemoveItem(
int idx);
95 virtual void RemoveAllItems();
148 T GetItemByIndex(
int idx);
150 virtual void Print(std::ostream& os,
const int tabs=0)
const;
211 if (m_TimeMap.size()>0)
213 tbounds[0]=m_TimeMap.begin()->first;
214 tbounds[1]=m_TimeMap.rbegin()->first;
232 kframes.push_back(it->first);
246 T new_item = it->second;
247 AppendItem(it->first, new_item);
265 for (it=m_TimeMap.begin(),it2=o->
m_TimeMap.begin();it!=m_TimeMap.end();it++,it2++)
292 if (it!=m_TimeMap.end())
323 lowIt = FindItemBefore(t);
324 upIt = m_TimeMap.lower_bound(t);
326 if(lowIt != m_TimeMap.end())
328 if(upIt != m_TimeMap.end())
330 if(fabs(lowIt->first - t) < fabs(upIt->first - t))
341 else if(upIt != m_TimeMap.end())
354 if (m_TimeMap.size()>0)
357 if (it==m_TimeMap.end()||it!=m_TimeMap.begin()&&it->first>t)
364 return m_TimeMap.end();
375 return m_TimeMap.find(t);
390 return m_TimeMap.end();
399 os << indent <<
"Number of Items:"<<GetNumberOfItems()<<
"\n";
401 os << indent <<
"Time Stamps: {";
402 GetTimeStamps(tvector);
403 for (
unsigned int i=0;i<tvector.size();i++)
419 return (it != m_TimeMap.end()) ? it->first : -1;
427 if ((
unsigned int)idx<m_TimeMap.size() && idx>=0)
430 std::advance(it,idx);
434 return m_TimeMap.end();
443 return it!=m_TimeMap.end()?std::distance(m_TimeMap.begin(),it):-1;
long albaID
type for IDs inside ALBA
double albaTimeStamp
type for time varying data timestamps (not for pipelines timestamps!)
std::vector< albaTimeStamp > mmuTimeVectorScalars
std::vector< albaTimeStamp > mmuTimeVectorScalars
albaIndent - a simple class to control print indentation.
Abstract superclass for all ALBA classes implementing RTTI APIs.
virtual void Print(std::ostream &os, const int indent=0) const
print debug information for this object
albaString - performs common string operations on c-strings.
a dynamic associative sorted array of scalars indexed by their "timestamp".
albaID FindItemIndex(albaTimeStamp t)
return index of the given item.
albaTimeMapScalar< T >::TimeMapScalars::iterator FindItemByValue(T m)
Find an item index given its pointer.
albaTimeMapScalar< T >::TimeMapScalars::iterator FindItemBefore(albaTimeStamp t)
Find the item with timestamp <=t.
void SetItemTypeName(const char *tname)
set the TypeName of the kind of item accepted by this container
albaTimeMapScalar< T >::TimeMapScalars::iterator FindItemByIndex(int idx)
return iterator of item with given index
bool Equals(albaTimeMapScalar *vmat)
Compare two different arrays for equality.
virtual void AppendItem(albaTimeStamp t, T m)
Insert an item to the vector trying to append it, anyway the array is kept sorted.
void GetTimeStamps(mmuTimeVectorScalars &kframes) const
Return the list of timestamp of the key scalars in the given vector.
void GetTimeBounds(albaTimeStamp tbounds[2])
Return the time bounds for this vector, i.e.
virtual void PrependItem(albaTimeStamp t, T m)
Insert an item to the vector trying to prepend it, anyway the array is kept sorted.
void DeepCopy(albaTimeMapScalar *vitem)
Copy data from another array.
T GetItem(albaTimeStamp t)
find and return item corresponding to timestamp t.
TimeMapScalars m_TimeMap
the set storing the scalars
virtual void Print(std::ostream &os, const int tabs=0) const
print debug information for this object
albaTimeMapScalar< T >::TimeMapScalars::iterator FindItem(albaTimeStamp t)
Find the item with the timestamp==t.
const char * GetItemTypeName()
virtual void RemoveItem(typename albaTimeMapScalar< T >::TimeMapScalars::iterator it)
Remove an item given its iterator.
albaTimeMapScalar< T >::TimeMapScalars::iterator EndScalarVector()
albaString m_ItemTypeName
the name of the item type accepted by this container
albaTimeStamp GetItemTime(int idx)
Return the timestamp of the i-th item.
albaTimeMapScalar< T >::TimeMapScalars::iterator LastScalarVector()
albaTimeMapScalar< T >::TimeMapScalars::iterator FindNearestItem(albaTimeStamp t)
Find the item with the timestamp nearest to t.
virtual ~albaTimeMapScalar()
virtual void InsertItem(albaTimeStamp t, T m)
Set the item for a specified time.
std::map< albaTimeStamp, T > TimeMapScalars
virtual void RemoveAllItems()
Remove all the items.
T GetItemByIndex(int idx)
return the item with given its order index.
T GetNearestItem(albaTimeStamp t)
Return the pointer to the item with timestamp nearest the given one.
albaTimeMapScalar(const albaTimeMapScalar< T > &)
albaTimeMapScalar< T >::TimeMapScalars::iterator BeginScalarVector()
std::pair< albaTimeStamp, T > mmuTimePairScalars
T GetItemBefore(albaTimeStamp t)
Return the pointer to the item with timestamp nearest the given one.
int GetNumberOfItems() const
Return the number of ITEMS stored in this object.
void operator=(const albaTimeMapScalar< T > &)
class acting as an interface for timestamped objects This object simply defines few methods for manag...