summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/framing/SequenceNumberSet.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/framing/SequenceNumberSet.h')
-rw-r--r--cpp/src/qpid/framing/SequenceNumberSet.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/cpp/src/qpid/framing/SequenceNumberSet.h b/cpp/src/qpid/framing/SequenceNumberSet.h
index 7643d68071..f9d0cc1fd4 100644
--- a/cpp/src/qpid/framing/SequenceNumberSet.h
+++ b/cpp/src/qpid/framing/SequenceNumberSet.h
@@ -26,6 +26,7 @@
#include "amqp_types.h"
#include "Buffer.h"
#include "SequenceNumber.h"
+#include "qpid/framing/reply_exceptions.h"
namespace qpid {
namespace framing {
@@ -41,9 +42,24 @@ public:
uint32_t encodedSize() const;
SequenceNumberSet condense() const;
+ template <class T>
+ void processRanges(T t) const
+ {
+ if (size() % 2) { //must be even number
+ throw InvalidArgumentException("SequenceNumberSet contains odd number of elements");
+ }
+
+ for (SequenceNumberSet::const_iterator i = begin(); i != end(); i++) {
+ SequenceNumber first = i->getValue();
+ SequenceNumber last = (++i)->getValue();
+ t(first, last);
+ }
+ }
+
friend std::ostream& operator<<(std::ostream&, const SequenceNumberSet&);
};
+
}} // namespace qpid::framing