SharedPtr< T > Class Template Reference

A threadsafe, reference-counting smart pointer. More...

#include <SharedPtr.h++>

List of all members.

Public Member Functions

 SharedPtr (T *object=NULL)
 Construct a new SharedPtr for the given object pointer.
 SharedPtr (const SharedPtr &other)
 Copy constructor.
 ~SharedPtr ()
 Destructor.
template<class U >
SharedPtr< U > staticCast ()
 Static cast.
template<class U >
SharedPtr< U > dynamicCast ()
 Dynamic cast.
SharedPtroperator= (const SharedPtr &other)
 Assignment operator.
SharedPtroperator= (T *object)
 Assignment operator.
T * operator-> () throw ()
 Pointer-to-member operator.
const T * operator-> () const throw ()
 Pointer-to-member operator.
T & operator* () throw (NullPointerException)
 Dereference operator.
const T & operator* () const throw (NullPointerException)
 Dereference operator.
T * get () const
 Get the value of the pointer.
bool operator! () const throw ()
 Test if the pointer is NULL.
 operator const void * () const throw ()
 Boolean test operator.
bool isNull () const throw ()
 Test if the pointer is NULL.
bool operator== (const SharedPtr &other) const
 Equality operator.
bool operator!= (const SharedPtr &other) const
 Inequality operator.
int getRefCount () const throw ()
 Get the reference count for this pointer.

Friends

class SharedPtr

Detailed Description

template<class T>
class ccxx::SharedPtr< T >

A threadsafe, reference-counting smart pointer.

See sections 13.6.3.1 and 25.7 of The C++ Programming Language.

Author:
Mark Lindner

Constructor & Destructor Documentation

SharedPtr ( T *  object = NULL  )  [inline]

Construct a new SharedPtr for the given object pointer.

SharedPtr ( const SharedPtr< T > &  other  )  [inline]

Copy constructor.

~SharedPtr (  )  [inline]

Destructor.


Member Function Documentation

SharedPtr<U> dynamicCast (  )  [inline]

Dynamic cast.

Performs a dynamic cast on the object held by this SharedPtr, and returns a new SharedPtr of the target type.

T* get (  )  const [inline]

Get the value of the pointer.

int getRefCount (  )  const throw () [inline]

Get the reference count for this pointer.

bool isNull (  )  const throw () [inline]

Test if the pointer is NULL.

operator const void * (  )  const throw () [inline]

Boolean test operator.

(Test if the pointer is non-NULL.)

bool operator! (  )  const throw () [inline]

Test if the pointer is NULL.

bool operator!= ( const SharedPtr< T > &  other  )  const [inline]

Inequality operator.

Compares the object pointers.

const T& operator* (  )  const throw (NullPointerException) [inline]

Dereference operator.

Exceptions:
NullPointerException If this pointer is NULL.
T& operator* (  )  throw (NullPointerException) [inline]

Dereference operator.

Exceptions:
NullPointerException If this pointer is NULL.
const T* operator-> (  )  const throw () [inline]

Pointer-to-member operator.

T* operator-> (  )  throw () [inline]

Pointer-to-member operator.

SharedPtr& operator= ( T *  object  )  [inline]

Assignment operator.

SharedPtr& operator= ( const SharedPtr< T > &  other  )  [inline]

Assignment operator.

bool operator== ( const SharedPtr< T > &  other  )  const [inline]

Equality operator.

Compares the object pointers.

SharedPtr<U> staticCast (  )  [inline]

Static cast.

Performs a static cast on the object held by this SharedPtr, and returns a new SharedPtr of the target type.


Friends And Related Function Documentation

friend class SharedPtr [friend]

The documentation for this class was generated from the following file:
Generated on Sat Nov 26 16:49:09 2011 for libcommonc++ by  doxygen 1.6.3