Ted Ross wrote:
Alan Conway wrote:
Public classes should fall into one of the following 3 categories:
Handle: handle to refcounted object (e.g. Connection, Session)
- pure pointer to impl (PIMPL) idiom: no data except impl pointer, no
virtual functions, no inlines.
- qpid::client::Handle provides common base class
- defined in client lib, namespace ::qpid::client
Could you go into a little more detail on this pattern? I'm
particularly interested in the lifecycle of the handle objects and how
the ref counts are maintained.
Thanks,
-Ted
It uses refcounts as per boost::intrusive_ptr, but this is not exposed in the
public header files.
For an example see qpid/client/Subscription.h. The public header includes
qpid/client/Handle.h, Subscription.cpp includes qpid/client/HandlePrivate.h.
This pattern is useful for public API, but it's tedious & error prone to write
all the forwarding functions so I wouldn't recommend it for use on non-API code,
a qpid::RefCounted and boost::intrusive_ptr will do the job there.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]