openscenegraph
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
osg::Object Class Referenceabstract
Inheritance diagram for osg::Object:
osg::Referenced osg::AnimationPath osg::AudioSink osg::AudioStream osg::BufferData osg::BufferData::ModifiedCallback osg::BufferObject osg::Camera::DrawCallback osg::ConvexPlanarOccluder osg::Drawable osg::Drawable::ComputeBoundingBoxCallback osg::Drawable::CullCallback osg::Drawable::DrawCallback osg::Drawable::EventCallback osg::Drawable::UpdateCallback osg::EllipsoidModel osg::GraphicsContext osg::Node osg::Node::ComputeBoundingSphereCallback osg::NodeCallback osg::Program::ProgramBinary osg::RefMatrixd osg::RefMatrixf osg::RenderBuffer osg::Shader osg::ShaderBinary osg::ShaderComponent osg::ShaderComposer osg::Shape osg::StateAttribute osg::StateAttributeCallback osg::StateSet osg::StateSet::Callback osg::TessellationHints osg::TransferFunction osg::Uniform osg::Uniform::Callback osg::UserDataContainer osg::ValueObject osg::View osgAnimation::Action osgAnimation::Action::Callback osgAnimation::Animation osgAnimation::AnimationUpdateCallbackBase osgAnimation::StackedTransformElement osgAnimation::VertexInfluenceMap osgDB::DatabaseRevision osgDB::DatabaseRevisions osgDB::FileList osgDB::ImageProcessor osgDB::Options osgDB::ReaderWriter osgGA::GUIEventAdapter osgManipulator::DraggerCallback osgParticle::Counter osgParticle::Interpolator osgParticle::Operator osgParticle::Placer osgParticle::Shooter osgPresentation::AnimationMaterial osgShadow::ShadowTechnique osgSim::BlinkSequence osgSim::LightPointSystem osgSim::ObjectRecordData osgSim::Sector osgSim::SequenceGroup osgSim::ShapeAttributeList osgTerrain::Layer osgTerrain::Locator osgTerrain::TerrainTechnique osgText::Bevel osgText::Font osgText::Style osgUtil::PositionalStateContainer osgUtil::RenderBin osgUtil::SceneView osgViewer::ViewerBase osgVolume::ImageDetails osgVolume::Layer osgVolume::Locator osgVolume::Locator::LocatorCallback osgVolume::Property osgVolume::VolumeTechnique osgWidget::BrowserManager osgWidget::Style osgWidget::StyleManager

Public Types

enum  DataVariance { DYNAMIC, STATIC, UNSPECIFIED }
 

Public Member Functions

 Object ()
 
 Object (bool threadSafeRefUnref)
 
 Object (const Object &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 
virtual ObjectcloneType () const =0
 
virtual Objectclone (const CopyOp &) const =0
 
virtual bool isSameKindAs (const Object *) const
 
virtual const char * libraryName () const =0
 
virtual const char * className () const =0
 
virtual void setThreadSafeRefUnref (bool threadSafe)
 
virtual void setName (const std::string &name)
 
void setName (const char *name)
 
const std::string & getName () const
 
void setDataVariance (DataVariance dv)
 
DataVariance getDataVariance () const
 
virtual void computeDataVariance ()
 
void setUserDataContainer (osg::UserDataContainer *udc)
 
osg::UserDataContainergetUserDataContainer ()
 
const osg::UserDataContainergetUserDataContainer () const
 
osg::UserDataContainergetOrCreateUserDataContainer ()
 
virtual void setUserData (Referenced *obj)
 
virtual ReferencedgetUserData ()
 
virtual const ReferencedgetUserData () const
 
template<typename T >
bool getUserValue (const std::string &name, T &value) const
 
template<typename T >
void setUserValue (const std::string &name, const T &value)
 
virtual void resizeGLObjectBuffers (unsigned int)
 
virtual void releaseGLObjects (osg::State *=0) const
 
- Public Member Functions inherited from osg::Referenced
 Referenced ()
 
 Referenced (bool threadSafeRefUnref)
 
 Referenced (const Referenced &)
 
Referencedoperator= (const Referenced &)
 
bool getThreadSafeRefUnref () const
 
OpenThreads::MutexgetRefMutex () const
 
int ref () const
 
int unref () const
 
int unref_nodelete () const
 
int referenceCount () const
 
ObserverSetgetObserverSet () const
 
ObserverSetgetOrCreateObserverSet () const
 
void addObserver (Observer *observer) const
 
void removeObserver (Observer *observer) const
 

Protected Member Functions

virtual ~Object ()
 
- Protected Member Functions inherited from osg::Referenced
virtual ~Referenced ()
 
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

std::string _name
 
DataVariance _dataVariance
 
osg::UserDataContainer_userDataContainer
 
- Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
 
OpenThreads::Atomic _refCount
 

Additional Inherited Members

- Static Public Member Functions inherited from osg::Referenced
static OpenThreads::MutexgetGlobalReferencedMutex ()
 
static void setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting)
 
static bool getThreadSafeReferenceCounting ()
 
static void setDeleteHandler (DeleteHandler *handler)
 
static DeleteHandlergetDeleteHandler ()
 

Detailed Description

Base class/standard interface for objects which require IO support, cloning and reference counting. Based on GOF Composite, Prototype and Template Method patterns.

Member Enumeration Documentation

Enumerator:
DYNAMIC 
STATIC 
UNSPECIFIED 

Constructor & Destructor Documentation

osg::Object::Object ( )
inline

Construct an object. Note Object is a pure virtual base class and therefore cannot be constructed on its own, only derived classes which override the clone and className methods are concrete classes and can be constructed.

osg::Object::Object ( bool  threadSafeRefUnref)
inlineexplicit
osg::Object::Object ( const Object ,
const CopyOp copyop = CopyOp::SHALLOW_COPY 
)

Copy constructor, optional CopyOp object can be used to control shallow vs deep copying of dynamic data.

virtual osg::Object::~Object ( )
protectedvirtual

Object destructor. Note, is protected so that Objects cannot be deleted other than by being dereferenced and the reference count being zero (see osg::Referenced), preventing the deletion of nodes which are still in use. This also means that Nodes cannot be created on stack i.e Node node will not compile, forcing all nodes to be created on the heap i.e Node* node = new Node().

Member Function Documentation

virtual const char* osg::Object::className ( ) const
pure virtual

return the name of the object's class type. Must be defined by derived classes.

Implemented in osg::BufferData, osg::DrawElementsUInt, osg::RefMatrixf, osg::BufferObject, osg::GraphicsContext, osg::DrawElementsUShort, osg::DrawElementsUByte, osg::RefMatrixd, osg::DrawArrayLengths, osg::Texture, osg::DrawArrays, osgText::GlyphTexture, osgViewer::GraphicsWindowEmbedded, osg::StateAttribute, osgShadow::ShadowVolumeGeometry, osg::PrimitiveSet, osg::ShapeDrawable, osg::TemplateValueObject< T >, osg::Drawable, osg::Image, osg::Array, osg::Node, osgText::Font, osgViewer::GraphicsWindowX11, osg::Shape, osgFX::Effect, osgUtil::RenderBin, osgAnimation::MorphGeometry, osg::Light, osgGA::UFOManipulator, osg::AudioStream, osg::ClipPlane, osg::StateSet, osgSim::ImpostorSprite, osgGA::StandardManipulator, osgParticle::ParticleProcessor, osgUtil::RenderStage, osgViewer::GraphicsWindow, osgGA::CameraManipulator, osgShadow::OccluderGeometry, osg::Hint, osgGA::AnimationPathManipulator, osgParticle::Program, osg::DrawPixels, osgParticle::Emitter, osgParticle::Operator, osgParticle::ParticleEffect, osg::Geometry, osg::ImageSequence, osg::UserDataContainer, osgParticle::Interpolator, osgUtil::PositionalStateContainer, osgGA::KeySwitchMatrixManipulator, osgGA::StateSetManipulator, osgSim::Sector, osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osg::AutoTransform, osg::ImageStream, osgParticle::Placer, osgText::Text, osg::ShaderAttribute, osgDB::Archive, osgParticle::PrecipitationEffect, osgParticle::Shooter, osgText::TextBase, osgViewer::PixelBufferX11, osgGA::DriveManipulator, osgParticle::CenteredPlacer, osgParticle::VariableRateCounter, osg::AudioSink, osgParticle::Counter, osgGA::SphericalManipulator, and osgGA::CameraViewSwitchManipulator.

virtual Object* osg::Object::clone ( const CopyOp ) const
pure virtual
virtual Object* osg::Object::cloneType ( ) const
pure virtual
virtual void osg::Object::computeDataVariance ( )
inlinevirtual

Compute the DataVariance based on an assessment of callback etc.

Reimplemented in osg::Drawable, and osg::StateSet.

DataVariance osg::Object::getDataVariance ( ) const
inline

Get the data variance of this object.

Referenced by osgUtil::RenderLeaf::RenderLeaf(), and osgUtil::StateGraph::StateGraph().

const std::string& osg::Object::getName ( ) const
inline
osg::UserDataContainer* osg::Object::getOrCreateUserDataContainer ( )

Convinience method that returns the UserDataContainer, and if one doesn't already exist creates and assigns a DefaultUserDataContainer to the Object and then return this new UserDataContainer.

virtual Referenced* osg::Object::getUserData ( )
virtual
virtual const Referenced* osg::Object::getUserData ( ) const
virtual

Get const user data.

Reimplemented in osg::DefaultUserDataContainer, and osg::UserDataContainer.

osg::UserDataContainer* osg::Object::getUserDataContainer ( )
inline

get the UserDataContainer attached to this object.

const osg::UserDataContainer* osg::Object::getUserDataContainer ( ) const
inline

get the const UserDataContainer attached to this object.

template<typename T >
BoolValueObject UCharValueObject UShortValueObject UIntValueObject DoubleValueObject Vec3fValueObject Vec2dValueObject Vec4dValueObject PlaneValueObject MatrixdValueObject bool osg::Object::getUserValue ( const std::string &  name,
T &  value 
) const

Convinience method that casts the named UserObject to osg::TemplateValueObject<T> and gets the value. To use this template method you need to include the osg/ValueObject header.

provide implementation of osg::Object::getUserValue(..) template

References osg::UserDataContainer::getUserObject().

virtual bool osg::Object::isSameKindAs ( const Object ) const
inlinevirtual
virtual const char* osg::Object::libraryName ( ) const
pure virtual

return the name of the object's library. Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name.

Implemented in osg::BufferData, osg::DrawElementsUInt, osg::RefMatrixf, osg::BufferObject, osg::GraphicsContext, osg::DrawElementsUShort, osg::DrawElementsUByte, osg::RefMatrixd, osg::DrawArrayLengths, osg::Texture, osg::DrawArrays, osgViewer::GraphicsWindowEmbedded, osg::StateAttribute, osgShadow::ShadowVolumeGeometry, osg::PrimitiveSet, osg::ShapeDrawable, osg::TemplateValueObject< T >, osg::Drawable, osg::Image, osg::Array, osg::Node, osgText::Font, osgViewer::GraphicsWindowX11, osgFX::Effect, osgUtil::RenderBin, osg::Shape, osgAnimation::MorphGeometry, osg::Light, osg::AudioStream, osg::ClipPlane, osg::StateSet, osgSim::ImpostorSprite, osgParticle::ParticleProcessor, osgViewer::GraphicsWindow, osgShadow::OccluderGeometry, osg::Hint, osgParticle::Program, osg::DrawPixels, osgParticle::Emitter, osgParticle::Operator, osgParticle::ParticleEffect, osg::Geometry, osg::ImageSequence, osg::AutoTransform, osgParticle::Interpolator, osgText::Text, osgUtil::PositionalStateContainer, osgSim::Sector, osgText::TextBase, osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osg::ImageStream, osg::UserDataContainer, osgParticle::Placer, osg::ShaderAttribute, osgParticle::PrecipitationEffect, osgParticle::Shooter, osgViewer::PixelBufferX11, osgDB::Archive, osgParticle::CenteredPlacer, osgParticle::VariableRateCounter, osg::AudioSink, and osgParticle::Counter.

virtual void osg::Object::releaseGLObjects ( osg::State = 0) const
inlinevirtual
virtual void osg::Object::resizeGLObjectBuffers ( unsigned int  )
inlinevirtual
void osg::Object::setDataVariance ( DataVariance  dv)
inline

Set the data variance of this object. Can be set to either STATIC for values that do not change over the lifetime of the object, or DYNAMIC for values that vary over the lifetime of the object. The DataVariance value can be used by routines such as optimization codes that wish to share static data. UNSPECIFIED is used to specify that the DataVariance hasn't been set yet.

virtual void osg::Object::setName ( const std::string &  name)
inlinevirtual

Set the name of object using C++ style string.

Reimplemented in osg::Uniform.

Referenced by osg::ValueObject::ValueObject().

void osg::Object::setName ( const char *  name)
inline

Set the name of object using a C style string.

virtual void osg::Object::setThreadSafeRefUnref ( bool  threadSafe)
virtual
virtual void osg::Object::setUserData ( Referenced obj)
virtual

Set user data, data must be subclassed from Referenced to allow automatic memory handling. If your own data isn't directly subclassed from Referenced then create an adapter object which points to your own object and handles the memory addressing.

Reimplemented in osg::DefaultUserDataContainer, and osg::UserDataContainer.

void osg::Object::setUserDataContainer ( osg::UserDataContainer udc)

set the UserDataContainer object.

template<typename T >
void osg::Object::setUserValue ( const std::string &  name,
const T &  value 
)

Convinience method that creates the osg::TemplateValueObject<T> to store the specified value and adds it as a named UserObject. To use this template method you need to include the osg/ValueObject header.

provide implementation of osg::Object::setUserValue(..) template.

References osg::UserDataContainer::addUserObject(), osg::UserDataContainer::getUserObjectIndex(), and osg::UserDataContainer::setUserObject().

Member Data Documentation

DataVariance osg::Object::_dataVariance
protected
std::string osg::Object::_name
protected
osg::UserDataContainer* osg::Object::_userDataContainer
protected

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