ALBA
mmuTimeSet.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: mmuTimeSet
5 Authors: Marco Petrone
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16#ifndef __mmuTimeSet_h
17#define __mmuTimeSet_h
18//----------------------------------------------------------------------------
19// includes :
20//----------------------------------------------------------------------------
21#include "albaUtility.h"
22#include "albaDefines.h"
23#include <set>
24#include <vector>
25#ifdef ALBA_EXPORTS
26#include "albaDllMacros.h"
28#endif
29//------------------------------------------------------------------------------
30// Forward declarations
31//------------------------------------------------------------------------------
32typedef std::vector<albaTimeStamp> mmuTimeVector;
33
34//------------------------------------------------------------------------------
35// mmuTimeSet
36//------------------------------------------------------------------------------
42class ALBA_EXPORT mmuTimeSet: public albaUtility
43{
44public:
46 virtual ~mmuTimeSet();
47
48// albaTypeMacro(mmuTimeSet,albaUtility);
49
52
55
56 bool operator==(const mmuTimeSet &o);
57
58 typedef std::set<albaTimeStamp> TSet;
59 typedef std::set<albaTimeStamp>::iterator Iterator;
60
63
69
75
77 void Remove(Iterator ts);
78
80 void Clear() {m_TSet.clear();}
81
83 TSet &GetTSet() {return m_TSet;}
84
86 const TSet &GetConstTSet() const{return m_TSet;}
87
90
93
96
99
104
109
114
116 static void Merge(const mmuTimeSet &v1,const mmuTimeSet &v2,mmuTimeSet &outv);
117
119 void Merge(const mmuTimeSet &v);
120
122 static void Merge(const std::vector<albaTimeStamp> &v1,const std::vector<albaTimeStamp> &v2,std::vector<albaTimeStamp> &outv);
123
125 void Merge(const std::vector<albaTimeStamp> &v);
126
129
131 Iterator Begin() {return m_TSet.begin();}
133 Iterator End() {return m_TSet.end();}
134
135
136protected:
138};
139
140#endif /* __mmuTimeSet_h */
long albaID
type for IDs inside ALBA
Definition: albaDefines.h:58
double albaTimeStamp
type for time varying data timestamps (not for pipelines timestamps!)
Definition: albaDefines.h:57
#define EXPORT_STL_VECTOR(declspec_, T_)
Definition: albaDllMacros.h:84
albaUtility - the pourpose of this class is just to groups utilities classes
Definition: albaUtility.h:27
class wrapping an STL "set" of albaTimeStamps providing API to query and merge.
Definition: mmuTimeSet.h:43
albaID FindTimeStampIndex(albaTimeStamp t)
return index of the given timestamp.
void Remove(Iterator ts)
remove timestamp from the set
void Insert(albaTimeStamp t)
insert a timestamp in the set
albaTimeStamp GetNearestTimeStamp(albaTimeStamp t)
Return the timestamp with value clsest to t.
Iterator FindTimeStamp(albaTimeStamp t)
Return the iterator pointing to the item with value "t".
TSet m_TSet
Definition: mmuTimeSet.h:137
TSet & GetTSet()
return reference to inner TSet object
Definition: mmuTimeSet.h:83
albaTimeStamp GetTimeStampBefore(albaTimeStamp t)
Return timestamp with value <= t.
static void Merge(const mmuTimeSet &v1, const mmuTimeSet &v2, mmuTimeSet &outv)
Merge two different time-stamps sets.
static void Merge(const std::vector< albaTimeStamp > &v1, const std::vector< albaTimeStamp > &v2, std::vector< albaTimeStamp > &outv)
Merge two different time-stamps vectors.
Iterator FindNearestTimeStamp(albaTimeStamp t)
Return the iterator pointing to the item with value "t".
const TSet & GetConstTSet() const
use this in case you have a to access the TSet of a const mmuTimeSet
Definition: mmuTimeSet.h:86
virtual ~mmuTimeSet()
void Clear()
remove all items from the internal time set
Definition: mmuTimeSet.h:80
void Append(albaTimeStamp t)
insert a timestamp forcing insertion point search to start from the end of the set.
void Merge(const std::vector< albaTimeStamp > &v)
Merge a time-stamps vector into this set.
std::set< albaTimeStamp >::iterator Iterator
Definition: mmuTimeSet.h:59
mmuTimeSet & operator=(const mmuTimeSet &o)
assign operator, to copy set value from another set
mmuTimeSet(const mmuTimeSet &c)
copy constructor, this makes a copy of the set
std::set< albaTimeStamp > TSet
Definition: mmuTimeSet.h:58
albaTimeStamp GetByIndex(albaID idx)
Return the idx-th item of the set.
void Merge(const mmuTimeSet &v)
Merge a time-stamps set into this set.
Iterator FindTimeStampBefore(albaTimeStamp t)
Return the iterator pointing to the item with lower or equal to "t".
int GetNumberOfTimeStamps() const
return the number of time stamps
Iterator Begin()
return the first time stamp
Definition: mmuTimeSet.h:131
bool operator==(const mmuTimeSet &o)
void Prepend(albaTimeStamp t)
insert a timestamp forcing insertion point search to start from the start of the set.
Iterator End()
return the last+1 time stamp
Definition: mmuTimeSet.h:133
std::vector< albaTimeStamp > mmuTimeVector
Definition: mmuTimeSet.h:32