osg::Referenced Class Reference

Inheritance diagram for osg::Referenced:

osg::BlendColor::Extensions osg::BlendEquation::Extensions osg::BlendFunc::Extensions osg::Block osg::BufferObject::Extensions osg::ClampColor::Extensions osg::CullingSet osg::CullSettings::ClampProjectionMatrixCallback osg::DisplaySettings osg::Drawable::Extensions osg::FBOExtensions osg::FragmentProgram::Extensions osg::FrameStamp osg::GL2Extensions osg::GraphicsContext osg::GraphicsContext::CreateGraphicContextCallback osg::GraphicsContext::Traits osg::GraphicsThread osg::GraphicsThread::Operation osg::LineSegment osg::Multisample::Extensions osg::NodeVisitor osg::NodeVisitor::DatabaseRequestHandler osg::Object osg::Point::Extensions osg::Program::PerContextProgram osg::Shader::PerContextShader osg::State osg::Texture1D::SubloadCallback osg::Texture2D::SubloadCallback osg::Texture3D::Extensions osg::Texture3D::SubloadCallback osg::Texture::Extensions osg::Texture::TextureObject osg::TextureCubeMap::Extensions osg::TextureCubeMap::SubloadCallback osg::TextureRectangle::SubloadCallback osg::VertexProgram::Extensions osgDB::DatabasePager::DatabaseRequest osgDB::DotOsgWrapper osgDB::DynamicLibrary osgDB::ImageOptions::TexCoordRange osgDB::Registry osgDB::Registry::ReadFileCallback osgDB::Registry::WriteFileCallback osgFX::Registry osgFX::Technique osgGA::EventQueue osgGA::GUIEventAdapter osgGA::MatrixManipulator::CoordinateFrameCallback osgProducer::OsgCameraGroup::RealizeCallback osgProducer::OsgSceneHandler::Callback osgSim::GeographicLocation osgSim::ImpostorSpriteManager osgSim::ScalarBar::ScalarPrinter osgSim::ScalarsToColors osgTerrain::DataSet osgTerrain::DataSet::CompositeDestination osgTerrain::DataSet::CompositeSource osgTerrain::DataSet::DestinationData osgTerrain::DataSet::DestinationTile osgTerrain::DataSet::Source osgTerrain::DataSet::SourceData osgText::Font::FontImplementation osgUtil::CubeMapGenerator osgUtil::DelaunayTriangulator osgUtil::IntersectVisitor::IntersectState osgUtil::Optimizer::IsOperationPermissibleForObjectCallback osgUtil::Optimizer::TextureAtlasBuilder::Atlas osgUtil::Optimizer::TextureAtlasBuilder::Source osgUtil::RenderBin::DrawCallback osgUtil::RenderBin::SortCallback osgUtil::RenderLeaf osgUtil::SceneView osgUtil::SceneView::ComputeStereoMatricesCallback osgUtil::Simplifier::ContinueSimplificationCallback osgUtil::StateGraph osgUtil::TangentSpaceGenerator osgUtil::Tesselator osgUtil::Tesselator::Prim osgUtx::Test List of all members.

Public Member Functions

 Referenced ()
 Referenced (bool threadSafeRefUnref)
 Referenced (const Referenced &)
Referencedoperator= (const Referenced &)
void setThreadSafeRefUnref (bool threadSafe)
bool getThreadSafeRefUnref () const
void ref () const
void unref () const
void unref_nodelete () const
int referenceCount () const
void addObserver (Observer *observer)
void removeObserver (Observer *observer)

Static Public Member Functions

static void setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting)
static bool getThreadSafeReferenceCounting ()
static void setDeleteHandler (DeleteHandler *handler)
static DeleteHandlergetDeleteHandler ()

Protected Member Functions

virtual ~Referenced ()

Protected Attributes

OpenThreads::Mutex * _refMutex
int _refCount
void * _observers

Friends

class DeleteHandler

Detailed Description

Base class from providing referencing counted objects.


Constructor & Destructor Documentation

osg::Referenced::Referenced (  ) 

osg::Referenced::Referenced ( bool  threadSafeRefUnref  )  [explicit]

osg::Referenced::Referenced ( const Referenced  ) 

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


Member Function Documentation

void osg::Referenced::addObserver ( Observer observer  ) 

Add a Observer that is observering this object, notify the Observer when this object gets deleted.

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

Get a DeleteHandler.

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

Get whether reference counting is active.

bool osg::Referenced::getThreadSafeRefUnref (  )  const [inline]

Get whether a mutex is used to ensure ref() and unref() are thread safe.

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

void osg::Referenced::ref (  )  const [inline]

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::removeObserver ( Observer observer  ) 

Add a Observer that is observering this object, notify the Observer when this object gets deleted.

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

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

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

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

void osg::Referenced::setThreadSafeRefUnref ( bool  threadSafe  ) 

Set whether to use a mutex to ensure ref() and unref() are thread safe.

void osg::Referenced::unref (  )  const [inline]

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

void* osg::Referenced::_observers [protected]

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

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


The documentation for this class was generated from the following file:
Generated on Sun Oct 1 13:17:07 2006 for openscenegraph by  doxygen 1.4.7