blocxx
Protected Member Functions | Private Attributes

BLOCXX_NAMESPACE::RefCountedPimpl< Impl > Class Template Reference

PURPOSE: Make it easy to define immutable classes or handle classes, making it inexpensive to copy them, while keeping implementation details out of the header file. More...

#include <RefCountedPimpl.hpp>

List of all members.

Protected Member Functions

 RefCountedPimpl ()
 RefCountedPimpl (Impl *p)
 RefCountedPimpl (IntrusiveCountableBase *p)
Impl * pimpl () const
bool null () const

Private Attributes

IntrusiveReference
< IntrusiveCountableBase
m_impl

Detailed Description

template<typename Impl>
class BLOCXX_NAMESPACE::RefCountedPimpl< Impl >

PURPOSE: Make it easy to define immutable classes or handle classes, making it inexpensive to copy them, while keeping implementation details out of the header file.

This is done by declaring

   class FooImpl;
   class Foo : private RefcountedPimpl<FooImpl>
   {
      ...
   };
 

and using pimpl() in Foo member functions to access the internal data. The Foo object is a wrapper around a reference-counted pointer to a FooImpl object.

Precondition:
Impl is derived from BloCxx::IntrusiveCountableBase.

Definition at line 64 of file RefCountedPimpl.hpp.


Constructor & Destructor Documentation

template<typename Impl >
BLOCXX_NAMESPACE::RefCountedPimpl< Impl >::RefCountedPimpl ( ) [inline, protected]
Postcondition:
Object holds null reference

Definition at line 79 of file RefCountedPimpl.hpp.

template<typename Impl >
BLOCXX_NAMESPACE::RefCountedPimpl< Impl >::RefCountedPimpl ( Impl *  p) [inline, protected]
Postcondition:
Object holds reference to *p.

Definition at line 86 of file RefCountedPimpl.hpp.

template<typename Impl >
BLOCXX_NAMESPACE::RefCountedPimpl< Impl >::RefCountedPimpl ( IntrusiveCountableBase p) [inline, protected]
Postcondition:
Object holds reference to *p.
Precondition:
The dynamic type of *p is Impl or a subclass of Impl.

Definition at line 94 of file RefCountedPimpl.hpp.


Member Function Documentation

template<typename Impl >
bool BLOCXX_NAMESPACE::RefCountedPimpl< Impl >::null ( ) const [inline, protected]
Returns:
True if and only if this object holds a null pointer.

Definition at line 108 of file RefCountedPimpl.hpp.

References BLOCXX_NAMESPACE::RefCountedPimpl< Impl >::m_impl.

template<typename Impl >
Impl* BLOCXX_NAMESPACE::RefCountedPimpl< Impl >::pimpl ( ) const [inline, protected]
Returns:
A pointer to the Impl object held by *this.

Definition at line 101 of file RefCountedPimpl.hpp.

References BLOCXX_NAMESPACE::IntrusiveReference< T >::getPtr(), and BLOCXX_NAMESPACE::RefCountedPimpl< Impl >::m_impl.


Member Data Documentation


The documentation for this class was generated from the following file: