diff options
Diffstat (limited to 'cpp/src/qpid/management/ManagementObject.cpp')
-rw-r--r-- | cpp/src/qpid/management/ManagementObject.cpp | 74 |
1 files changed, 72 insertions, 2 deletions
diff --git a/cpp/src/qpid/management/ManagementObject.cpp b/cpp/src/qpid/management/ManagementObject.cpp index 74d9571d10..e0386ee057 100644 --- a/cpp/src/qpid/management/ManagementObject.cpp +++ b/cpp/src/qpid/management/ManagementObject.cpp @@ -28,6 +28,62 @@ using namespace qpid::framing; using namespace qpid::management; using namespace qpid::sys; +void AgentAttachment::setBanks(uint32_t broker, uint32_t bank) +{ + first = + ((uint64_t) (broker & 0x000fffff)) << 28 | + ((uint64_t) (bank & 0x0fffffff)); +} + +ObjectId::ObjectId(uint8_t flags, uint16_t seq, uint32_t broker, uint32_t bank, uint64_t object) + : agent(0) +{ + first = + ((uint64_t) (flags & 0x0f)) << 60 | + ((uint64_t) (seq & 0x0fff)) << 48 | + ((uint64_t) (broker & 0x000fffff)) << 28 | + ((uint64_t) (bank & 0x0fffffff)); + second = object; +} + +ObjectId::ObjectId(AgentAttachment* _agent, uint8_t flags, uint16_t seq, uint64_t object) + : agent(_agent) +{ + first = + ((uint64_t) (flags & 0x0f)) << 60 | + ((uint64_t) (seq & 0x0fff)) << 48; + second = object; +} + +bool ObjectId::operator==(const ObjectId &other) const +{ + uint64_t otherFirst = agent == 0 ? other.first : other.first & 0xffff000000000000LL; + + return first == otherFirst && second == other.second; +} + +bool ObjectId::operator<(const ObjectId &other) const +{ + uint64_t otherFirst = agent == 0 ? other.first : other.first & 0xffff000000000000LL; + + return (first < otherFirst) || ((first == otherFirst) && (second < other.second)); +} + +void ObjectId::encode(framing::Buffer& buffer) +{ + if (agent == 0) + buffer.putLongLong(first); + else + buffer.putLongLong(first | agent->first); + buffer.putLongLong(second); +} + +void ObjectId::decode(framing::Buffer& buffer) +{ + first = buffer.getLongLong(); + second = buffer.getLongLong(); +} + int ManagementObject::nextThreadIndex = 0; void ManagementObject::writeTimestamps (Buffer& buf) @@ -38,10 +94,10 @@ void ManagementObject::writeTimestamps (Buffer& buf) buf.putLongLong (uint64_t (Duration (now ()))); buf.putLongLong (createTime); buf.putLongLong (destroyTime); - buf.putLongLong (objectId); + objectId.encode(buf); } -void ManagementObject::setReference(uint64_t) {} +void ManagementObject::setReference(ObjectId) {} int ManagementObject::getThreadIndex() { static __thread int thisIndex = -1; @@ -54,3 +110,17 @@ int ManagementObject::getThreadIndex() { return thisIndex; } +Mutex& ManagementObject::getMutex() +{ + return agent->getMutex(); +} + +Buffer* ManagementObject::startEventLH() +{ + return agent->startEventLH(); +} + +void ManagementObject::finishEventLH(Buffer* buf) +{ + agent->finishEventLH(buf); +} |