Version: 8.3.0
YACS::BASES::AutoRefCnt< T > Class Template Reference

#include <AutoRefCnt.hxx>

Collaboration diagram for YACS::BASES::AutoRefCnt< T >:

Public Member Functions

 AutoRefCnt (const AutoRefCnt &other)
 
 AutoRefCnt (T *ptr=0)
 
 ~AutoRefCnt ()
 
bool operator== (const AutoRefCnt &other) const
 
bool operator== (const T *other) const
 
AutoRefCntoperator= (const AutoRefCnt &other)
 
AutoRefCntoperator= (T *ptr)
 
T * operator-> ()
 
const T * operator-> () const
 
T & operator* ()
 
const T & operator* () const
 
 operator T * ()
 
 operator const T * () const
 
T * retn ()
 

Private Member Functions

void referPtr (T *ptr)
 
void destroyPtr ()
 

Private Attributes

T * _ptr
 

Detailed Description

template<class T>
class YACS::BASES::AutoRefCnt< T >

Definition at line 30 of file AutoRefCnt.hxx.

Constructor & Destructor Documentation

template<class T>
YACS::BASES::AutoRefCnt< T >::AutoRefCnt ( const AutoRefCnt< T > &  other)
inline

Definition at line 33 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr, and YACS::BASES::AutoRefCnt< T >::referPtr().

33 :_ptr(0) { referPtr(other._ptr); }
template<class T>
YACS::BASES::AutoRefCnt< T >::AutoRefCnt ( T *  ptr = 0)
inline

Definition at line 34 of file AutoRefCnt.hxx.

34 :_ptr(ptr) { }
template<class T>
YACS::BASES::AutoRefCnt< T >::~AutoRefCnt ( )
inline

Definition at line 35 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::destroyPtr().

35 { destroyPtr(); }

Member Function Documentation

template<class T>
void YACS::BASES::AutoRefCnt< T >::destroyPtr ( )
inlineprivate
template<class T>
YACS::BASES::AutoRefCnt< T >::operator const T * ( ) const
inline

Definition at line 45 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr.

45 { return _ptr; }
template<class T>
YACS::BASES::AutoRefCnt< T >::operator T * ( )
inline

Definition at line 44 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr.

44 { return _ptr; }
template<class T>
T& YACS::BASES::AutoRefCnt< T >::operator* ( )
inline

Definition at line 42 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr.

42 { return *_ptr; }
template<class T>
const T& YACS::BASES::AutoRefCnt< T >::operator* ( ) const
inline

Definition at line 43 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr.

43 { return *_ptr; }
template<class T>
T* YACS::BASES::AutoRefCnt< T >::operator-> ( )
inline

Definition at line 40 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr.

40 { return _ptr ; }
template<class T>
const T* YACS::BASES::AutoRefCnt< T >::operator-> ( ) const
inline

Definition at line 41 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr.

41 { return _ptr; }
template<class T>
AutoRefCnt& YACS::BASES::AutoRefCnt< T >::operator= ( const AutoRefCnt< T > &  other)
inline

Definition at line 38 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr, YACS::BASES::AutoRefCnt< T >::destroyPtr(), and YACS::BASES::AutoRefCnt< T >::referPtr().

38 { if(_ptr!=other._ptr) { destroyPtr(); referPtr(other._ptr); } return *this; }
template<class T>
AutoRefCnt& YACS::BASES::AutoRefCnt< T >::operator= ( T *  ptr)
inline

Definition at line 39 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr, and YACS::BASES::AutoRefCnt< T >::destroyPtr().

39 { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; } return *this; }
template<class T>
bool YACS::BASES::AutoRefCnt< T >::operator== ( const AutoRefCnt< T > &  other) const
inline

Definition at line 36 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr.

36 { return _ptr==other._ptr; }
template<class T>
bool YACS::BASES::AutoRefCnt< T >::operator== ( const T *  other) const
inline

Definition at line 37 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr.

37 { return _ptr==other; }
template<class T>
void YACS::BASES::AutoRefCnt< T >::referPtr ( T *  ptr)
inlineprivate

Definition at line 48 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr.

Referenced by YACS::BASES::AutoRefCnt< T >::AutoRefCnt(), and YACS::BASES::AutoRefCnt< T >::operator=().

48 { _ptr=ptr; if(_ptr) _ptr->incrRef(); }
template<class T>
T* YACS::BASES::AutoRefCnt< T >::retn ( )
inline

Definition at line 46 of file AutoRefCnt.hxx.

References YACS::BASES::AutoRefCnt< T >::_ptr.

46 { if(_ptr) _ptr->incrRef(); return _ptr; }

Member Data Documentation


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