summaryrefslogtreecommitdiff
path: root/cpp/src/qmf/ObjectIdImpl.cpp
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2009-09-18 20:15:15 +0000
committerTed Ross <tross@apache.org>2009-09-18 20:15:15 +0000
commit1f0b2bfcb1f3e540d26985d859e1935706317524 (patch)
tree4b94f7e10b70dd8dbf235b0ad7a0fcd083200365 /cpp/src/qmf/ObjectIdImpl.cpp
parent7190e1994763e42d208b5e3f17edd53a0d48546a (diff)
downloadqpid-python-1f0b2bfcb1f3e540d26985d859e1935706317524.tar.gz
Refactored the QMF engine to adhere to the following rules regarding
the pimpl (Pointer to Implementation) pattern: 1) Impl classes have constructors matching the public constructors 2) Additional Impl constructors are accessed through a static factory function 3) All linkages to objects are to the public object 4) If a back-link (from Impl to public) is needed, the Impl class must be derived from boost::noncopyable 5) All public classes have non-default copy constructors that make a copy of the Impl class git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@816770 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qmf/ObjectIdImpl.cpp')
-rw-r--r--cpp/src/qmf/ObjectIdImpl.cpp80
1 files changed, 25 insertions, 55 deletions
diff --git a/cpp/src/qmf/ObjectIdImpl.cpp b/cpp/src/qmf/ObjectIdImpl.cpp
index c0618ccc49..b993c2dbdf 100644
--- a/cpp/src/qmf/ObjectIdImpl.cpp
+++ b/cpp/src/qmf/ObjectIdImpl.cpp
@@ -32,13 +32,12 @@ void AgentAttachment::setBanks(uint32_t broker, uint32_t agent)
((uint64_t) (agent & 0x0fffffff));
}
-ObjectIdImpl::ObjectIdImpl(Buffer& buffer) : envelope(new ObjectId(this)), agent(0)
+ObjectIdImpl::ObjectIdImpl(Buffer& buffer) : agent(0)
{
decode(buffer);
}
-ObjectIdImpl::ObjectIdImpl(AgentAttachment* a, uint8_t flags, uint16_t seq, uint64_t object) :
- envelope(new ObjectId(this)), agent(a)
+ObjectIdImpl::ObjectIdImpl(AgentAttachment* a, uint8_t flags, uint16_t seq, uint64_t object) : agent(a)
{
first =
((uint64_t) (flags & 0x0f)) << 60 |
@@ -46,6 +45,18 @@ ObjectIdImpl::ObjectIdImpl(AgentAttachment* a, uint8_t flags, uint16_t seq, uint
second = object;
}
+ObjectId* ObjectIdImpl::factory(Buffer& buffer)
+{
+ ObjectIdImpl* impl(new ObjectIdImpl(buffer));
+ return new ObjectId(impl);
+}
+
+ObjectId* ObjectIdImpl::factory(AgentAttachment* agent, uint8_t flags, uint16_t seq, uint64_t object)
+{
+ ObjectIdImpl* impl(new ObjectIdImpl(agent, flags, seq, object));
+ return new ObjectId(impl);
+}
+
void ObjectIdImpl::decode(Buffer& buffer)
{
first = buffer.getLongLong();
@@ -135,58 +146,17 @@ bool ObjectIdImpl::operator>(const ObjectIdImpl& other) const
// Wrappers
//==================================================================
-ObjectId::ObjectId() : impl(new ObjectIdImpl(this)) {}
-
+ObjectId::ObjectId() : impl(new ObjectIdImpl()) {}
ObjectId::ObjectId(const ObjectId& from) : impl(new ObjectIdImpl(*(from.impl))) {}
-
ObjectId::ObjectId(ObjectIdImpl* i) : impl(i) {}
+ObjectId::~ObjectId() { delete impl; }
+uint64_t ObjectId::getObjectNum() const { return impl->getObjectNum(); }
+uint32_t ObjectId::getObjectNumHi() const { return impl->getObjectNumHi(); }
+uint32_t ObjectId::getObjectNumLo() const { return impl->getObjectNumLo(); }
+bool ObjectId::isDurable() const { return impl->isDurable(); }
+bool ObjectId::operator==(const ObjectId& other) const { return *impl == *other.impl; }
+bool ObjectId::operator<(const ObjectId& other) const { return *impl < *other.impl; }
+bool ObjectId::operator>(const ObjectId& other) const { return *impl > *other.impl; }
+bool ObjectId::operator<=(const ObjectId& other) const { return !(*impl > *other.impl); }
+bool ObjectId::operator>=(const ObjectId& other) const { return !(*impl < *other.impl); }
-ObjectId::~ObjectId()
-{
- delete impl;
-}
-
-uint64_t ObjectId::getObjectNum() const
-{
- return impl->getObjectNum();
-}
-
-uint32_t ObjectId::getObjectNumHi() const
-{
- return impl->getObjectNumHi();
-}
-
-uint32_t ObjectId::getObjectNumLo() const
-{
- return impl->getObjectNumLo();
-}
-
-bool ObjectId::isDurable() const
-{
- return impl->isDurable();
-}
-
-bool ObjectId::operator==(const ObjectId& other) const
-{
- return *impl == *other.impl;
-}
-
-bool ObjectId::operator<(const ObjectId& other) const
-{
- return *impl < *other.impl;
-}
-
-bool ObjectId::operator>(const ObjectId& other) const
-{
- return *impl > *other.impl;
-}
-
-bool ObjectId::operator<=(const ObjectId& other) const
-{
- return !(*impl > *other.impl);
-}
-
-bool ObjectId::operator>=(const ObjectId& other) const
-{
- return !(*impl < *other.impl);
-}