Shared implementation of the smart pointer. More...
Public Member Functions | |
SmartShared (T *p=0) | |
Constructor. More... | |
~SmartShared () | |
Destructor. More... | |
SmartShared * | attach () |
Increment reference count and return this. More... | |
template<typename NEWMUTEXLOCKER > | |
QtlSmartPointer< T, NEWMUTEXLOCKER > | changeMutex () |
int | count () |
void | detach () |
Decrement reference count and deallocate this if needed. More... | |
template<typename ST > | |
QtlSmartPointer< ST, MUTEXLOCKER > | downcast () |
bool | isNull () |
T * | pointer () |
T * | release () |
void | reset (T *p=0) |
template<typename ST > | |
QtlSmartPointer< ST, MUTEXLOCKER > | upcast () |
Private Member Functions | |
SmartShared () Q_DECL_EQ_DELETE | |
Private Attributes | |
MUTEXLOCKER::Mutex | _mutex |
Protect the SmartShared. More... | |
T * | _ptr |
Pointer to actual object. More... | |
int | _refCount |
Reference counter. More... | |
Shared implementation of the smart pointer.
All smart pointer objects which reference the same T
object share one single SmartShared
object.
|
inline |
Constructor.
Initial reference count is 1.
[in] | p | A pointer to an unmanaged object of class T. |
QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::~SmartShared | ( | ) |
Destructor.
Deallocate actual object (if any).
|
private |
QtlSmartPointer< T, MUTEXLOCKER >::SmartShared * QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::attach | ( | ) |
Increment reference count and return this.
void QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::detach | ( | ) |
Decrement reference count and deallocate this if needed.
T * QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::release | ( | ) |
void QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::reset | ( | T * | p = 0 | ) |
T * QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::pointer | ( | ) |
int QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::count | ( | ) |
bool QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::isNull | ( | ) |
QtlSmartPointer< ST, MUTEXLOCKER > QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::downcast | ( | ) |
QtlSmartPointer< ST, MUTEXLOCKER > QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::upcast | ( | ) |
QtlSmartPointer< T, NEWMUTEXLOCKER > QtlSmartPointer< T, MUTEXLOCKER >::SmartShared::changeMutex | ( | ) |
|
private |
Pointer to actual object.
|
private |
Reference counter.
|
private |
Protect the SmartShared.