Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::Referenced Class Reference

Base class from providing referencing counted objects. More...

Inheritance diagram for osg::Referenced:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Referenced ()
 Referenced (const Referenced &)
Referencedoperator= (const Referenced &)
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it.
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it.
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it.
int referenceCount () const
 return the number pointers currently referencing this object.

Static Public Member Functions

static void setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting)
 Set whether reference counting should be use a mutex to create thread reference counting.
static bool getThreadSafeReferenceCounting ()
 Get whether reference counting is active.
static void setDeleteHandler (DeleteHandler *handler)
 Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
static DeleteHandlergetDeleteHandler ()
 Get a DeleteHandler.

Protected Member Functions

virtual ~Referenced ()

Protected Attributes

OpenThreads::Mutex _refMutex
int _refCount

Friends

class DeleteHandler

Detailed Description

Base class from providing referencing counted objects.


Constructor & Destructor Documentation

osg::Referenced::Referenced  )  [inline]
 

osg::Referenced::Referenced const Referenced  )  [inline]
 

osg::Referenced::~Referenced  )  [protected, virtual]
 


Member Function Documentation

DeleteHandler * osg::Referenced::getDeleteHandler  )  [static]
 

Get a DeleteHandler.

bool osg::Referenced::getThreadSafeReferenceCounting  )  [static]
 

Get whether reference counting is active.

Referenced& osg::Referenced::operator= const Referenced  )  [inline]
 

void osg::Referenced::ref  )  const
 

increment the reference count by one, indicating that this object has another pointer which is referencing it.

int osg::Referenced::referenceCount  )  const [inline]
 

return the number pointers currently referencing this object.

void osg::Referenced::setDeleteHandler DeleteHandler handler  )  [static]
 

Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.

void osg::Referenced::setThreadSafeReferenceCounting bool  enableThreadSafeReferenceCounting  )  [static]
 

Set whether reference counting should be use a mutex to create thread reference counting.

void osg::Referenced::unref  )  const
 

decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.

void osg::Referenced::unref_nodelete  )  const
 

decrement the reference count by one, indicating that a pointer to this object is referencing it.

However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be resonsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.


Friends And Related Function Documentation

friend class DeleteHandler [friend]
 


Member Data Documentation

int osg::Referenced::_refCount [mutable, protected]
 

OpenThreads::Mutex osg::Referenced::_refMutex [mutable, protected]
 


The documentation for this class was generated from the following files:
Generated at Thu Oct 13 09:03:02 2005 for the OpenSceneGraph by doxygen 1.4.1.