Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

RefCount Class Reference

An abstract class for reference counting. More...

#include <refCount.h>

Inheritance diagram for RefCount::

ListItem LI1 LI2 LI3 LI4 LI5 AllocArena AllocGlobalRef AllocInstance AllocObject AllocObjectMethod AllocObjectTrace AllocThreadMethod AllocThreadObject AllocThreadObjectMethod AllocThreadObjectTrace AllocThreadTrace AllocTrace Class ClassField CpuThreadMethod CpuThreadTrace CpuTrace GC GroupThread IProf::sID Method MonThreadMethod MonThreadTrace MonTrace ObjectTable Thread AllocInstance AllocObject AllocObjectMethod AllocObjectTrace AllocThreadMethod AllocThreadObject AllocThreadObjectMethod AllocThreadObjectTrace AllocThreadTrace AllocTrace Class CpuThreadMethod CpuThreadTrace CpuTrace Method MonThreadMethod MonThreadTrace MonTrace Thread AllocObjectMethod AllocObjectTrace AllocThreadMethod AllocThreadObject AllocThreadObjectMethod AllocThreadObjectTrace AllocThreadTrace CpuThreadMethod CpuThreadTrace MonThreadMethod MonThreadTrace Thread AllocThreadObjectMethod AllocThreadObjectTrace Thread Thread List of all members.

Public Methods

virtual ~RefCount ()
 Destructor. It does nothing.

void addRef ()
 Reference count incrementation. More...

void releaseRef ()
 Reference count decrementation. More...

virtual void destroy ()
 Suicide. More...


Protected Methods

 RefCount ()
 Default _PROTECTED_ constructor.


Private Attributes

int _count
 number of references to this object.


Detailed Description

An abstract class for reference counting.

Each class, which needs reference counting, must be a descendant of this class (or must implement it by itself). It was mainly created to be used by ListItem class in list and hashtable implementations.

Note: there is a big difference between this implementation and usual ones. When reference count of the object decreases to zero, it is not destroyed. Special destroy() method must be called.

Author:
Marek Przeczek

Definition at line 51 of file refCount.h.


Member Function Documentation

void RefCount::addRef   [inline]
 

Reference count incrementation.

This method increments number of references.

See also:
releaseRef()

Definition at line 75 of file refCount.h.

Referenced by ListItem::add().

virtual void RefCount::destroy   [inline, virtual]
 

Suicide.

In case the number of references is zero, this method destroys the instance it was called for. The object should be created dynamically ;-)

Definition at line 88 of file refCount.h.

void RefCount::releaseRef   [inline]
 

Reference count decrementation.

This method decrements number of references.

See also:
addRef()

Definition at line 82 of file refCount.h.

Referenced by ListItem::remove().


The documentation for this class was generated from the following file:
Generated on Mon Jan 28 14:53:30 2002 for Java Profiler Dynamic Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001