NLMISC::CDbgPtr< T > Class Template Reference

#include <smart_ptr.h>

template<class T>
class NLMISC::CDbgPtr< T >


Public Member Functions

 CDbgPtr (const CDbgPtr &copy)
template<class W>  CDbgPtr (const W *p)
 CDbgPtr ()
bool isNULL () const
T & operator * (void) const
 operator T * (void) const
template<class W>  operator W * (void) const
bool operator!= (int p) const
bool operator!= (const CDbgPtr &p) const
template<class W> bool operator!= (const W *p) const
T * operator-> (void) const
bool operator< (const CDbgPtr &p) const
CDbgPtroperator= (const CDbgPtr &p)
CDbgPtroperator= (const int value)
template<class W> CDbgPtroperator= (const W *p)
bool operator== (int p) const
bool operator== (const CDbgPtr &p) const
template<class W> bool operator== (const W *p) const
T * ptr () const
 ~CDbgPtr ()

Private Attributes

T * Ptr

Constructor & Destructor Documentation

template<class T>
NLMISC::CDbgPtr< T >::CDbgPtr  )  [inline]
 

Definition at line 412 of file smart_ptr.h.

00413         {       Ptr=NULL;       }

template<class T>
template<class W>
NLMISC::CDbgPtr< T >::CDbgPtr const W *  p  )  [inline]
 

Definition at line 419 of file smart_ptr.h.

00420         {
00421                 Ptr=const_cast<T*>(NLMISC::type_cast<const T*>(p));
00422 #ifdef NL_DEBUG_PTR
00423                 if      (Ptr)
00424                 {
00425                         CDbgRefCount<T> *ref=static_cast<CDbgRefCount<T>*>(Ptr);
00426                         ref->incRef(*this);
00427                 }
00428 #endif
00429         }

template<class T>
NLMISC::CDbgPtr< T >::CDbgPtr const CDbgPtr< T > &  copy  )  [inline]
 

Definition at line 431 of file smart_ptr.h.

References NLMISC::CDbgPtr< T >::Ptr.

00432         {
00433                 Ptr=copy.Ptr;
00434 #ifdef NL_DEBUG_PTR
00435         if(Ptr)
00436         {
00437                 CDbgRefCount<T> *ref=static_cast<CDbgRefCount<T>*>(Ptr);
00438                 ref->incRef(*this);
00439         }
00440 #endif
00441         }

template<class T>
NLMISC::CDbgPtr< T >::~CDbgPtr  )  [inline]
 

Definition at line 549 of file smart_ptr.h.

00550 { 
00551 #ifdef NL_DEBUG_PTR
00552     if(Ptr)
00553         {
00554 //              CDbgRefCount<T> *ref=const_cast<CDbgRefCount<T>*>(static_cast<const     CDbgRefCount<T>*>(Ptr));
00555                 CDbgRefCount<T> *ref=static_cast<CDbgRefCount<T>*>(Ptr);
00556                 ref->decRef(*this);
00557                 Ptr=NULL;
00558         }
00559 #else
00560         Ptr=NULL;
00561 #endif
00562 }


Member Function Documentation

template<class T>
bool NLMISC::CDbgPtr< T >::isNULL  )  const [inline]
 

Definition at line 444 of file smart_ptr.h.

00445         {
00446                 return  Ptr==NULL;
00447         }

template<class T>
T& NLMISC::CDbgPtr< T >::operator * void   )  const [inline]
 

Definition at line 465 of file smart_ptr.h.

00465 {       return *Ptr; }

template<class T>
NLMISC::CDbgPtr< T >::operator T * void   )  const [inline]
 

Definition at line 454 of file smart_ptr.h.

00455         {
00456                 return Ptr;
00457         }

template<class T>
template<class W>
NLMISC::CDbgPtr< T >::operator W * void   )  const [inline]
 

Definition at line 460 of file smart_ptr.h.

00461         {
00462                 return NLMISC::type_cast<W*>(Ptr);
00463         }

template<class T>
bool NLMISC::CDbgPtr< T >::operator!= int  p  )  const [inline]
 

Definition at line 540 of file smart_ptr.h.

References nlassert.

00541         {
00542                 nlassert(p == 0);
00543                 return  Ptr!=0;
00544         }

template<class T>
bool NLMISC::CDbgPtr< T >::operator!= const CDbgPtr< T > &  p  )  const [inline]
 

Definition at line 530 of file smart_ptr.h.

References NLMISC::CDbgPtr< T >::Ptr.

00531         {
00532                 return  Ptr!=p.Ptr;
00533         }

template<class T>
template<class W>
bool NLMISC::CDbgPtr< T >::operator!= const W *  p  )  const [inline]
 

Definition at line 521 of file smart_ptr.h.

00522         {
00523                 return  Ptr!=NLMISC::type_cast<const T*>(p);
00524         }

template<class T>
T* NLMISC::CDbgPtr< T >::operator-> void   )  const [inline]
 

Definition at line 466 of file smart_ptr.h.

00466 {       return Ptr; }

template<class T>
bool NLMISC::CDbgPtr< T >::operator< const CDbgPtr< T > &  p  )  const [inline]
 

Definition at line 572 of file smart_ptr.h.

References NLMISC::CDbgPtr< T >::Ptr.

00573 {
00574         return Ptr<p.Ptr;
00575 }

template<class T>
CDbgPtr< T > & NLMISC::CDbgPtr< T >::operator= const CDbgPtr< T > &  p  )  [inline]
 

Definition at line 566 of file smart_ptr.h.

References NLMISC::CDbgPtr< T >::Ptr.

00567 {
00568         return CDbgPtr<T>::operator=(p.Ptr);
00569 }

template<class T>
CDbgPtr& NLMISC::CDbgPtr< T >::operator= const int  value  )  [inline]
 

Definition at line 491 of file smart_ptr.h.

References nlassert, and value.

00492         {
00493 #ifdef NL_DEBUG
00494                 nlassert(value==NULL);
00495 #endif
00496 
00497 #ifdef NL_DEBUG_PTR     
00498                 if      (Ptr)
00499                 {
00500                         CDbgRefCount<T> *ref=static_cast<CDbgRefCount<T>*>(Ptr);
00501                         ref->decRef(*this);
00502                 }
00503                 Ptr = NULL;
00504                 
00505 #else
00506                 Ptr = NULL;
00507 #endif
00508                 return *this;
00509         }

template<class T>
template<class W>
CDbgPtr& NLMISC::CDbgPtr< T >::operator= const W *  p  )  [inline]
 

Definition at line 470 of file smart_ptr.h.

00471         {
00472 #ifdef NL_DEBUG_PTR     
00473                 if      (p)
00474                 {
00475                         CDbgRefCount<T> *ref=static_cast<CDbgRefCount<T>*>(const_cast<T*>(NLMISC::type_cast<const T*>(p)));
00476                         ref->incRef(*this);
00477                 }
00478                 if      (Ptr)
00479                 {
00480                         CDbgRefCount<T> *ref=static_cast<CDbgRefCount<T>*>(Ptr);
00481                         ref->decRef(*this);
00482                 }
00483                 Ptr = const_cast<T*>(NLMISC::type_cast<const T*>(p));
00484                 
00485 #else
00486                 Ptr = const_cast<T*>(NLMISC::type_cast<const T*>(p));
00487 #endif
00488                 return *this;
00489         }

template<class T>
bool NLMISC::CDbgPtr< T >::operator== int  p  )  const [inline]
 

Definition at line 535 of file smart_ptr.h.

References nlassert.

00536         {
00537                 nlassert(p == 0);
00538                 return  Ptr==0;
00539         }

template<class T>
bool NLMISC::CDbgPtr< T >::operator== const CDbgPtr< T > &  p  )  const [inline]
 

Definition at line 526 of file smart_ptr.h.

References NLMISC::CDbgPtr< T >::Ptr.

00527         {
00528                 return  Ptr==p.Ptr;
00529         }

template<class T>
template<class W>
bool NLMISC::CDbgPtr< T >::operator== const W *  p  )  const [inline]
 

Definition at line 516 of file smart_ptr.h.

00517         {
00518                 return  Ptr==NLMISC::type_cast<const T*>(p);
00519         }

template<class T>
T* NLMISC::CDbgPtr< T >::ptr  )  const [inline]
 

Definition at line 449 of file smart_ptr.h.

00450         {
00451                 return  Ptr;
00452         }


Field Documentation

template<class T>
T* NLMISC::CDbgPtr< T >::Ptr [private]
 

Definition at line 409 of file smart_ptr.h.

Referenced by NLMISC::CDbgPtr< T >::CDbgPtr(), NLMISC::CDbgPtr< T >::operator!=(), NLMISC::CDbgPtr< T >::operator<(), NLMISC::CDbgPtr< T >::operator=(), and NLMISC::CDbgPtr< T >::operator==().


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 13:07:18 2004 for NeL by doxygen 1.3.6