OpenSceneGraph
3.4.0
|
Base class for providing reference counted objects. More...
Inherited by osg::ApplicationUsage, osg::ArrayDispatchers, osg::AttributeDispatch, osg::CullingSet, osg::CullSettings::ClampProjectionMatrixCallback, osg::DisplaySettings, osg::FrameStamp, osg::GeometryCostEstimator, osg::GLBufferObject, osg::GLBufferObjectManager, osg::GLBufferObjectSet, osg::GLExtensions, osg::GraphicsContext::ResizedCallback, osg::GraphicsContext::SwapCallback, osg::GraphicsContext::Traits, osg::GraphicsContext::WindowingSystemInterface, osg::GraphicsCostEstimator, osg::Image::DimensionsChangedCallback, osg::LineSegment, osg::NodeVisitor::DatabaseRequestHandler, osg::NodeVisitor::ImageRequestHandler, osg::NotifyHandler, osg::Object, osg::ObserverSet, osg::Operation [virtual]
, osg::OperationQueue, osg::OperationThread, osg::Program::PerContextProgram, osg::Program::ProgramObjects, osg::ProgramCostEstimator, osg::RefBlock [virtual]
, osg::RefBlockCount [virtual]
, osg::Shader::PerContextShader, osg::Shader::ShaderObjects, osg::State, osg::State::DynamicObjectRenderingCompletedCallback, osg::Stats, osg::TestResult, osg::Texture1D::SubloadCallback, osg::Texture2D::SubloadCallback, osg::Texture2DArray::SubloadCallback, osg::Texture3D::SubloadCallback, osg::Texture::TextureObject, osg::Texture::TextureObjectManager, osg::Texture::TextureObjectSet, osg::TextureBuffer::TextureBufferObject, osg::TextureCostEstimator, osg::TextureCubeMap::SubloadCallback, osg::TextureRectangle::SubloadCallback, osg::View::Slave::UpdateSlaveCallback [virtual]
, osgAnimation::ActionVisitor, osgAnimation::Channel, osgAnimation::KeyframeContainer, osgAnimation::Motion, osgAnimation::RigTransform, osgAnimation::Sampler, osgAnimation::Target, osgAnimation::TemplateCompositeSampler< VALUESAMPLERTYPE, TIMESAMPLERTYPE >, osgDB::AuthenticationDetails, osgDB::AuthenticationMap, osgDB::BaseCompressor, osgDB::BaseSerializer, osgDB::DatabasePager::DatabaseRequest, osgDB::DatabasePager::DatabaseThread, osgDB::DatabasePager::PagedLODList, osgDB::DatabasePager::RequestQueue, osgDB::DeprecatedDotOsgWrapperManager, osgDB::DotOsgWrapper, osgDB::DynamicLibrary, osgDB::FileCache, osgDB::FileLocationCallback [virtual]
, osgDB::FindFileCallback [virtual]
, osgDB::FinishedObjectReadCallback, osgDB::ImageOptions::TexCoordRange, osgDB::ImagePager::ImageRequest, osgDB::ImagePager::ImageThread, osgDB::ImagePager::RequestQueue, osgDB::InputException, osgDB::InputIterator, osgDB::MethodObject, osgDB::ObjectCache, osgDB::ObjectWrapper, osgDB::ObjectWrapperManager, osgDB::OutputException, osgDB::OutputIterator, osgDB::ReaderWriterInfo, osgDB::ReadFileCallback [virtual]
, osgDB::Registry, osgDB::WriteFileCallback [virtual]
, osgDB::XmlNode, osgFX::Registry, osgFX::Technique, osgGA::AnimationPathManipulator::AnimationCompletedCallback [virtual]
, osgGA::CameraManipulator::CoordinateFrameCallback, osgGA::EventQueue, osgGA::PointerData, osgGA::StandardManipulator::AnimationData, osgManipulator::CommandManager, osgManipulator::Constraint, osgManipulator::MotionCommand, osgManipulator::Projector, osgQt::GraphicsWindowQt::WindowData, osgShadow::ParallelSplitShadowMap::FragmentShaderGenerator, osgShadow::ViewDependentShadowMap::LightData, osgShadow::ViewDependentShadowMap::ShadowData, osgShadow::ViewDependentShadowMap::ViewDependentData, osgShadow::ViewDependentShadowTechnique::ViewData, osgSim::GeographicLocation, osgSim::ImpostorSpriteManager, osgSim::OverlayNode::OverlayData, osgSim::ScalarBar::ScalarPrinter, osgSim::ScalarsToColors, osgTerrain::GeometryPool, osgTerrain::GeometryTechnique::BufferData, osgTerrain::TerrainTile::TileLoadedCallback, osgTerrain::ValidDataOperator, osgText::Font::FontImplementation, osgText::Glyph3D, osgText::GlyphGeometry, osgUtil::CubeMapGenerator, osgUtil::CullVisitor::Identifier, osgUtil::DelaunayTriangulator, osgUtil::EdgeCollector::Edge, osgUtil::EdgeCollector::Edgeloop, osgUtil::EdgeCollector::Point, osgUtil::EdgeCollector::Triangle, osgUtil::IncrementalCompileOperation::CompileCompletedCallback [virtual]
, osgUtil::IncrementalCompileOperation::CompileOp, osgUtil::IncrementalCompileOperation::CompileSet, osgUtil::IntersectionVisitor::ReadCallback, osgUtil::Intersector, osgUtil::IntersectVisitor::IntersectState, osgUtil::Optimizer::IsOperationPermissibleForObjectCallback, osgUtil::Optimizer::TextureAtlasBuilder::Atlas, osgUtil::Optimizer::TextureAtlasBuilder::Source, osgUtil::RenderBin::DrawCallback, osgUtil::RenderBin::SortCallback, osgUtil::RenderLeaf, osgUtil::SceneView::ComputeStereoMatricesCallback, osgUtil::ShaderGenCache, osgUtil::Simplifier::ContinueSimplificationCallback, osgUtil::StateGraph, osgUtil::TangentSpaceGenerator, osgUtil::Tessellator, osgUtil::Tessellator::Prim, osgViewer::DepthPartitionSettings, osgViewer::GraphicsWindowWin32::WindowData, osgViewer::GraphicsWindowX11::WindowData, osgViewer::OpenGLQuerySupport, osgViewer::Scene, osgViewer::ScreenCaptureHandler::CaptureOperation, osgVolume::TileData, osgVolume::VolumeScene::ViewData, osgWidget::Callback, osgWidget::CallbackInterface, and osgWidget::ScriptEngine.
Public Member Functions | |
Referenced () | |
Referenced (bool threadSafeRefUnref) | |
Referenced (const Referenced &) | |
Referenced & | operator= (const Referenced &) |
virtual void | setThreadSafeRefUnref (bool threadSafe) |
Set whether to use a mutex to ensure ref() and unref() are thread safe. | |
bool | getThreadSafeRefUnref () const |
Get whether a mutex is used to ensure ref() and unref() are thread safe. | |
OpenThreads::Mutex * | getRefMutex () const |
Get the mutex used to ensure thread safety of ref()/unref(). | |
int | ref () const |
Increment the reference count by one, indicating that this object has another pointer which is referencing it. | |
int | unref () const |
Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. | |
int | unref_nodelete () const |
Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. | |
int | referenceCount () const |
Return the number of pointers currently referencing this object. | |
ObserverSet * | getObserverSet () const |
Get the ObserverSet if one is attached, otherwise return NULL. | |
ObserverSet * | getOrCreateObserverSet () const |
Get the ObserverSet if one is attached, otherwise create an ObserverSet, attach it, then return this newly created ObserverSet. | |
void | addObserver (Observer *observer) const |
Add a Observer that is observing this object, notify the Observer when this object gets deleted. | |
void | removeObserver (Observer *observer) const |
Remove Observer that is observing this object. | |
Static Public Member Functions | |
static OpenThreads::Mutex * | getGlobalReferencedMutex () |
Get the optional global Referenced mutex, this can be shared between all osg::Referenced. | |
static void | setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting) |
Set whether reference counting should use a mutex for thread safe 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. | |
static DeleteHandler * | getDeleteHandler () |
Get a DeleteHandler. | |
Protected Member Functions | |
virtual | ~Referenced () |
void | signalObserversAndDelete (bool signalDelete, bool doDelete) const |
void | deleteUsingDeleteHandler () const |
Protected Attributes | |
OpenThreads::AtomicPtr | _observerSet |
OpenThreads::Atomic | _refCount |
Friends | |
class | DeleteHandler |
Base class for providing reference counted objects.
osg::Referenced::Referenced | ( | bool | threadSafeRefUnref | ) | [explicit] |
osg::Referenced::Referenced | ( | const Referenced & | ) |
virtual osg::Referenced::~Referenced | ( | ) | [protected, virtual] |
void osg::Referenced::addObserver | ( | Observer * | observer | ) | const |
void osg::Referenced::deleteUsingDeleteHandler | ( | ) | const [protected] |
static DeleteHandler* osg::Referenced::getDeleteHandler | ( | ) | [static] |
Get a DeleteHandler.
static OpenThreads::Mutex* osg::Referenced::getGlobalReferencedMutex | ( | ) | [static] |
Get the optional global Referenced mutex, this can be shared between all osg::Referenced.
ObserverSet* osg::Referenced::getObserverSet | ( | ) | const [inline] |
Get the ObserverSet if one is attached, otherwise return NULL.
Get the ObserverSet if one is attached, otherwise create an ObserverSet, attach it, then return this newly created ObserverSet.
Referenced by osg::observer_ptr< Skeleton >::observer_ptr(), and osg::observer_ptr< Skeleton >::operator=().
OpenThreads::Mutex* osg::Referenced::getRefMutex | ( | ) | const [inline] |
Get the mutex used to ensure thread safety of ref()/unref().
static bool osg::Referenced::getThreadSafeReferenceCounting | ( | ) | [static] |
Get whether reference counting is active.
bool osg::Referenced::getThreadSafeRefUnref | ( | ) | const [inline] |
Referenced& osg::Referenced::operator= | ( | const Referenced & | ) | [inline] |
int osg::Referenced::ref | ( | ) | const [inline] |
Increment the reference count by one, indicating that this object has another pointer which is referencing it.
References _refCount.
Referenced by osg::intrusive_ptr_add_ref().
int osg::Referenced::referenceCount | ( | ) | const [inline] |
Return the number of pointers currently referencing this object.
void osg::Referenced::removeObserver | ( | Observer * | observer | ) | const |
Remove Observer that is observing this object.
static void osg::Referenced::setDeleteHandler | ( | DeleteHandler * | handler | ) | [static] |
Set a DeleteHandler to which deletion of all referenced counted objects will be delegated.
static void osg::Referenced::setThreadSafeReferenceCounting | ( | bool | enableThreadSafeReferenceCounting | ) | [static] |
Set whether reference counting should use a mutex for thread safe reference counting.
virtual void osg::Referenced::setThreadSafeRefUnref | ( | bool | threadSafe | ) | [virtual] |
Set whether to use a mutex to ensure ref() and unref() are thread safe.
Reimplemented in osg::StateSet, osg::Node, osgText::Text, osgText::GlyphTexture, osg::Drawable, osgText::TextBase, osgText::Glyph3D, osgSim::OverlayNode::OverlayData, osgText::Font, osgText::GlyphGeometry, osg::Group, osg::Object, osgSim::OverlayNode, osgText::Text3D, osg::LightSource, osg::Program, and osg::TexGenNode.
void osg::Referenced::signalObserversAndDelete | ( | bool | signalDelete, |
bool | doDelete | ||
) | const [protected] |
Referenced by unref().
int osg::Referenced::unref | ( | ) | const [inline] |
Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it.
If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.
References _refCount, and signalObserversAndDelete().
Referenced by osg::intrusive_ptr_release().
int osg::Referenced::unref_nodelete | ( | ) | const |
Decrement the reference count by one, indicating that a pointer to this object is no longer 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 responsible for, one should prefer unref() over unref_nodelete() as the latter can lead to memory leaks.
Referenced by osg::observer_ptr< Skeleton >::lock().
friend class DeleteHandler [friend] |
OpenThreads::AtomicPtr osg::Referenced::_observerSet [mutable, protected] |
OpenThreads::Atomic osg::Referenced::_refCount [mutable, protected] |
![]() | Generated at Tue Dec 8 2015 00:14:25 for the OpenSceneGraph by doxygen 1.7.6.1. |