diff options
| author | Gordon Sim <gsim@apache.org> | 2007-10-04 12:01:28 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-10-04 12:01:28 +0000 |
| commit | 44c50b719e5685bd7a25cdeb9c5c9202ed8dc29a (patch) | |
| tree | 0227574c78bff90a747c573393616b17ecddfccf /cpp/src/qpid/framing/SequenceNumberSet.h | |
| parent | 3263908aff26ae784d0399b03d869bfc1b035ebd (diff) | |
| download | qpid-python-44c50b719e5685bd7a25cdeb9c5c9202ed8dc29a.tar.gz | |
Fix (and refactor) processing of ranges in message handler.
Alter release() to push released messages onto head in reverse order (todo: make this atomic instead)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@581869 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/framing/SequenceNumberSet.h')
| -rw-r--r-- | cpp/src/qpid/framing/SequenceNumberSet.h | 16 |
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 |
