diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-03-03 12:29:53 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-03-10 13:05:29 +0900 |
commit | 22ea325ef03cdc15f2c36b1e0c82c84dec01cfb5 (patch) | |
tree | f75509dca94447ce65aec5763c0e89a98f63f70a /state.h | |
parent | c8d31ab28db19a7e1f1ca9cf1a35de17158c43fb (diff) | |
download | libquotient-22ea325ef03cdc15f2c36b1e0c82c84dec01cfb5.tar.gz libquotient-22ea325ef03cdc15f2c36b1e0c82c84dec01cfb5.zip |
Use special indices instead of iterators for persistent pointers into timeline + no more discarding read markers to events that haven't arrived yet
When using deque::const_reverse_iterator for read markers and eventsIndex, I didn't realise that insertions into std::deque invalidate iterators (though preserve references and pointers). Therefore, a small TimelineItem class has been introduced that stores an event together with a persistent index that is generated upon insertion into the timeline (timeline.back()+1 for newer events, timeline.front()-1 for older events). Using such indices, we can still reach an event by it's index in constant time, while avoiding a problem with invalidating iterators.
While rewriting the code, another problem has been detected with read markers to events that haven't yet arrived to the timeline (in particular, older events). The old code simply discarded such read markers. The new code stores such read markers anyway, so that when that event arrives, it could be matched against the stored last-read-event id.
Diffstat (limited to 'state.h')
0 files changed, 0 insertions, 0 deletions