summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing/SequenceNumberSet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/framing/SequenceNumberSet.cpp')
-rw-r--r--cpp/src/qpid/framing/SequenceNumberSet.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/cpp/src/qpid/framing/SequenceNumberSet.cpp b/cpp/src/qpid/framing/SequenceNumberSet.cpp
index 357b5dabd7..3bee5fb09a 100644
--- a/cpp/src/qpid/framing/SequenceNumberSet.cpp
+++ b/cpp/src/qpid/framing/SequenceNumberSet.cpp
@@ -44,6 +44,22 @@ uint32_t SequenceNumberSet::encodedSize() const
return 2 /*count*/ + (size() * 4);
}
+SequenceNumberSet SequenceNumberSet::condense() const
+{
+ SequenceNumberSet result;
+ const_iterator last = end();
+ for (const_iterator i = begin(); i != end(); i++) {
+ if (last == end()) {
+ last = i;
+ } else if (*i - *last > 1) {
+ result.push_back(*last);
+ result.push_back(*i);
+ last = end();
+ }
+ }
+ return result;
+}
+
namespace qpid{
namespace framing{