Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

ReferenceCounting

Code to support reference-count garbage collection, see the Reference Counting section of the manual. More...


Files

file  IotrRefCount.hh
 Definitions relating to the IotrRefCount class.


Compounds

class  Handle
 A class whose instances act like pointers that manage their reference count automatically. More...

class  IotrRefCount
 A base class for classes that support reference-count garbage collection, see the Reference Counting section of the manual. More...


Functions

template<class T> void HandleNil (Handle< T > &handle)
 Set a Handle to nil.

template<class T> void HandleReferTo (Handle< T > &handle, T *obj)
 Make a Handle refer to the same object as a traditional pointer.

template<class T> T * HandleAsPointer (Handle< T > &handle)
 Call HandleAsPointer instead; returns a traditional pointer to the underlying object.

template<class T> void IotrRelease (T **obj)
 Release a reference to an object.

template<class T> void IotrAddRef (T *const *obj)
 Increments the reference count of obj.

void release (IotrRefCount **obj)
 Release this reference to obj: it is more convenient to call the template function IotrRelease().

void addRef (IotrRefCount *const *obj)
 Increment the reference count of this object: it is more convenient to call the template function IotrAddRef().


Detailed Description

Code to support reference-count garbage collection, see the Reference Counting section of the manual.


Function Documentation

void IotrRefCount::addRef IotrRefCount *const *    obj [inline, static, inherited]
 

Increment the reference count of this object: it is more convenient to call the template function IotrAddRef().

The parameter obj contains the address of a pointer of type exactly (IotrRefCount *). In other words it can't be a pointer to an instance of a subclass. IotrAddRef() does not have this restriction.

See also:
IotrAddRef

template<class T>
T* HandleAsPointer Handle< T > &    handle [inline]
 

Call HandleAsPointer instead; returns a traditional pointer to the underlying object.

This pointer has its reference count incremented so that it will continue to exist after the Handle goes out of scope. Use this method to return a pointer to the object, or to create a new traditional pointer reference to the object.

template<class T>
void HandleReferTo Handle< T > &    handle,
T *    obj
[inline]
 

Make a Handle refer to the same object as a traditional pointer.

The reference count is incremented. Use this function to keep a reference to a parameter of a routine.

template<class T>
void IotrAddRef T *const *    obj [inline]
 

Increments the reference count of obj.

Objects are only deleted when their reference count becomes zero, so this call must be balanced by a call to IotrRelease to decrement the reference count when this object is no longer needed.

Parameters:
obj  the address of a pointer to the object whose reference count is to be incremented. The pointer (*obj) will be unaltered.
See also:
IotrRelease

template<class T>
void IotrRelease T **    obj [inline]
 

Release a reference to an object.

If the number of references to obj becomes zero, delete the object.

Parameters:
obj  the address of a pointer to the object to be released. On exit, this pointer (*obj) will be set to nil.

void IotrRefCount::release IotrRefCount **    obj [inline, static, inherited]
 

Release this reference to obj: it is more convenient to call the template function IotrRelease().

The parameter obj contains the address of a pointer of type exactly (IotrRefCount *). In other words it can't be a pointer to an instance of a subclass. IotrRelease() does not have this restriction.

See also:
IotrRelease.


Generated on Wed Aug 27 10:03:42 2003 for iotr by doxygen1.2.18