Developer Documentation
Centre for Vision, Speech & Signal Processing
USER IN NAMESPACE AMMA TREE ROOT AMMA SEARCH AMMA HOME
 

  PUBLIC
RefCounterC::ToBeDeleted(void) const
RefCounterC::Count(void) const
RefCounterC::IsSingleReference(void)
RefCounterC::RefCounterC(BooleanT)
RefCounterC::RefCounterC(const RefCounterC &)
RefCounterC::operator=(const RefCounterC &)
RefCounterC::~RefCounterC(void)
RefCounterC::ToBeDeletedUpdate(const RefCounterC &)
RefCounterC::ReportInvalidObject(char *)
RefCounterBaseC::Label(void) const
RefCounterC
 
Special counter for huge dynamic objects.
 
include "amma/RefCount.hh"
User Level:Default
Library:MRefC
Example:exBRefC.cc
Section:Basic Types.Refrence Counting
In Scope:std

Comments:
The class RefCounterC is a reference counter which should be always inherited if a class contains pointers to allocated memory and the memory is shared by several objects. All constructors, a destructor, and an assigment operator must be modified in such class. The destructor is not virtual, therefore the class should be inherited as private or protected.

The RefCounterC class allocates its own memory separately from a memory of object.

Parent Classes: Derived Classes: Variables:
BodyRefCounterC * body;

Methods:
BooleanT ToBeDeleted() const
Returns TRUE if the content should be deleted.

RCCountT Count() const
Returns the number of refrences to this object. NB. The following definition is now obsolete, The value 0 means there is no other reference to this object.

BooleanT IsSingleReference()
Tests is there is only one reference to this object.

RefCounterC(BooleanT removable = TRUE)
Creates the reference counter and initializes it. If the value of the argument 'removable' is FALSE, the reference counter still treats the current number of references, but the value of the member functions ToBeDeleted is always FALSE.

RefCounterC(const RefCounterC & rC)
Copy constructor which adds another reference to the object.

const RefCounterC & operator=(const RefCounterC & rC)

~RefCounterC()
Destructor. If the reference counter keeps a track of only one reference, it is deleted. Special functions -----------------

BooleanT ToBeDeletedUpdate(const RefCounterC & rC)
This function is the condition and the assigment together. It returns TRUE if the content should be deleted before assigning of the new object. The function automatically solves the reference counter of this object as well as the other object reference counter 'rC'.

void ReportInvalidObject(char * Msg = 0)
This function reports an error to the user if a problem is detected in the refrence counting mechanism.

#include "amma/RefCBase.hh"
LabelT Label() const
Returns the label of this reference counter.
The member function is useful mainly to recognize objects during debugging. The value of the label is uniquely defined pointer.


Programmer:Radek Marik, Documentation by CxxDoc: Tue Mar 20 10:49:27 2001