H3DUtil::RefCountedClass Class Reference

Base class for all classes that should be reference counted. More...

#include <H3DUtil/RefCountedClass.h>

Inheritance diagram for H3DUtil::RefCountedClass:

Inheritance graph

List of all members.

Public Member Functions

 RefCountedClass ()
 Constructor.
 RefCountedClass (bool _use_lock)
 Constructor.
virtual ~RefCountedClass ()
 Destructor.
virtual void initialize ()
 Initialize is called once upon the first reference of the RefCountedClass.
void ref ()
 Increase the reference count for this instance.
void setManualInitialize (bool b)
 If true, the initialize() function will not be called automatically on first reference of the instance but must be called manually by the creator of the instance.
bool getManualInitialize ()
 Returns if the RefCountedClass has to be manually initialized or not.
void unref ()
 Decrease the reference count for this instance.
string getName ()
 Get the name of the node.
void setName (const string &_name)
 Set the name of the node.
bool hasName ()
 Returns true if this node has been given a name.
string getTypeName ()
 Get the name of this Node type.
bool isInitialized ()
 Returns true if the initialize() function has been called.

Protected Attributes

unsigned int ref_count
 The number of references to this instance.
string name
 The name.
string type_name
 String version of the name of the type.
bool is_initialized
 true if initialize() function has been called.
bool manual_initialize
 If true, the initialize() function will not be called automatically on first reference of the instance but must be called manually by the creator of the instance.
MutexLockref_count_lock_pointer
 Lock for thread access to ref_count.


Detailed Description

Base class for all classes that should be reference counted.

Constructor & Destructor Documentation

RefCountedClass::RefCountedClass ( bool  _use_lock  ) 

Constructor.

Parameters:
_use_lock If true locks will be used when reference counting. Used to make class thread safe.

References ref_count_lock_pointer.


Member Function Documentation

string H3DUtil::RefCountedClass::getTypeName (  )  [inline]

Get the name of this Node type.

E.g. if the Node is an IndexedFaceSet it should return "IndexedFaceSet"

virtual void H3DUtil::RefCountedClass::initialize (  )  [inline, virtual]

void H3DUtil::RefCountedClass::setManualInitialize ( bool  b  )  [inline]

If true, the initialize() function will not be called automatically on first reference of the instance but must be called manually by the creator of the instance.

void RefCountedClass::unref (  ) 

Decrease the reference count for this instance.

If the reference count reaches 0 it is deleted.

References getName(), H3DUtil::MutexLock::lock(), ref_count, ref_count_lock_pointer, and H3DUtil::MutexLock::unlock().


Member Data Documentation

If true, the initialize() function will not be called automatically on first reference of the instance but must be called manually by the creator of the instance.

Referenced by ref().


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

Generated on Fri Nov 7 10:23:44 2008 for H3DUtil by  doxygen 1.5.7