NLMISC::CRefCount Class Reference

#include <smart_ptr.h>

Inheritance diagram for NLMISC::CRefCount:

NL3D::CAnimationPlaylist NL3D::CAnimationSet NL3D::CBoneBase NL3D::CChannelMixer NL3D::CLandscape NL3D::CMaterial NL3D::CMaterialBase NL3D::CMorphBase NL3D::CParticleSystem NL3D::CPatchRdrPass NL3D::CTextureDrvShare NL3D::CTransform NL3D::CVertexBuffer NL3D::CVertexProgram NL3D::CZone::CTessBaseVertex NL3D::IDriver NL3D::IMeshVertexProgram NL3D::IShader NL3D::IShape NL3D::ITexture NL3D::ITextureDrvInfos NL3D::IVBDrvInfos NL3D::IVertexBufferHard NL3D::IVertexProgramDrvInfos NLGEORGES::UForm NLGEORGES::UFormDfn NLGEORGES::UType NLMISC::IEventEmitter

Detailed Description

To use CSmartPtr or CRefPtr, derive from this class. Your class doens't have to be virtual, or doesn't have to provide a virtual dtor.
Author:
Lionel Berenguier

Nevrax France

Date:
2000

Definition at line 48 of file smart_ptr.h.

Public Member Functions

 CRefCount (const CRefCount &)
 copy cons must NOT copy crefs/pinfo!!

 CRefCount ()
 Default constructor init crefs to 0.

const sintgetRefCount () const
CRefCountoperator= (const CRefCount &)
 operator= must NOT copy crefs/pinfo!!

 ~CRefCount ()
 Destructor which release pinfo if necessary.


Data Fields

sint crefs
CPtrInfopinfo

Static Public Attributes

CPtrInfo NullPtrInfo

Friends

struct CPtrInfo


Constructor & Destructor Documentation

NLMISC::CRefCount::~CRefCount  )  [inline]
 

Destructor which release pinfo if necessary.

Definition at line 44 of file smart_ptr_inline.h.

References crefs, NLMISC::CRefCount::CPtrInfo::IsNullPtrInfo, nlassert, pinfo, and NLMISC::CRefCount::CPtrInfo::Ptr.

00045 {
00046         // This is the destruction of the objet.
00047 #ifdef NL_DEBUG
00048         nlassert(crefs==0);
00049 #endif
00050 
00051         // If a CRefPtr still points on me...
00052         if(!pinfo->IsNullPtrInfo)
00053         {
00054                 // inform them of my destruction.
00055                 pinfo->Ptr= NULL;
00056         }
00057 }

NLMISC::CRefCount::CRefCount  )  [inline]
 

Default constructor init crefs to 0.

Definition at line 85 of file smart_ptr.h.

References crefs, NullPtrInfo, and pinfo.

00085 { crefs = 0; pinfo=&NullPtrInfo; }

NLMISC::CRefCount::CRefCount const CRefCount  )  [inline]
 

copy cons must NOT copy crefs/pinfo!!

Definition at line 89 of file smart_ptr.h.

References crefs, NullPtrInfo, and pinfo.

00089 {crefs = 0; pinfo=&NullPtrInfo;}


Member Function Documentation

const sint& NLMISC::CRefCount::getRefCount  )  const [inline]
 

Definition at line 70 of file smart_ptr.h.

References crefs, and sint.

00071         {
00072                 return  crefs;
00073         }

CRefCount& NLMISC::CRefCount::operator= const CRefCount  )  [inline]
 

operator= must NOT copy crefs/pinfo!!

Definition at line 87 of file smart_ptr.h.

00087 {return *this;}


Friends And Related Function Documentation

friend struct CPtrInfo [friend]
 

Definition at line 67 of file smart_ptr.h.


Field Documentation

sint NLMISC::CRefCount::crefs [mutable]
 

Definition at line 79 of file smart_ptr.h.

Referenced by CRefCount(), getRefCount(), and ~CRefCount().

CRefCount::CPtrInfo NLMISC::CRefCount::NullPtrInfo [static]
 

Referenced by CRefCount().

CPtrInfo* NLMISC::CRefCount::pinfo [mutable]
 

Definition at line 80 of file smart_ptr.h.

Referenced by CRefCount(), and ~CRefCount().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 13:31:27 2004 for NeL by doxygen 1.3.6