#include <TCSharedPtr.h>

Public Types | |
| typedef T | ValueType |
| typedef T * | PointerType |
| typedef SharedPtrTraits< T > ::Reference | ReferenceType |
| typedef T *ThisType::* | unspecified_bool_type |
| typedef void * | unspecified_pointer_type |
Public Member Functions | |
| SharedPtr () | |
| Construct the object pointing to a 0 object. | |
| template<class N_PTR > | |
| SharedPtr (N_PTR *ptr) | |
| Construct the object pointing to a specified object. | |
| template<class N_PTR , class DELETER > | |
| SharedPtr (N_PTR *ptr, DELETER deleter) | |
| Construct the object pointing to a specified object + deleter. | |
| template<class N_PTR > | |
| SharedPtr (std::auto_ptr< N_PTR > &ptr) | |
| Construct the object pointing to a specified std::auto_ptr. | |
| template<class N_PTR > | |
| SharedPtr (const WeakPtr< N_PTR > &ptr) | |
| Construct the object pointing to a specified weak pointer. | |
| template<class N_PTR > | |
| SharedPtr (const SharedPtr< N_PTR > &src) | |
| automatic downcast if possible | |
| const T * | operator-> () const |
| User define conversion to the const Template pointer type. | |
| T * | operator-> () |
| User define conversion to the const Template pointer type. | |
| operator unspecified_bool_type () const | |
| User define conversion for if like "if ( smartPointer)". | |
| bool | operator! () const |
| User define conversion for if like "if ( !smartPointer)". | |
| uint32 | GetUseCount () const |
| Get how many shared pointer point to the same pointer. | |
| bool | IsUnique () const |
| return true if there exists only one instance of this shared pointer | |
| void | Reset () |
| Let the shared pointer point to a null pointer. | |
| template<class N_PTR > | |
| void | Reset (N_PTR *p) |
| Let the shared pointer point to the new given pointer. | |
| template<class N_PTR , class DELETER > | |
| void | Reset (N_PTR *p, DELETER deleter) |
| Let the shared pointer point to the new given pointer and its deleter. | |
| void | Swap (SharedPtr< T > &a) |
| Swap two smart pointers. | |
| template<class N_PTR > | |
| bool | Equal (const SharedPtr< N_PTR > &src) const |
| Check if a smart pointer is equal with another. | |
| template<class N_PTR > | |
| bool | Less (const SharedPtr< N_PTR > &src) const |
| Check if a smart pointer is less then another. | |
Static Public Member Functions | |
| template<class N_PTR > | |
| static ThisType | DynamicCast (const SharedPtr< N_PTR > &src) |
| Dynamic cast method for Smart pointer. | |
| template<class N_PTR > | |
| static ThisType | StaticCast (const SharedPtr< N_PTR > &src) |
| Static cast method for Smart pointer. | |
| template<class N_PTR > | |
| static ThisType | ConstCast (const SharedPtr< N_PTR > &src) |
| Static cast method for Smart pointer. | |
Public Attributes | |
| T * | m_ptr |
| SharedPtrCount | m_count |
Private Types | |
| typedef SharedPtr< T > | ThisType |
Friends | |
| bool | operator== (const SharedPtr< T > &a, unspecified_pointer_type b) |
| equal operator with a unspecified pointer type | |
| bool | operator!= (const SharedPtr< T > &a, unspecified_pointer_type b) |
| not equal operator with a unspecified pointer type | |
This shared pointer avoids destruction of an object in use. It can be used just like a pointer. First Template argument is the data type of the pointer.
Notes: Always pass shared pointers by value. Never create two smart pointers to the same regular pointer. Once a smart pointer is set to equal a pointer it owns that pointer, and will delete it when no more shared pointers point to the same ref.
Definition at line 79 of file TCSharedPtr.h.
typedef SharedPtr<T> TC::SharedPtr< T >::ThisType [private] |
Definition at line 82 of file TCSharedPtr.h.
| typedef T TC::SharedPtr< T >::ValueType |
Definition at line 85 of file TCSharedPtr.h.
| typedef T* TC::SharedPtr< T >::PointerType |
Definition at line 86 of file TCSharedPtr.h.
| typedef SharedPtrTraits<T>::Reference TC::SharedPtr< T >::ReferenceType |
Definition at line 87 of file TCSharedPtr.h.
| typedef T* ThisType::* TC::SharedPtr< T >::unspecified_bool_type |
Definition at line 118 of file TCSharedPtr.h.
| typedef void* TC::SharedPtr< T >::unspecified_pointer_type |
Definition at line 124 of file TCSharedPtr.h.
| TC::SharedPtr< T >::SharedPtr | ( | ) | [inline] |
| TC::SharedPtr< T >::SharedPtr | ( | N_PTR * | ptr | ) | [inline, explicit] |
| TC::SharedPtr< T >::SharedPtr | ( | N_PTR * | ptr, | |
| DELETER | deleter | |||
| ) | [inline] |
Construct the object pointing to a specified object + deleter.
Definition at line 99 of file TCSharedPtr.h.
| TC::SharedPtr< T >::SharedPtr | ( | std::auto_ptr< N_PTR > & | ptr | ) | [inline] |
Construct the object pointing to a specified std::auto_ptr.
Definition at line 103 of file TCSharedPtr.h.
| TC::SharedPtr< T >::SharedPtr | ( | const WeakPtr< N_PTR > & | ptr | ) | [inline, explicit] |
Construct the object pointing to a specified weak pointer.
Definition at line 107 of file TCSharedPtr.h.
| TC::SharedPtr< T >::SharedPtr | ( | const SharedPtr< N_PTR > & | src | ) | [inline] |
| const T* TC::SharedPtr< T >::operator-> | ( | ) | const [inline] |
User define conversion to the const Template pointer type.
Definition at line 114 of file TCSharedPtr.h.
| T* TC::SharedPtr< T >::operator-> | ( | ) | [inline] |
User define conversion to the const Template pointer type.
Definition at line 116 of file TCSharedPtr.h.
| TC::SharedPtr< T >::operator unspecified_bool_type | ( | ) | const [inline] |
User define conversion for if like "if ( smartPointer)".
Definition at line 120 of file TCSharedPtr.h.
| bool TC::SharedPtr< T >::operator! | ( | ) | const [inline] |
User define conversion for if like "if ( !smartPointer)".
Definition at line 122 of file TCSharedPtr.h.
| uint32 TC::SharedPtr< T >::GetUseCount | ( | ) | const [inline] |
Get how many shared pointer point to the same pointer.
Definition at line 131 of file TCSharedPtr.h.
| bool TC::SharedPtr< T >::IsUnique | ( | ) | const [inline] |
return true if there exists only one instance of this shared pointer
Definition at line 134 of file TCSharedPtr.h.
| void TC::SharedPtr< T >::Reset | ( | ) | [inline] |
Let the shared pointer point to the new given pointer.
Definition at line 140 of file TCSharedPtr.h.
| void TC::SharedPtr< T >::Reset | ( | N_PTR * | p, | |
| DELETER | deleter | |||
| ) | [inline] |
Let the shared pointer point to the new given pointer and its deleter.
Definition at line 143 of file TCSharedPtr.h.
| void TC::SharedPtr< T >::Swap | ( | SharedPtr< T > & | a | ) | [inline] |
Swap two smart pointers.
Definition at line 146 of file TCSharedPtr.h.
Referenced by TC::SharedPtr< TC::MT::Semaphore >::Reset().

| bool TC::SharedPtr< T >::Equal | ( | const SharedPtr< N_PTR > & | src | ) | const [inline] |
Check if a smart pointer is equal with another.
Definition at line 150 of file TCSharedPtr.h.
Referenced by TC::operator!=(), and TC::operator==().

| bool TC::SharedPtr< T >::Less | ( | const SharedPtr< N_PTR > & | src | ) | const [inline] |
| static ThisType TC::SharedPtr< T >::DynamicCast | ( | const SharedPtr< N_PTR > & | src | ) | [inline, static] |
| static ThisType TC::SharedPtr< T >::StaticCast | ( | const SharedPtr< N_PTR > & | src | ) | [inline, static] |
| static ThisType TC::SharedPtr< T >::ConstCast | ( | const SharedPtr< N_PTR > & | src | ) | [inline, static] |
| bool operator== | ( | const SharedPtr< T > & | a, | |
| unspecified_pointer_type | b | |||
| ) | [friend] |
| bool operator!= | ( | const SharedPtr< T > & | a, | |
| unspecified_pointer_type | b | |||
| ) | [friend] |
| T* TC::SharedPtr< T >::m_ptr |
Definition at line 202 of file TCSharedPtr.h.
Referenced by TC::SharedPtr< TC::MT::Semaphore >::ConstCast(), TC::SharedPtr< TC::MT::Semaphore >::DynamicCast(), TC::SharedPtr< TC::MT::Semaphore >::Equal(), TC::SharedPtr< TC::MT::Semaphore >::operator unspecified_bool_type(), TC::SharedPtr< TC::MT::Semaphore >::operator!(), TC::SharedPtr< TC::MT::Semaphore >::operator->(), TC::SharedPtr< TC::MT::Semaphore >::StaticCast(), and TC::SharedPtr< TC::MT::Semaphore >::Swap().
| SharedPtrCount TC::SharedPtr< T >::m_count |
Definition at line 203 of file TCSharedPtr.h.
Referenced by TC::SharedPtr< TC::MT::Semaphore >::ConstCast(), TC::SharedPtr< TC::MT::Semaphore >::DynamicCast(), TC::SharedPtr< TC::MT::Semaphore >::GetUseCount(), TC::SharedPtr< TC::MT::Semaphore >::IsUnique(), TC::SharedPtr< TC::MT::Semaphore >::Less(), TC::SharedPtr< TC::MT::Semaphore >::StaticCast(), and TC::SharedPtr< TC::MT::Semaphore >::Swap().