ALBA
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
albaAutoPointer< T > Class Template Reference

#include <albaSmartPointer.h>

Inheritance diagram for albaAutoPointer< T >:
Inheritance graph
[legend]
Collaboration diagram for albaAutoPointer< T >:
Collaboration graph
[legend]

Public Member Functions

 albaAutoPointer (T *r=NULL, void *owner=NULL)
 
 albaAutoPointer (const albaAutoPointer &r)
 
 ~albaAutoPointer ()
 
albaAutoPointeroperator= (T *r)
 
albaAutoPointeroperator= (const albaAutoPointer< T > &r)
 
bool operator== (const albaAutoPointer< T > &r) const
 
bool operator== (const T *r) const
 
T * GetPointer () const
 
 operator T* () const
 
T * operator-> () const
 
void UnRegister (void *owner)
 

Protected Member Functions

void Swap (albaAutoPointer &r)
 
void Register (void *owner)
 

Protected Attributes

T * m_Object
 

Detailed Description

template<class T>
class albaAutoPointer< T >

Hold a reference to a T instance.

albaAutoPointer stores a pointer to a albaSmartObjct, and keeps it registered. When allocated on the stack this object allows to automatically unregister an object when exiting from the scope.

Definition at line 32 of file albaSmartPointer.h.

Constructor & Destructor Documentation

◆ albaAutoPointer() [1/2]

template<class T >
albaAutoPointer< T >::albaAutoPointer ( T *  r = NULL,
void *  owner = NULL 
)
inline

Initialize smart pointer to (optional) given object.

Definition at line 36 of file albaSmartPointer.h.

References albaAutoPointer< T >::m_Object, and albaAutoPointer< T >::Register().

Here is the call graph for this function:

◆ albaAutoPointer() [2/2]

template<class T >
albaAutoPointer< T >::albaAutoPointer ( const albaAutoPointer< T > &  r)
inline

Initialize smart pointer with a new reference to the same object referenced by given smart pointer.

Definition at line 45 of file albaSmartPointer.h.

References albaAutoPointer< T >::m_Object, and albaAutoPointer< T >::Register().

Here is the call graph for this function:

◆ ~albaAutoPointer()

template<class T >
albaAutoPointer< T >::~albaAutoPointer ( )
inline

Destroy smart pointer and remove the reference to its object.

Definition at line 48 of file albaSmartPointer.h.

References albaAutoPointer< T >::UnRegister().

Here is the call graph for this function:

Member Function Documentation

◆ operator=() [1/2]

template<class T >
albaAutoPointer & albaAutoPointer< T >::operator= ( T *  r)
inline

Assign object to reference.

This removes any reference to an old object.

Definition at line 53 of file albaSmartPointer.h.

References albaAutoPointer< T >::Swap().

Here is the call graph for this function:

◆ operator=() [2/2]

template<class T >
albaAutoPointer & albaAutoPointer< T >::operator= ( const albaAutoPointer< T > &  r)
inline

Definition at line 60 of file albaSmartPointer.h.

References albaAutoPointer< T >::Swap().

Here is the call graph for this function:

◆ operator==() [1/2]

template<class T >
bool albaAutoPointer< T >::operator== ( const albaAutoPointer< T > &  r) const
inline

Definition at line 68 of file albaSmartPointer.h.

References albaAutoPointer< T >::m_Object.

◆ operator==() [2/2]

template<class T >
bool albaAutoPointer< T >::operator== ( const T *  r) const
inline

Definition at line 69 of file albaSmartPointer.h.

References albaAutoPointer< T >::m_Object.

◆ GetPointer()

template<class T >
T * albaAutoPointer< T >::GetPointer ( ) const
inline

Get the contained pointer.

Definition at line 72 of file albaSmartPointer.h.

References albaAutoPointer< T >::m_Object.

◆ operator T*()

template<class T >
albaAutoPointer< T >::operator T* ( ) const
inline

Allow to pass on the smart pointer to any function requiring a "T *".

Definition at line 76 of file albaSmartPointer.h.

◆ operator->()

template<class T >
T * albaAutoPointer< T >::operator-> ( ) const
inline

Provides normal pointer target member access using operator ->.

Definition at line 79 of file albaSmartPointer.h.

References albaAutoPointer< T >::m_Object.

◆ UnRegister()

template<class T >
void albaAutoPointer< T >::UnRegister ( void *  owner)
inline

used to force releasing of internal object, specifying the owner

Definition at line 82 of file albaSmartPointer.h.

References albaAutoPointer< T >::m_Object.

Referenced by albaAutoPointer< T >::~albaAutoPointer().

◆ Swap()

template<class T >
void albaAutoPointer< T >::Swap ( albaAutoPointer< T > &  r)
inlineprotected

Definition at line 92 of file albaSmartPointer.h.

References albaAutoPointer< T >::m_Object.

Referenced by albaAutoPointer< T >::operator=().

◆ Register()

template<class T >
void albaAutoPointer< T >::Register ( void *  owner)
inlineprotected

Member Data Documentation

◆ m_Object

template<class T >
T* albaAutoPointer< T >::m_Object
protected

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