Public Member Functions | Static Public Member Functions | List of all members
Celartem::Referable Class Reference

#include <cel_referable.h>

Inheritance diagram for Celartem::Referable:
Inheritance graph

Public Member Functions

 Referable ()
void addRef () const
void releaseRef () const
size_t getReferenceCount () const

Static Public Member Functions

static void dumpDbgAllRefCount ()

Detailed Description

Referable is an abstract class that provides object lifetime management feature using reference count. On the first time the object is created, it's reference count is 1. This means someone is referring to the object. And then another one may want to refer to the object, then it increments the reference count by calling addRef. If a referrer no longer need to refer it, it should call releaseRef, releaseRef decrements the reference count. If the reference count becomes 0, then the object is released (deleted).
The Referable class uses thread-safe increment/decrement mechanism.

Constructor & Destructor Documentation

Celartem::Referable::Referable ( )

The constructor resets the reference count to 0.

Member Function Documentation

void Celartem::Referable::addRef ( ) const

This method increments the reference count.

static void Celartem::Referable::dumpDbgAllRefCount ( )

For internal uses only.

size_t Celartem::Referable::getReferenceCount ( ) const

This method obtains the current reference count of the instance. For thread-safety, you should not depend on this method.

void Celartem::Referable::releaseRef ( ) const

This method decrements the reference count and if the reference count becomes 0, it also delete the instance.

The documentation for this class was generated from the following file:

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo