/home/boudevil/Projects/Generic/Personnel/LOANI-testing/LOANI-0.6/LOANI-repository/ceylan/Ceylan/trunk/src/code/generic/CeylanCountedPointer.h

Pointers with reference counting.
 CountedPointer<AnObjectType> p = new AnObjectType(...) ;
 p->aMethod() ;
 

This pointer will track the references to the specified resource, which will be deallocated only when nobody references it any more.

For each counted resource, exactly one referent will exist.

Original name: CountedPointer.h Original date: 07/24/99

Author:
Robert Di Falco (http://c2.com/cgi/wiki?RobertDiFalco)
Implementation of the CountedPointer specification. Uses a 'static default' referent to improve the performance when being default constructed by an array or collection.

define CEYLAN_COUNTED_POINTER_USE_COPY_ON_WRITE

Define the above constant if you wish to enable the CountedPointer::isolate member, which is useful for using CountedPointer as the base for a string class that uses copyOnWrite for its non-const members.

Note:
Not for multithread use.

Does not deal with circular references.

Another use of this pointer is to hold local resources so that they get deallocated whatever happens in the method (return, exceptions, etc.).


Generated on Thu Jun 4 20:39:15 2009 for Ceylan by  doxygen 1.5.8