16#ifndef __albaTimeMapScalar_h
17#define __albaTimeMapScalar_h
20#define ALBA_SCALAR_MIN -1.0e+299
21#define ALBA_SCALAR_MAX 1.0e+299
150 virtual void Print(std::ostream& os,
const int tabs=0)
const;
184 m_TimeMap.insert(m_TimeMap.end(), mmuTimePairScalars(t, m));
193 m_TimeMap.insert(m_TimeMap.begin(),mmuTimePairScalars(t, m));
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())
353 if (m_TimeMap.size() > 0)
356 if (it == m_TimeMap.end() || it != m_TimeMap.begin() && it->first > t)
363 return m_TimeMap.end();
372 return m_TimeMap.find(t);
387 return m_TimeMap.end();
396 os << indent <<
"Number of Items:" << GetNumberOfItems() <<
"\n";
398 os << indent <<
"Time Stamps: {";
399 GetTimeStamps(tvector);
400 for (
unsigned int i = 0; i < tvector.size(); i++)
416 return (it != m_TimeMap.end()) ? it->first : -1;
424 if ((
unsigned int)idx < m_TimeMap.size() && idx >= 0)
427 std::advance(it, idx);
431 return m_TimeMap.end();
440 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.
albaString - performs common string operations on c-strings.
a dynamic associative sorted array of scalars indexed by their "timestamp".
virtual void Print(std::ostream &os, const int tabs=0) const
print debug information for this object
virtual void InsertItem(albaTimeStamp t, T m)
Set the item for a specified time.
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.
int RemoveItem(int idx)
Remove an item given its index.
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.
virtual void PrependItem(albaTimeStamp t, T m)
Insert an item to the vector trying to prepend it, anyway the array is kept sorted.
virtual ~albaTimeMapScalar()
T GetItemByIndex(int idx)
return the item with given its order index.
virtual void RemoveItem(typename albaTimeMapScalar< T >::TimeMapScalars::iterator it)
Remove an item given its iterator.
T GetNearestItem(albaTimeStamp t)
Return the pointer to the item with timestamp nearest the given one.
albaTimeMapScalar(const albaTimeMapScalar< T > &)
virtual void AppendItem(albaTimeStamp t, T m)
Insert an item to the vector trying to append it, anyway the array is kept sorted.
virtual void RemoveAllItems()
Remove all the items.
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...