diff options
Diffstat (limited to 'cpp/src/qpid/RangeSet.h')
-rw-r--r-- | cpp/src/qpid/RangeSet.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cpp/src/qpid/RangeSet.h b/cpp/src/qpid/RangeSet.h index af3b2223cd..2a88426f17 100644 --- a/cpp/src/qpid/RangeSet.h +++ b/cpp/src/qpid/RangeSet.h @@ -169,6 +169,9 @@ class RangeSet RangeIterator rangesEnd() const { return ranges.end(); } size_t rangesSize() const { return ranges.size(); } + // The difference between the start and end of this range set + uint32_t span() const; + bool empty() const { return ranges.empty(); } void clear() { ranges.clear(); } @@ -309,6 +312,11 @@ template <class T> Range<T> RangeSet<T>::rangeContaining(const T& t) const { return (i != ranges.end() && i->contains(t)) ? *i : Range<T>(t,t); } +template <class T> uint32_t RangeSet<T>::span() const { + if (ranges.empty()) return 0; + return ranges.back().last() - ranges.front().first(); +} + } // namespace qpid |