Version: 9.16.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 isNull () const
 
bool isNotNull () const
 
void nullify ()
 
bool operator== (const AutoRefCnt &other) const
 
bool operator== (const T *other) const
 
AutoRefCntoperator= (const AutoRefCnt &other)
 
AutoRefCntoperator= (T *ptr)
 
Toperator-> ()
 
const Toperator-> () const
 
Toperator* ()
 
const Toperator* () const
 
 operator T* ()
 
 operator const T * () const
 
Tretn ()
 
void takeRef (T *ptr)
 

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

◆ AutoRefCnt() [1/2]

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

◆ AutoRefCnt() [2/2]

template<class T >
YACS::BASES::AutoRefCnt< T >::AutoRefCnt ( T ptr = 0)
inline

Definition at line 34 of file AutoRefCnt.hxx.

34:_ptr(ptr) { }

◆ ~AutoRefCnt()

template<class T >
YACS::BASES::AutoRefCnt< T >::~AutoRefCnt ( )
inline

Definition at line 35 of file AutoRefCnt.hxx.

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

Member Function Documentation

◆ destroyPtr()

◆ isNotNull()

template<class T >
bool YACS::BASES::AutoRefCnt< T >::isNotNull ( ) const
inline

Definition at line 37 of file AutoRefCnt.hxx.

37{ return !isNull(); }

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

◆ isNull()

template<class T >
bool YACS::BASES::AutoRefCnt< T >::isNull ( ) const
inline

Definition at line 36 of file AutoRefCnt.hxx.

36{ return _ptr==0; }

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

Referenced by YACS::BASES::AutoRefCnt< T >::isNotNull().

◆ nullify()

template<class T >
void YACS::BASES::AutoRefCnt< T >::nullify ( )
inline

◆ operator const T *()

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

Definition at line 48 of file AutoRefCnt.hxx.

48{ return _ptr; }

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

◆ operator T*()

template<class T >
YACS::BASES::AutoRefCnt< T >::operator T* ( )
inline

Definition at line 47 of file AutoRefCnt.hxx.

47{ return _ptr; }

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

◆ operator*() [1/2]

template<class T >
T & YACS::BASES::AutoRefCnt< T >::operator* ( )
inline

Definition at line 45 of file AutoRefCnt.hxx.

45{ return *_ptr; }

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

◆ operator*() [2/2]

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

Definition at line 46 of file AutoRefCnt.hxx.

46{ return *_ptr; }

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

◆ operator->() [1/2]

template<class T >
T * YACS::BASES::AutoRefCnt< T >::operator-> ( )
inline

Definition at line 43 of file AutoRefCnt.hxx.

43{ return _ptr ; }

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

◆ operator->() [2/2]

template<class T >
const T * YACS::BASES::AutoRefCnt< T >::operator-> ( ) const
inline

Definition at line 44 of file AutoRefCnt.hxx.

44{ return _ptr; }

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

◆ operator=() [1/2]

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

Definition at line 41 of file AutoRefCnt.hxx.

41{ if(_ptr!=other._ptr) { destroyPtr(); referPtr(other._ptr); } return *this; }

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

◆ operator=() [2/2]

template<class T >
AutoRefCnt & YACS::BASES::AutoRefCnt< T >::operator= ( T ptr)
inline

Definition at line 42 of file AutoRefCnt.hxx.

42{ if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; } return *this; }

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

◆ operator==() [1/2]

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

Definition at line 39 of file AutoRefCnt.hxx.

39{ return _ptr==other._ptr; }

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

◆ operator==() [2/2]

template<class T >
bool YACS::BASES::AutoRefCnt< T >::operator== ( const T other) const
inline

Definition at line 40 of file AutoRefCnt.hxx.

40{ return _ptr==other; }

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

◆ referPtr()

template<class T >
void YACS::BASES::AutoRefCnt< T >::referPtr ( T ptr)
inlineprivate

◆ retn()

template<class T >
T * YACS::BASES::AutoRefCnt< T >::retn ( )
inline

Definition at line 49 of file AutoRefCnt.hxx.

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

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

◆ takeRef()

template<class T >
void YACS::BASES::AutoRefCnt< T >::takeRef ( T ptr)
inline

Definition at line 50 of file AutoRefCnt.hxx.

50{ if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; if(_ptr) _ptr->incrRef(); } }

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

Member Data Documentation

◆ _ptr


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