From bdde5251d8592c69d3951aa5b5a01e59b62eb7a2 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Fri, 16 Jan 2009 20:07:47 +0000 Subject: QPID-1589 - Added equality/inequality operators to qpid::console::ObjectId. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@735114 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/console/ObjectId.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'cpp/src/qpid/console/ObjectId.cpp') diff --git a/cpp/src/qpid/console/ObjectId.cpp b/cpp/src/qpid/console/ObjectId.cpp index 25de9411f6..f8993e7e05 100644 --- a/cpp/src/qpid/console/ObjectId.cpp +++ b/cpp/src/qpid/console/ObjectId.cpp @@ -43,6 +43,44 @@ void ObjectId::encode(framing::Buffer& buffer) buffer.putLongLong(second); } +bool ObjectId::operator==(const ObjectId& other) const +{ + return second == other.second && first == other.first; +} + +bool ObjectId::operator!=(const ObjectId& other) const +{ + return !(*this == other); +} + +bool ObjectId::operator<(const ObjectId& other) const +{ + if (first < other.first) + return true; + if (first > other.first) + return false; + return second < other.second; +} + +bool ObjectId::operator>(const ObjectId& other) const +{ + if (first > other.first) + return true; + if (first < other.first) + return false; + return second > other.second; +} + +bool ObjectId::operator<=(const ObjectId& other) const +{ + return !(*this > other); +} + +bool ObjectId::operator>=(const ObjectId& other) const +{ + return !(*this < other); +} + ostream& qpid::console::operator<<(ostream& o, const ObjectId& id) { o << (int) id.getFlags() << "-" << id.getSequence() << "-" << id.getBrokerBank() << "-" << -- cgit v1.2.1