diff options
| author | Alan Conway <aconway@apache.org> | 2009-04-20 22:33:27 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2009-04-20 22:33:27 +0000 |
| commit | a123fa68f68c199faeef3134b2739049fca02ded (patch) | |
| tree | 64cee55378dfd8577e0f0494e20c38650b722116 /cpp/src/qpid/client/HandlePrivate.h | |
| parent | 4e20d749dbde6eabf6bbb78f2eb543af81db949c (diff) | |
| download | qpid-python-a123fa68f68c199faeef3134b2739049fca02ded.tar.gz | |
Apply PIMPL pattern to qpid::client::Message.
Hide implementation of Message, move framing::MethodContent and framing::TransferContent out of public API.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@766899 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/HandlePrivate.h')
| -rw-r--r-- | cpp/src/qpid/client/HandlePrivate.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cpp/src/qpid/client/HandlePrivate.h b/cpp/src/qpid/client/HandlePrivate.h index 488ce48075..46e4bff808 100644 --- a/cpp/src/qpid/client/HandlePrivate.h +++ b/cpp/src/qpid/client/HandlePrivate.h @@ -21,14 +21,16 @@ * under the License. * */ +#include "Handle.h" +#include "qpid/RefCounted.h" #include <algorithm> +#include <boost/intrusive_ptr.hpp> namespace qpid { namespace client { /** @file - * Private implementation of handle, include in .cpp file of handle - * subclasses _after_ including the declaration of class T. + * Implementation of handle, include in .cpp file of handle subclasses. * T can be any class that can be used with boost::intrusive_ptr. */ @@ -52,9 +54,13 @@ void Handle<T>::swap(Handle<T>& h) { std::swap(impl, h.impl); } template <class T> class HandlePrivate { public: - static boost::intrusive_ptr<T> get(Handle<T>& h) { return boost::intrusive_ptr<T>(h.impl); } + static boost::intrusive_ptr<T> get(const Handle<T>& h) { return boost::intrusive_ptr<T>(h.impl); } + static void set(Handle<T>& h, const boost::intrusive_ptr<T>& p) { Handle<T>(p.get()).swap(h); } }; +template<class T> boost::intrusive_ptr<T> handleGetPtr(Handle<T>& h) { return HandlePrivate<T>::get(h); } +template<class T> boost::intrusive_ptr<const T> handleGetPtr(const Handle<T>& h) { return HandlePrivate<T>::get(h); } +template<class T> void handleSetPtr(Handle<T>& h, const boost::intrusive_ptr<T>& p) { HandlePrivate<T>::set(h, p); } }} // namespace qpid::client |
