diff options
| author | Gordon Sim <gsim@apache.org> | 2007-07-19 10:59:58 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-07-19 10:59:58 +0000 |
| commit | 888c0bfbb1731124e1c84775400fcdad7798920e (patch) | |
| tree | 6b560e8167b84976971d77a3bf87cf2e5553f0f8 /cpp/src/qpid | |
| parent | b87a1e9d27755e2f98792567c29a0625b92c8654 (diff) | |
| download | qpid-python-888c0bfbb1731124e1c84775400fcdad7798920e.tar.gz | |
Added difference operator to the sequence number
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@557570 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/framing/SequenceNumber.cpp | 11 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/SequenceNumber.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/cpp/src/qpid/framing/SequenceNumber.cpp b/cpp/src/qpid/framing/SequenceNumber.cpp index 9bba67d4ae..ea1a34b1cf 100644 --- a/cpp/src/qpid/framing/SequenceNumber.cpp +++ b/cpp/src/qpid/framing/SequenceNumber.cpp @@ -60,3 +60,14 @@ bool SequenceNumber::operator>(const SequenceNumber& other) const { return other < *this; } + +namespace qpid { +namespace framing { + +int32_t operator-(const SequenceNumber& a, const SequenceNumber& b) +{ + int32_t result = a.value - b.value; + return result; +} + +}} diff --git a/cpp/src/qpid/framing/SequenceNumber.h b/cpp/src/qpid/framing/SequenceNumber.h index 6d38084a25..bf9d133cef 100644 --- a/cpp/src/qpid/framing/SequenceNumber.h +++ b/cpp/src/qpid/framing/SequenceNumber.h @@ -32,6 +32,7 @@ namespace framing { class SequenceNumber { int32_t value; + public: SequenceNumber(); SequenceNumber(uint32_t v); @@ -43,6 +44,8 @@ class SequenceNumber bool operator<(const SequenceNumber& other) const; bool operator>(const SequenceNumber& other) const; uint32_t getValue() const { return (uint32_t) value; } + + friend int32_t operator-(const SequenceNumber& a, const SequenceNumber& b); }; }} // namespace qpid::framing |
