(
unsigneddiscr_factor, time_t tm);
84 void ReInit(time_t tm = 0);
93 void AddObject(time_t tm,
unsignedobject_id);
100 bool RemoveObject(time_t object_time,
unsignedobject_id);
106 void MoveObject(time_t old_time, time_t new_time,
unsignedobject_id);
137 #define TIMELINE_ITERATE(Var, Cont) \ 138 for ( typename TTimeLine::iterator Var = (Cont).begin(); Var != (Cont).end(); ++Var ) 140 #define TIMELINE_CONST_ITERATE(Var, Cont) \ 141 for ( typename TTimeLine::const_iterator Var = (Cont).begin(); Var != (Cont).end(); ++Var ) 145: m_DiscrFactor(discr_factor)
171m_TimeLine.resize(0);
172m_TimeLineHead = (tm / m_DiscrFactor) * m_DiscrFactor;
173m_TimeLine.push_back(0);
180 if(object_time < m_TimeLineHead) {
181object_time = m_TimeLineHead;
184 unsignedslot = x_TimeLineSlot(object_time);
185x_AddObjectToSlot(slot, object_id);
198 while(slot >= m_TimeLine.size()) {
199m_TimeLine.push_back(0);
207m_TimeLine[slot] = bv;
216 if(object_time < m_TimeLineHead) {
219 unsignedslot = x_TimeLineSlot(object_time);
220 if(slot < m_TimeLine.size()) {
225 boolchanged = bv->set_bit(object_id,
false);
240 boolchanged = bv->set_bit(object_id,
false);
264 boolremoved = RemoveObject(old_time, object_id);
266RemoveObject(object_id);
268AddObject(new_time, object_id);
277 if(tm <= m_TimeLineHead)
280 unsignedinterval_head = (unsigned)((tm / m_DiscrFactor) * m_DiscrFactor);
281 unsigneddiff = (unsigned)(interval_head - m_TimeLineHead);
282 returndiff / m_DiscrFactor;
291 unsignedslot = x_TimeLineSlot(tm);
292 for(
unsigned i= 0;
i< slot; ++
i) {
293 if(m_TimeLine.size() == 0) {
302m_TimeLine.pop_front();
304m_TimeLineHead = m_TimeLineHead + slot * m_DiscrFactor;
Constants, lookup tables and typedefs.
Timeline class for fast approximate time tracking.
void MoveObject(time_t old_time, time_t new_time, unsigned object_id)
Move object from one time slot to another.
void AddObject(time_t tm, unsigned object_id)
Add object to the timeline.
CTimeLine(unsigned discr_factor, time_t tm)
void AddObjects(time_t tm, const TBitVector &objects)
deque< TBitVector * > TTimeLine
bool RemoveObject(time_t object_time, unsigned object_id)
Remove object from the time line, object_time defines time slot.
void EnumerateObjects(TBitVector *objects) const
Enumerate all objects registered in the timeline.
void ExtractObjects(time_t tm, TBitVector *objects)
Extracts all objects up to 'tm' and puts them into 'objects' vector.
CTimeLine(const CTimeLine &)
time_t GetHead() const
Return head of the timeline.
unsigned x_TimeLineSlot(time_t tm) const
Compute slot position in the timeline.
void x_AddObjectToSlot(unsigned time_slot, unsigned object_id)
Add object to the timeline using time slot.
CTimeLine & operator=(const CTimeLine &)
unsigned GetDiscrFactor() const
Time discretization factor.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
@ BM_GAP
GAP compression is ON.
Defines: CTimeFormat - storage class for time format.
#define TIMELINE_CONST_ITERATE(Var, Cont)
#define TIMELINE_ITERATE(Var, Cont)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4