Lugre::cSmartPtr< _T > Class Template Reference

#include <lugre_smartptr.h>

Inheritance diagram for Lugre::cSmartPtr< _T >:

Inheritance graph
[legend]
Collaboration diagram for Lugre::cSmartPtr< _T >:

Collaboration graph
[legend]

List of all members.

Public Types

enum  { kDefaultTargetDestroyedEventCode = 255 }

Public Member Functions

 cSmartPtr (_T *target=0, const size_t iTargetDestroyedEventCode=kDefaultTargetDestroyedEventCode)
virtual ~cSmartPtr ()
void SmartPtr_SetTarget (_T *newtarget)
const cSmartPtr< _T > & operator= (cSmartPtr< _T > othersmartptr)
const cSmartPtr< _T > & operator= (_T *newtarget)
_T * operator* ()
void SmartPtr_TargetDestroyed ()

Public Attributes

size_t miTargetDestroyedEventCode

Private Attributes

_T * target


Detailed Description

template<class _T>
class Lugre::cSmartPtr< _T >

cSmartPtr is cListenable for target destroyed event you can register listeners for smartptr death, but you are strongly advised to not delete any objects on the event, as deleting the smartptr himself indirectly while it is iterating over listeners is fatal (on win) and is a bug that is really hard to locate

Definition at line 60 of file lugre_smartptr.h.


Member Enumeration Documentation

template<class _T>
anonymous enum

Enumerator:
kDefaultTargetDestroyedEventCode 

Definition at line 61 of file lugre_smartptr.h.


Constructor & Destructor Documentation

template<class _T>
Lugre::cSmartPtr< _T >::cSmartPtr ( _T *  target = 0,
const size_t  iTargetDestroyedEventCode = kDefaultTargetDestroyedEventCode 
) [inline]

Definition at line 64 of file lugre_smartptr.h.

template<class _T>
virtual Lugre::cSmartPtr< _T >::~cSmartPtr (  )  [inline, virtual]

Definition at line 69 of file lugre_smartptr.h.


Member Function Documentation

template<class _T>
void Lugre::cSmartPtr< _T >::SmartPtr_SetTarget ( _T *  newtarget  )  [inline]

Definition at line 73 of file lugre_smartptr.h.

Referenced by Lugre::cSmartPtr< Lugre::cListener >::operator=().

template<class _T>
const cSmartPtr<_T>& Lugre::cSmartPtr< _T >::operator= ( cSmartPtr< _T >  othersmartptr  )  [inline]

Definition at line 78 of file lugre_smartptr.h.

template<class _T>
const cSmartPtr<_T>& Lugre::cSmartPtr< _T >::operator= ( _T *  newtarget  )  [inline]

Definition at line 79 of file lugre_smartptr.h.

template<class _T>
_T* Lugre::cSmartPtr< _T >::operator* (  )  [inline]

Definition at line 80 of file lugre_smartptr.h.

template<class _T>
void Lugre::cSmartPtr< _T >::SmartPtr_TargetDestroyed (  )  [inline, virtual]

only called from cSmartPointable's destructor no need to unregister here, would even break iterator in cSmartPointable's destructor

Implements Lugre::cISmartPtr.

Definition at line 84 of file lugre_smartptr.h.


Member Data Documentation

template<class _T>
size_t Lugre::cSmartPtr< _T >::miTargetDestroyedEventCode

template<class _T>
_T* Lugre::cSmartPtr< _T >::target [private]


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

Generated on Wed Feb 8 06:00:22 2012 for cpp by  doxygen 1.5.6