ReferenceCounted Class Reference

Base classe for reference-counted objects. More...

#include <reference_counted.h>

Inheritance diagram for ReferenceCounted:

Object Material MaterialList Mesh MeshMaterialMapping SceneGraphNode Texture PhongMaterial GroupNode MeshNode TransformNode TexturedPhongMaterial

List of all members.

Public Member Functions

 ReferenceCounted ()
 Initialize the reference count to zero.
virtual ~ReferenceCounted ()
 A constructor that does nothing.
void inc_ref ()
 Increase the reference by one.
void dec_ref ()
 Decrease the reference by one. Deallocate the object from the heap if the reference count is zero.
int get_ref_count ()
 Return the number of references to the object.

Private Attributes

int ref_count_
 The number of references to the object.


Detailed Description

Base classe for reference-counted objects.

It is strongly advised that reference-counted objects only be created on the heap. If they are created on the stack, you should not call dec_ref; otherwise the program will crash.


Constructor & Destructor Documentation

ReferenceCounted::ReferenceCounted (  )  [inline]

Initialize the reference count to zero.

virtual ReferenceCounted::~ReferenceCounted (  )  [inline, virtual]

A constructor that does nothing.


Member Function Documentation

void ReferenceCounted::dec_ref (  )  [inline]

Decrease the reference by one. Deallocate the object from the heap if the reference count is zero.

This function should not be called if the object is created on the stack.

int ReferenceCounted::get_ref_count (  )  [inline]

Return the number of references to the object.

void ReferenceCounted::inc_ref (  )  [inline]

Increase the reference by one.


Member Data Documentation

The number of references to the object.


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

Generated on Tue Sep 8 02:20:35 2009 for cglib by  doxygen 1.5.9