diff --git a/libs/temporal/range.cc b/libs/temporal/range.cc index 0ccfe5b83d..2663d32496 100644 --- a/libs/temporal/range.cc +++ b/libs/temporal/range.cc @@ -117,3 +117,18 @@ template<> OverlapType Temporal::coverage_exclusive_ends (int64_t sa, i /* convert end positions to inclusive */ return coverage_inclusive_ends (sa, eaE-1, sb, ebE-1); } + +std::ostream& +std::operator<< (std::ostream & o, RangeList const & rl) +{ + rl.dump (o); + return o; +} + +std::ostream& +std::operator<< (std::ostream & o, Range const & r) +{ + r.dump (o); + return o; +} + diff --git a/libs/temporal/temporal/range.h b/libs/temporal/temporal/range.h index 49af6fe1ca..95acf1298c 100644 --- a/libs/temporal/temporal/range.h +++ b/libs/temporal/temporal/range.h @@ -187,6 +187,10 @@ class LIBTEMPORAL_API Range { return Temporal::coverage_exclusive_ends (_start, _end, s, e); } + void dump (std::ostream& ostr) const { + ostr << "Range @ " << this << ' ' << _start << " .. " << _end; + } + private: timepos_t _start; ///< start of the range timepos_t _end; ///< end of the range (exclusive, see above) @@ -194,6 +198,15 @@ class LIBTEMPORAL_API Range { typedef Range TimeRange; +} + +namespace std { +LIBTEMPORAL_API std::ostream& operator<< (std::ostream & o, Temporal::Range const &); +} + +namespace Temporal { + + class LIBTEMPORAL_API RangeList { public: RangeList () : _dirty (false) {} @@ -239,6 +252,13 @@ public: _dirty = false; } + void dump (std::ostream& ostr) const { + ostr << "RangeList @ " << this << std::endl; + for (auto const & r : _list) { + ostr << r << std::endl; + } + } + private: List _list; @@ -255,4 +275,9 @@ struct LIBTEMPORAL_API RangeMove { } +namespace std { +LIBTEMPORAL_API std::ostream& operator<< (std::ostream & o, Temporal::RangeList const &); +} + + #endif /* __libtemporal_range_hpp__ */