openscenegraph
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
osg::Object Class Reference
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

List of all members.

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

Protected Member Functions

virtual ~Object ()

Protected Attributes

std::string _name
DataVariance _dataVariance
osg::UserDataContainer_userDataContainer

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) [inline, explicit]
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 ( ) [protected, virtual]

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

virtual Object* osg::Object::clone ( const CopyOp ) const [pure virtual]
virtual Object* osg::Object::cloneType ( ) const [pure virtual]
virtual void osg::Object::computeDataVariance ( ) [inline, virtual]

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 const Referenced* osg::Object::getUserData ( ) const [virtual]

Get const user data.

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

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

virtual void osg::Object::releaseGLObjects ( osg::State = 0) const [inline, virtual]
virtual void osg::Object::resizeGLObjectBuffers ( unsigned int  ) [inline, virtual]
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.

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

Set the name of object using a C style string.

virtual void osg::Object::setName ( const std::string &  name) [inline, virtual]
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::UserDataContainer, and osg::DefaultUserDataContainer.

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

std::string osg::Object::_name [protected]

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