Logo Search packages:      
Sourcecode: znc version File versions

CSmartPtr< T > Class Template Reference

#include <Utils.h>

List of all members.


Detailed Description

template<typename T>
class CSmartPtr< T >

This is a standard reference counting pointer. Be careful not to have two of these point to the same raw pointer or one will be deleted while the other still thinks it is valid.

Author:
prozac <prozac@rottenboy.com>

Definition at line 450 of file Utils.h.


Public Member Functions

CSmartPtr< T > & Attach (T *pRawPtr)
 Attach to a given raw pointer, it will Release() the current raw pointer and assign the new one.
 CSmartPtr (const CSmartPtr< T > &CopyFrom)
 Copy constructor, will copy the raw pointer and counter locations and increment the reference counter.
 CSmartPtr (T *pRawPtr)
 Attach to an existing raw pointer, be CAREFUL not to have more than one CSmartPtr attach to the same raw pointer or bad things will happen.
 CSmartPtr ()
 Standard constructor, points to nothing.
unsigned int * GetCount () const
T * GetPtr () const
bool IsNull () const
 Check to see if the underlying raw pointer is null.
T & operator* () const
T * operator-> () const
CSmartPtr< T > & operator= (const CSmartPtr< T > &CopyFrom)
 Copies an existing CSmartPtr adding another reference to the counter.
CSmartPtr< T > & operator= (T *p)
 Attach() to a raw pointer.
bool operator== (const CSmartPtr< T > &rhs)
bool operator== (T *rhs)
void Release ()
 Releases the underlying raw pointer and cleans up if we were the last reference to said pointer.
 ~CSmartPtr ()
 Destructor will Release() the raw pointer and delete it if this was the last reference.

Private Attributes

T * m_pType
 Raw pointer to the class being referenced.
unsigned int * m_puCount
 Counter of how many CSmartPtr's are referencing the same raw pointer.

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

Generated by  Doxygen 1.6.0   Back to index