Classes | Public Types | Public Member Functions | List of all members
istd::TSmartPtr< Type, Accessor > Class Template Reference

Implementation of a smart pointer. More...

#include <TSmartPtr.h>

Inheritance diagram for istd::TSmartPtr< Type, Accessor >:
istd::TTransPtr< Type >

Classes

class  RefCounter
 

Public Types

typedef TTransPtr< Type > BaseClass
 
typedef BaseClass::RefCountBase RefCountBase
 

Public Member Functions

 TSmartPtr ()
 
 TSmartPtr (Type *pointer)
 
 TSmartPtr (const TTransPtr< Type > &pointer)
 
 TSmartPtr (const TSmartPtr &pointer)
 
void SetPtr (Type *pointer)
 Set pointed object. More...
 
template<class SourceType >
bool SetCastedOrRemove (SourceType *pointer)
 Set this pointer using casted pointer of other type. More...
 
TSmartPtroperator= (const TTransPtr< Type > &pointer)
 
TSmartPtroperator= (const TSmartPtr &pointer)
 
- Public Member Functions inherited from istd::TTransPtr< Type >
 TTransPtr (const TTransPtr &pointer)
 Constructor overtaking the pointer. More...
 
 ~TTransPtr ()
 
bool IsValid () const
 Check, whether the object is in valid state. More...
 
const Type * GetPtr () const
 Get access to pointed object. More...
 
Type * GetPtr ()
 Get access to pointed object. More...
 
void Reset ()
 Set this pointer to NULL. More...
 
void Swap (TTransPtr &pointer)
 Swap two pointers. More...
 
template<class CastedType >
CastedType Cast () const
 
TTransPtroperator= (const TTransPtr &pointer)
 Copy operator overtaking the pointer. More...
 
Type & operator* () const
 
Type * operator-> () const
 

Additional Inherited Members

- Protected Member Functions inherited from istd::TTransPtr< Type >
 TTransPtr ()
 
void Detach ()
 Detach counter object without changing of internal counter pointer. More...
 
RefCountBaseGetInternalCounter (const TTransPtr &pointer) const
 Get internal counter. More...
 
- Protected Attributes inherited from istd::TTransPtr< Type >
RefCountBasem_counterPtr
 

Detailed Description

template<class Type, class Accessor = DefaultAccessor<Type>>
class istd::TSmartPtr< Type, Accessor >

Implementation of a smart pointer.

This implementation uses internal counter object. Internal counter object is used to count of instances of smart pointers and will be shared by all its copies.

Definition at line 24 of file TSmartPtr.h.

Member Typedef Documentation

template<class Type, class Accessor = DefaultAccessor<Type>>
typedef TTransPtr<Type> istd::TSmartPtr< Type, Accessor >::BaseClass

Definition at line 27 of file TSmartPtr.h.

template<class Type, class Accessor = DefaultAccessor<Type>>
typedef BaseClass::RefCountBase istd::TSmartPtr< Type, Accessor >::RefCountBase

Definition at line 28 of file TSmartPtr.h.

Constructor & Destructor Documentation

template<class Type , class Accessor >
istd::TSmartPtr< Type, Accessor >::TSmartPtr ( )

Definition at line 121 of file TSmartPtr.h.

References istd::TTransPtr< Type >::m_counterPtr, and NULL.

template<class Type, class Accessor >
istd::TSmartPtr< Type, Accessor >::TSmartPtr ( Type *  pointer)
explicit

Definition at line 129 of file TSmartPtr.h.

References istd::TTransPtr< Type >::m_counterPtr, and NULL.

template<class Type, class Accessor >
istd::TSmartPtr< Type, Accessor >::TSmartPtr ( const TTransPtr< Type > &  pointer)
template<class Type, class Accessor >
istd::TSmartPtr< Type, Accessor >::TSmartPtr ( const TSmartPtr< Type, Accessor > &  pointer)

Member Function Documentation

template<class Type, class Accessor >
TSmartPtr< Type, Accessor > & istd::TSmartPtr< Type, Accessor >::operator= ( const TTransPtr< Type > &  pointer)

Definition at line 180 of file TSmartPtr.h.

References NULL, and istd::TTransPtr< Type >::RefCountBase::OnAttached().

template<class Type, class Accessor >
TSmartPtr< Type, Accessor > & istd::TSmartPtr< Type, Accessor >::operator= ( const TSmartPtr< Type, Accessor > &  pointer)

Definition at line 201 of file TSmartPtr.h.

References NULL, and istd::TTransPtr< Type >::RefCountBase::OnAttached().

template<class Type, class Accessor = DefaultAccessor<Type>>
template<class SourceType >
bool istd::TSmartPtr< Type, Accessor >::SetCastedOrRemove ( SourceType *  pointer)
inline

Set this pointer using casted pointer of other type.

If casting is not possible, object will be removed.

Definition at line 45 of file TSmartPtr.h.

template<class Type, class Accessor >
void istd::TSmartPtr< Type, Accessor >::SetPtr ( Type *  pointer)
inline

Set pointed object.

Definition at line 166 of file TSmartPtr.h.

References NULL.

Referenced by istd::TSmartPtr< QTranslator >::SetCastedOrRemove().


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

© 2007-2017 Witold Gantzke and Kirill Lepskiy