OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
osg::Object Class Referenceabstract

#include <Object.h>

Inherits osg::Referenced.

Inherited by osg::AnimationPath [virtual], osg::AudioSink, osg::AudioStream, osg::BufferData, osg::BufferData::ModifiedCallback [virtual], osg::BufferObject, osg::Callback [virtual], osg::Camera::DrawCallback [virtual], osg::ConvexPlanarOccluder, osg::Drawable::ComputeBoundingBoxCallback, osg::Drawable::DrawCallback [virtual], osg::DummyObject, osg::EllipsoidModel, osg::GraphicsContext, osg::Node, osg::Node::ComputeBoundingSphereCallback, osg::NodeVisitor [virtual], osg::Program::ProgramBinary, osg::RefMatrixd, osg::RefMatrixf, osg::RenderBuffer, osg::Script, osg::ScriptEngine, osg::Shader, osg::ShaderBinary, osg::ShaderComponent, osg::ShaderComposer, osg::Shape, osg::StateAttribute, osg::StateSet, osg::TessellationHints, osg::TransferFunction, osg::Uniform, osg::UserDataContainer, osg::ValueObject, osg::View [virtual], osgAnimation::Action, osgAnimation::Action::Callback, osgAnimation::Animation, osgAnimation::AnimationUpdateCallbackBase [virtual], osgAnimation::StackedTransformElement, osgAnimation::VertexInfluenceMap, osgDB::DatabaseRevision, osgDB::DatabaseRevisions, osgDB::FileList, osgDB::ImageProcessor, osgDB::MapIteratorObject, osgDB::Options, osgDB::ReaderWriter, osgGA::Device, osgGA::Event, osgGA::GUIEventAdapter::TouchData, osgManipulator::DraggerCallback [virtual], osgParticle::Counter, osgParticle::Interpolator, osgParticle::Operator, osgParticle::Placer, osgParticle::Shooter, osgPresentation::AnimationMaterial [virtual], osgPresentation::HomePosition, osgPresentation::JumpData, osgPresentation::KeyPosition, osgPresentation::PropertyManager [protected], osgShadow::ShadowSettings, 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, osgUI::AlignmentSettings, osgUI::ColorPalette, osgUI::FrameSettings, osgUI::Item, osgUI::Style, osgUI::Tab, osgUI::TextSettings, osgUI::Validator, osgUtil::PositionalStateContainer, osgUtil::RenderBin, osgUtil::SceneView, osgViewer::Keystone, osgViewer::ViewConfig, osgViewer::ViewerBase [virtual], osgVolume::ImageDetails, osgVolume::Layer, osgVolume::Locator, osgVolume::Locator::LocatorCallback [virtual], osgVolume::Property, osgVolume::VolumeTechnique, osgWidget::BrowserManager, osgWidget::Style, and osgWidget::StyleManager.

Collaboration diagram for osg::Object:
Collaboration graph
[legend]

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
 
std::string getCompoundClassName () const
 
virtual NodeasNode ()
 
virtual const NodeasNode () const
 
virtual NodeVisitorasNodeVisitor ()
 
virtual const NodeVisitorasNodeVisitor () const
 
virtual StateAttributeasStateAttribute ()
 
virtual const StateAttributeasStateAttribute () const
 
virtual UniformasUniform ()
 
virtual const UniformasUniform () const
 
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
 
template<typename T >
BoolValueObject
UCharValueObject
UShortValueObject
UIntValueObject
DoubleValueObject
Vec3fValueObject
Vec2dValueObject
Vec4dValueObject
PlaneValueObject
MatrixdValueObject
BoundingBoxdValueObject
BoundingSpheredValueObject
bool 
getUserValue (const std::string &name, T &value) 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.

Definition at line 56 of file Object.h.

Member Enumeration Documentation

Enumerator
DYNAMIC 
STATIC 
UNSPECIFIED 

Definition at line 147 of file Object.h.

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.

Definition at line 65 of file Object.h.

osg::Object::Object ( bool  threadSafeRefUnref)
inlineexplicit

Definition at line 67 of file Object.h.

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 Node* osg::Object::asNode ( )
inlinevirtual

Convert 'this' into a Node pointer if Object is a Node, otherwise return 0. Equivalent to dynamic_cast<Node*>(this).

Reimplemented in osg::Node.

Definition at line 99 of file Object.h.

virtual const Node* osg::Object::asNode ( ) const
inlinevirtual

convert 'const this' into a const Node pointer if Object is a Node, otherwise return 0. Equivalent to dynamic_cast<const Node*>(this).

Reimplemented in osg::Node.

Definition at line 103 of file Object.h.

virtual NodeVisitor* osg::Object::asNodeVisitor ( )
inlinevirtual

Convert 'this' into a NodeVisitor pointer if Object is a NodeVisitor, otherwise return 0. Equivalent to dynamic_cast<NodeVisitor*>(this).

Definition at line 107 of file Object.h.

virtual const NodeVisitor* osg::Object::asNodeVisitor ( ) const
inlinevirtual

convert 'const this' into a const NodeVisitor pointer if Object is a NodeVisitor, otherwise return 0. Equivalent to dynamic_cast<const NodeVisitor*>(this).

Reimplemented in osg::NodeVisitor.

Definition at line 111 of file Object.h.

virtual StateAttribute* osg::Object::asStateAttribute ( )
inlinevirtual

Convert 'this' into a StateAttribute pointer if Object is a StateAttribute, otherwise return 0. Equivalent to dynamic_cast<StateAttribute*>(this).

Reimplemented in osg::StateAttribute.

Definition at line 115 of file Object.h.

virtual const StateAttribute* osg::Object::asStateAttribute ( ) const
inlinevirtual

convert 'const this' into a const StateAttribute pointer if Object is a StateAttribute, otherwise return 0. Equivalent to dynamic_cast<const StateAttribute*>(this).

Reimplemented in osg::StateAttribute.

Definition at line 119 of file Object.h.

virtual Uniform* osg::Object::asUniform ( )
inlinevirtual

Convert 'this' into a Uniform pointer if Object is a Uniform, otherwise return 0. Equivalent to dynamic_cast<Uniform*>(this).

Reimplemented in osg::Uniform.

Definition at line 123 of file Object.h.

virtual const Uniform* osg::Object::asUniform ( ) const
inlinevirtual

convert 'const this' into a const Uniform pointer if Object is a Uniform, otherwise return 0. Equivalent to dynamic_cast<const Uniform*>(this).

Reimplemented in osg::Uniform.

Definition at line 127 of file Object.h.

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::DrawElementsUInt, osg::RefMatrixf, osg::BufferData, osg::DrawElementsUShort, osg::GraphicsContext, osg::DrawElementsUByte, osg::RefMatrixd, osg::Texture, osg::BufferObject, osg::DrawArrayLengths, osg::DrawArrays, osgText::GlyphTexture, osgViewer::GraphicsWindowEmbedded, osg::StateAttribute, osgShadow::ShadowVolumeGeometry, osg::PrimitiveSet, osg::Image, osg::Array, osg::ShapeDrawable, osg::TemplateValueObject< T >, osg::Node, osg::BufferTemplate< std::vector< T > >, osgText::Font, osgViewer::GraphicsWindowX11, osg::Shape, osgFX::Effect, osgUtil::RenderBin, osg::Light, osgGA::UFOManipulator, osg::AudioStream, osg::ClipPlane, osgAnimation::MorphGeometry, osg::StateSet, osgSim::ImpostorSprite, osgGA::StandardManipulator, osgParticle::ParticleProcessor, osgUtil::RenderStage, osgViewer::GraphicsWindow, osgGA::CameraManipulator, osg::BufferTemplate< T >, osgShadow::OccluderGeometry, osg::Hint, osgManipulator::AntiSquish, osg::VertexAttribDivisor, osgGA::AnimationPathManipulator, osgParticle::Program, osg::DrawPixels, osgParticle::Emitter, osgParticle::Operator, osgParticle::ParticleEffect, osg::ImageSequence, osg::ImageStream, osg::UserDataContainer, osgParticle::Interpolator, osgUtil::PositionalStateContainer, osgGA::KeySwitchMatrixManipulator, osgGA::StateSetManipulator, osgSim::Sector, osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, osg::AutoTransform, 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.

Here is the caller graph for this function:

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.

Definition at line 165 of file Object.h.

std::string osg::Object::getCompoundClassName ( ) const
inline

return the compound class name that combines the library name and class name.

Definition at line 94 of file Object.h.

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

Get the data variance of this object.

Definition at line 162 of file Object.h.

Here is the caller graph for this function:

const std::string& osg::Object::getName ( ) const
inline

Get the name of object.

Definition at line 144 of file Object.h.

Here is the caller graph for this function:

osg::UserDataContainer* osg::Object::getOrCreateUserDataContainer ( )

Convenience 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.

Here is the caller graph for this function:

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

Get user data.

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

Here is the caller graph for this function:

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.

Definition at line 172 of file Object.h.

Here is the caller graph for this function:

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

get the const UserDataContainer attached to this object.

Definition at line 175 of file Object.h.

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

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

Definition at line 188 of file ValueObject.h.

Here is the call graph for this function:

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

Convenience 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.

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::DrawElementsUInt, osg::RefMatrixf, osg::BufferData, osg::DrawElementsUShort, osg::GraphicsContext, osg::DrawElementsUByte, osg::RefMatrixd, osg::Texture, osg::BufferObject, osg::DrawArrayLengths, osg::DrawArrays, osgViewer::GraphicsWindowEmbedded, osg::StateAttribute, osgShadow::ShadowVolumeGeometry, osg::PrimitiveSet, osg::Image, osg::Array, osg::ShapeDrawable, osg::TemplateValueObject< T >, osg::Node, osg::BufferTemplate< std::vector< T > >, osgText::Font, osgViewer::GraphicsWindowX11, osgFX::Effect, osgUtil::RenderBin, osg::Shape, osg::Light, osg::AudioStream, osg::ClipPlane, osgAnimation::MorphGeometry, osg::StateSet, osgSim::ImpostorSprite, osgParticle::ParticleProcessor, osgViewer::GraphicsWindow, osg::BufferTemplate< T >, osgShadow::OccluderGeometry, osg::Hint, osgManipulator::AntiSquish, osg::VertexAttribDivisor, osgParticle::Program, osg::DrawPixels, osgParticle::Emitter, osgParticle::Operator, osgParticle::ParticleEffect, osg::ImageSequence, osg::ImageStream, osg::AutoTransform, osgParticle::Interpolator, osgText::Text, osgUtil::PositionalStateContainer, osgSim::Sector, osgText::TextBase, osgViewer::GraphicsWindowWin32, osgViewer::PixelBufferWin32, 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.

Definition at line 159 of file Object.h.

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

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

Reimplemented in osg::Uniform.

Definition at line 134 of file Object.h.

Here is the caller graph for this function:

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

Set the name of object using a C style string.

Definition at line 137 of file Object.h.

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 
)

Convenience 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.

Definition at line 209 of file ValueObject.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

DataVariance osg::Object::_dataVariance
protected

Definition at line 231 of file Object.h.

std::string osg::Object::_name
protected

Definition at line 230 of file Object.h.

osg::UserDataContainer* osg::Object::_userDataContainer
protected

Definition at line 233 of file Object.h.


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