void fetchPrev(SpanItr &s){ if(s-- == spans.begin()) { uint64_t prvInterval=prevInterval(s->first, timeUnit); s=spans.insert(std::pair<int64_t,spanView*>(prvInterval, new spanView(this, prvInterval, s->first))).first; } };
SpanItr fetchSpan(int64_t idx){ SpanItr ret=spans.find(idx); if(ret!=spans.end()) return ret; spans.insert(std::pair<int64_t,spanView*>(idx, new spanView(this, idx, nextInterval(idx,timeUnit)))).first; };
void fetchNext(SpanItr &s){ if(++s==spans.end()) { uint64_t nxtInterval=nextInterval(s->first, timeUnit); s=spans.insert(std::pair<int64_t,spanView*>(nxtInterval, new spanView(this, s->first,nxtInterval))).first; } };
// The 'move' commands fetch spans as needed then set leftMostSpan and backLeft. void moveTo(uint64_t idx){ SpanItr ret=spans.find(idx); if(ret!=spans.end()) leftMostSpan=ret; else leftMostSpan=spans.insert(std::pair<int64_t,spanView*>(idx, new spanView(this, idx, nextInterval(idx,timeUnit)))).first; backLeft=0; };