RefCounter Class Reference

Base class for reference counted objects. More...

#include <refcounter.h>

Inherited by UniversalManager< T, ParrentClass >::ManagedItem.

Inheritance diagram for RefCounter:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual ~RefCounter ()
void * operator new (size_t size)
 Customized overloaded operator new (it only allocates memory).
bool isHeapAllocated (void)
int getRefCount (void)

Protected Member Functions

 RefCounter ()
void incRef ()
void decRef ()
virtual void OnZeroRefCount ()

Private Types

typedef std::list< void * > TTempHeapPointers

Private Attributes

int mRefCount
bool mHeapAllocated

Static Private Attributes

static TTempHeapPointers mTmpHeapPtrs

Friends

class RefCounterPtrBase

Detailed Description

Base class for reference counted objects.

Remarks:
A static variable is used inside this class! Be sure you are NOT USING this class as static member or global variable before entering the main() function!

Definition at line 17 of file refcounter.h.


Member Typedef Documentation

typedef std::list<void*> RefCounter::TTempHeapPointers [private]
 

Definition at line 50 of file refcounter.h.


Constructor & Destructor Documentation

RefCounter::~RefCounter  )  [virtual]
 

Definition at line 8 of file refcounter.cpp.

RefCounter::RefCounter  )  [protected]
 

Definition at line 12 of file refcounter.cpp.

References mHeapAllocated, and mTmpHeapPtrs.


Member Function Documentation

void RefCounter::decRef  )  [inline, protected]
 

Definition at line 62 of file refcounter.h.

References assertL, mRefCount, OnZeroRefCount(), and TIN.

Referenced by RefCounterPtrBase::decRef().

Here is the call graph for this function:

int RefCounter::getRefCount void   )  [inline]
 

Definition at line 37 of file refcounter.h.

References mRefCount.

void RefCounter::incRef  )  [inline, protected]
 

Definition at line 56 of file refcounter.h.

References assertL, mRefCount, and TIN.

Referenced by RefCounterPtrBase::incRef().

bool RefCounter::isHeapAllocated void   )  [inline]
 

Definition at line 69 of file refcounter.h.

References mHeapAllocated.

Referenced by UniversalManager< T, ParrentClass >::ManagedItem::OnZeroRefCount(), and OnZeroRefCount().

void RefCounter::OnZeroRefCount  )  [protected, virtual]
 

Reimplemented in UniversalManager< T, ParrentClass >::ManagedItem.

Definition at line 31 of file refcounter.cpp.

References isHeapAllocated().

Referenced by decRef().

Here is the call graph for this function:

void * RefCounter::operator new size_t  size  ) 
 

Customized overloaded operator new (it only allocates memory).

This is used when a new object derived from RefCounter is constructed dynamically using the 'new'-operator. RefCounter needs to distinguish between instancess allocated on the heap and instances allocated on the stack. This is the place where it is performed.

Parameters:
size the size of constructed instance
Returns:
pointer to allocated memory for this instance

Definition at line 24 of file refcounter.cpp.

References mTmpHeapPtrs.


Friends And Related Function Documentation

friend class RefCounterPtrBase [friend]
 

Definition at line 53 of file refcounter.h.


Member Data Documentation

bool RefCounter::mHeapAllocated [private]
 

Definition at line 48 of file refcounter.h.

Referenced by isHeapAllocated(), and RefCounter().

int RefCounter::mRefCount [private]
 

Definition at line 47 of file refcounter.h.

Referenced by decRef(), getRefCount(), and incRef().

RefCounter::TTempHeapPointers RefCounter::mTmpHeapPtrs [static, private]
 

Definition at line 51 of file refcounter.h.

Referenced by operator new(), and RefCounter().


The documentation for this class was generated from the following files:
Generated on Wed Apr 12 14:21:12 2006 for bjs by  doxygen 1.4.5