Refactoring

* Rewriting Timeline<T> to be sparse, i.e., allow gaps
* Added specialized subclasses BoundedTimeline<T> and ContinuousTimeline<T>
* Timed<T> and TimeRange: has-a, not is-a
* Introducing Timed<void>
This commit is contained in:
Daniel Wolf
2016-05-02 20:31:59 +02:00
parent 9eef09145e
commit 2f31c5aa61
23 changed files with 784 additions and 243 deletions

View File

@@ -4,6 +4,11 @@
using time_type = TimeRange::time_type;
TimeRange TimeRange::zero() {
static TimeRange zero(time_type::zero(), time_type::zero());
return zero;
}
TimeRange::TimeRange(time_type start, time_type end) :
start(start),
end(end)
@@ -23,6 +28,10 @@ time_type TimeRange::getLength() const {
return end - start;
}
bool TimeRange::empty() const {
return start == end;
}
void TimeRange::resize(const TimeRange& newRange) {
start = newRange.start;
end = newRange.end;