summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qmf/engine/ObjectIdImpl.cpp51
-rw-r--r--qpid/cpp/src/qmf/engine/ObjectIdImpl.h16
2 files changed, 49 insertions, 18 deletions
diff --git a/qpid/cpp/src/qmf/engine/ObjectIdImpl.cpp b/qpid/cpp/src/qmf/engine/ObjectIdImpl.cpp
index b08ae2756c..76db6d91f9 100644
--- a/qpid/cpp/src/qmf/engine/ObjectIdImpl.cpp
+++ b/qpid/cpp/src/qmf/engine/ObjectIdImpl.cpp
@@ -24,7 +24,6 @@ using namespace std;
using namespace qmf::engine;
using qpid::framing::Buffer;
-
void AgentAttachment::setBanks(uint32_t broker, uint32_t agent)
{
first =
@@ -121,25 +120,57 @@ const string& ObjectIdImpl::asString() const
return repr;
}
-bool ObjectIdImpl::operator==(const ObjectIdImpl& other) const
+#define ACTUAL_FIRST (agent == 0 ? first : first | agent->first)
+#define ACTUAL_OTHER (other.agent == 0 ? other.first : other.first | other.agent->first)
+
+uint8_t ObjectIdImpl::getFlags() const
{
- uint64_t otherFirst = agent == 0 ? other.first : other.first & 0xffff000000000000LL;
+ return (ACTUAL_FIRST & 0xF000000000000000LL) >> 60;
+}
- return first == otherFirst && second == other.second;
+uint16_t ObjectIdImpl::getSequence() const
+{
+ return (ACTUAL_FIRST & 0x0FFF000000000000LL) >> 48;
}
-bool ObjectIdImpl::operator<(const ObjectIdImpl& other) const
+uint32_t ObjectIdImpl::getBrokerBank() const
{
- uint64_t otherFirst = agent == 0 ? other.first : other.first & 0xffff000000000000LL;
+ return (ACTUAL_FIRST & 0x0000FFFFF0000000LL) >> 28;
+}
- return (first < otherFirst) || ((first == otherFirst) && (second < other.second));
+uint32_t ObjectIdImpl::getAgentBank() const
+{
+ return ACTUAL_FIRST & 0x000000000FFFFFFFLL;
}
-bool ObjectIdImpl::operator>(const ObjectIdImpl& other) const
+uint64_t ObjectIdImpl::getObjectNum() const
+{
+ return second;
+}
+
+uint32_t ObjectIdImpl::getObjectNumHi() const
+{
+ return (uint32_t) (second >> 32);
+}
+
+uint32_t ObjectIdImpl::getObjectNumLo() const
{
- uint64_t otherFirst = agent == 0 ? other.first : other.first & 0xffff000000000000LL;
+ return (uint32_t) (second & 0x00000000FFFFFFFFLL);
+}
+
+bool ObjectIdImpl::operator==(const ObjectIdImpl& other) const
+{
+ return ACTUAL_FIRST == ACTUAL_OTHER && second == other.second;
+}
- return (first > otherFirst) || ((first == otherFirst) && (second > other.second));
+bool ObjectIdImpl::operator<(const ObjectIdImpl& other) const
+{
+ return (ACTUAL_FIRST < ACTUAL_OTHER) || ((ACTUAL_FIRST == ACTUAL_OTHER) && (second < other.second));
+}
+
+bool ObjectIdImpl::operator>(const ObjectIdImpl& other) const
+{
+ return (ACTUAL_FIRST > ACTUAL_OTHER) || ((ACTUAL_FIRST == ACTUAL_OTHER) && (second > other.second));
}
diff --git a/qpid/cpp/src/qmf/engine/ObjectIdImpl.h b/qpid/cpp/src/qmf/engine/ObjectIdImpl.h
index d9871ac217..d70c8efff4 100644
--- a/qpid/cpp/src/qmf/engine/ObjectIdImpl.h
+++ b/qpid/cpp/src/qmf/engine/ObjectIdImpl.h
@@ -51,15 +51,15 @@ namespace engine {
void encode(qpid::framing::Buffer& buffer) const;
void fromString(const std::string& repr);
const std::string& asString() const;
- uint8_t getFlags() const { return (first & 0xF000000000000000LL) >> 60; }
- uint16_t getSequence() const { return (first & 0x0FFF000000000000LL) >> 48; }
- uint32_t getBrokerBank() const { return (first & 0x0000FFFFF0000000LL) >> 28; }
- uint32_t getAgentBank() const { return first & 0x000000000FFFFFFFLL; }
- uint64_t getObjectNum() const { return second; }
- uint32_t getObjectNumHi() const { return (uint32_t) (second >> 32); }
- uint32_t getObjectNumLo() const { return (uint32_t) (second & 0x00000000FFFFFFFFLL); }
+ uint8_t getFlags() const;
+ uint16_t getSequence() const;
+ uint32_t getBrokerBank() const;
+ uint32_t getAgentBank() const;
+ uint64_t getObjectNum() const;
+ uint32_t getObjectNumHi() const;
+ uint32_t getObjectNumLo() const;
bool isDurable() const { return getSequence() == 0; }
- void setValue(uint64_t f, uint64_t s) { first = f; second = s; }
+ void setValue(uint64_t f, uint64_t s) { first = f; second = s; agent = 0; }
bool operator==(const ObjectIdImpl& other) const;
bool operator<(const ObjectIdImpl& other) const;