osg::ref_ptr< T > Class Template Reference

`#include <ref_ptr>`

## Public Types

typedef T | element_type

## Public Member Functions

| ref_ptr ()
| ref_ptr (T *ptr)
| ref_ptr (const ref_ptr &rp)
template<class Other>
| ref_ptr (const ref_ptr< Other > &rp)
| ref_ptr (observer_ptr< T > &optr)
| ~ref_ptr ()
ref_ptr & | operator= (const ref_ptr &rp)
template<class Other>
ref_ptr & | operator= (const ref_ptr< Other > &rp)
ref_ptr & | operator= (T *ptr)
bool | operator== (const ref_ptr &rp) const
bool | operator== (const T *ptr) const
bool | operator!= (const ref_ptr &rp) const
bool | operator!= (const T *ptr) const
bool | operator< (const ref_ptr &rp) const
| operator unspecified_bool_type () const
T & | operator* () const
T * | operator-> () const
T * | get () const
bool | operator! () const
bool | valid () const
T * | release ()
void | swap (ref_ptr &rp)

## Friends

template<class Other>
class | ref_ptr
bool | operator== (const T *ptr, const ref_ptr &rp)
bool | operator!= (const T *ptr, const ref_ptr &rp)

## Detailed Description

template<class T>
class osg::ref_ptr< T >

Smart pointer for handling referenced counted objects.

## Member Typedef Documentation

## element_type

template<class T>

typedef T osg::ref_ptr< T >::element_type

## Constructor & Destructor Documentation

## ref_ptr() [1/5]

template<class T>

osg::ref_ptr< T >::ref_ptr | ( |  | ) |

inline

## ref_ptr() [2/5]

template<class T>

osg::ref_ptr< T >::ref_ptr | ( | T * | ptr | ) |

inline

## ref_ptr() [3/5]

template<class T>

osg::ref_ptr< T >::ref_ptr | ( | const ref_ptr< T > & | rp | ) |

inline

## ref_ptr() [4/5]

template<class T>
template<class Other>

osg::ref_ptr< T >::ref_ptr | ( | const ref_ptr< Other > & | rp | ) |

inline

## ref_ptr() [5/5]

template<class T>

osg::ref_ptr< T >::ref_ptr | ( | observer_ptr< T > & | optr | ) |

inline

## ~ref_ptr()

template<class T>

osg::ref_ptr< T >::~ref_ptr | ( |  | ) |

inline

## Member Function Documentation

## get()

template<class T>

T * osg::ref_ptr< T >::get | ( |  | ) | const

inline

Referenced by osgVolume::Locator::addCallback(), osg::CompositeShape::addChild(), osg::Group::addChild(), osg::LOD::addChild(), osg::PagedLOD::addChild(), osg::PagedLOD::addChild(), osg::ProxyNode::addChild(), osg::Sequence::addChild(), osgManipulator::Dragger::addConstraint(), osg::Node::addCullCallback(), osgViewer::View::addDevice(), osgManipulator::CompositeDragger::addDragger(), osgManipulator::Dragger::addDraggerCallback(), osg::Geode::addDrawable(), osg::Node::addEventCallback(), osgViewer::View::addEventHandler(), osg::Camera::addFinalDrawCallback(), osg::ImageSequence::addImage(), osg::Camera::addInitialDrawCallback(), osgTerrain::CompositeLayer::addLayer(), osgVolume::CompositeLayer::addLayer(), osg::Camera::addPostDrawCallback(), osg::Camera::addPreDrawCallback(), osgVolume::CompositeProperty::addProperty(), osgVolume::Layer::addProperty(), osg::Program::addShader(), osgShadow::ShadowMap::addShader(), osg::StateSet::addUniform(), osg::Node::addUpdateCallback(), osg::UserDataContainer::addUserObject(), osgViewer::CompositeViewer::addView(), osgViewer::View::apply(), osg::clone(), osg::cloneType(), osg::const_pointer_cast(), osgViewer::View::containsCamera(), osgManipulator::CompositeDragger::containsDragger(), osg::Geode::containsDrawable(), osg::Group::containsNode(), osg::createGeodeForImage(), osg::createGeodeForImage(), osg::dynamic_pointer_cast(), osg::ContextData::get(), osg::State::get(), osg::get_pointer(), osg::Geode::getDrawableIndex(), osg::Group::insertChild(), osg::Sequence::insertChild(), osg::observer_ptr< object_type >::observer_ptr(), osgDB::OutputStream::operator<<(), osgDB::OutputStream::operator<<(), osgDB::OutputStream::operator<<(), osgDB::OutputStream::operator<<(), osg::observer_ptr< object_type >::operator=(), osgUtil::Optimizer::optimize(), osgUtil::Optimizer::optimize(), osgDB::ImageSerializer< C, P >::read(), osgDB::ObjectSerializer< C, P >::read(), osgDB::InputStream::readObjectFieldsOfType(), osgDB::InputStream::readObjectOfType(), osg::StateSet::removeAttribute(), osg::Group::removeChild(), osgManipulator::Dragger::removeConstraint(), osg::Node::removeCullCallback(), osg::Node::removeCullCallback(), osgViewer::View::removeDevice(), osgManipulator::CompositeDragger::removeDragger(), osgManipulator::Dragger::removeDraggerCallback(), osg::Geode::removeDrawable(), osg::Node::removeEventCallback(), osg::Node::removeEventCallback(), osgViewer::View::removeEventHandler(), osg::Camera::removeFinalDrawCallback(), osg::Camera::removeFinalDrawCallback(), osg::Camera::removeInitialDrawCallback(), osg::Camera::removeInitialDrawCallback(), osg::Camera::removePostDrawCallback(), osg::Camera::removePostDrawCallback(), osg::Camera::removePreDrawCallback(), osg::Camera::removePreDrawCallback(), osg::Program::removeShader(), osg::StateSet::removeTextureAttribute(), osg::StateSet::removeUniform(), osg::Node::removeUpdateCallback(), osg::Node::removeUpdateCallback(), osgViewer::CompositeViewer::removeView(), osg::Group::replaceChild(), osg::Geode::replaceDrawable(), osgParticle::Particle::setAlphaInterpolator(), osg::StateSet::setAttribute(), osg::StateSet::setAttributeAndModes(), osgViewer::View::setCameraManipulator(), osgParticle::Particle::setColorInterpolator(), osgTerrain::TerrainTile::setColorLayer(), osg::Node::setComputeBoundingSphereCallback(), osg::Node::setCullCallback(), osgViewer::View::setDatabasePager(), osgViewer::View::setDisplaySettings(), osg::Geode::setDrawable(), osgTerrain::TerrainTile::setElevationLayer(), osg::Node::setEventCallback(), osg::StateSet::setEventCallback(), osgViewer::View::setEventQueue(), osgTerrain::HeightFieldLayer::setHeightField(), osg::ImageSequence::setImage(), osg::Texture1D::setImage(), osg::Texture2D::setImage(), osg::Texture2D::setImage(), osg::Texture2DArray::setImage(), osg::Texture3D::setImage(), osg::Texture::setImage(), osg::TextureCubeMap::setImage(), osg::TextureRectangle::setImage(), osgTerrain::ImageLayer::setImage(), osgVolume::ImageLayer::setImage(), osgWidget::Widget::setImage(), osgViewer::View::setImagePager(), osgTerrain::CompositeLayer::setLayer(), osgVolume::CompositeLayer::setLayer(), osgTerrain::Layer::setLocator(), osgTerrain::TerrainTile::setLocator(), osgVolume::Layer::setLocator(), osgSim::OverlayNode::setOverlaySubgraph(), osgParticle::ParticleEffect::setParticleSystem(), osgVolume::CompositeProperty::setProperty(), osgVolume::Layer::setProperty(), osg::Texture::setReadPBuffer(), osgViewer::View::setSceneData(), osgShadow::ShadowedScene::setShadowSettings(), osgShadow::ShadowedScene::setShadowTechnique(), osg::Drawable::setShape(), osgParticle::Particle::setSizeInterpolator(), osg::Node::setStateSet(), osgTerrain::TerrainTile::setTerrainTechnique(), osg::StateSet::setTextureAttribute(), osg::StateSet::setTextureAttributeAndModes(), osgTerrain::ContourLayer::setTransferFunction(), osg::Node::setUpdateCallback(), osg::StateSet::setUpdateCallback(), osg::Object::setUserData(), osg::Object::setUserDataContainer(), osg::ShapeDrawable::ShapeDrawable(), osg::static_pointer_cast(), osg::Texture1D::Texture1D(), osg::Texture2D::Texture2D(), osg::Texture3D::Texture3D(), and osg::TextureRectangle::TextureRectangle().

## operator unspecified_bool_type()

template<class T>

osg::ref_ptr< T >::operator unspecified_bool_type | ( |  | ) | const

inline

## operator!()

template<class T>

bool osg::ref_ptr< T >::operator! | ( |  | ) | const

inline

## operator!=() [1/2]

template<class T>

bool osg::ref_ptr< T >::operator!= | ( | const ref_ptr< T > & | rp | ) | const

inline

## operator!=() [2/2]

template<class T>

bool osg::ref_ptr< T >::operator!= | ( | const T * | ptr | ) | const

inline

## operator*()

template<class T>

T & osg::ref_ptr< T >::operator* | ( |  | ) | const

inline

## operator->()

template<class T>

T * osg::ref_ptr< T >::operator-> | ( |  | ) | const

inline

## operator<()

template<class T>

bool osg::ref_ptr< T >::operator< | ( | const ref_ptr< T > & | rp | ) | const

inline

## operator=() [1/3]

template<class T>

ref_ptr & osg::ref_ptr< T >::operator= | ( | const ref_ptr< T > & | rp | ) |

inline

## operator=() [2/3]

template<class T>
template<class Other>

ref_ptr & osg::ref_ptr< T >::operator= | ( | const ref_ptr< Other > & | rp | ) |

inline

## operator=() [3/3]

template<class T>

ref_ptr & osg::ref_ptr< T >::operator= | ( | T * | ptr | ) |

inline

## operator==() [1/2]

template<class T>

bool osg::ref_ptr< T >::operator== | ( | const ref_ptr< T > & | rp | ) | const

inline

## operator==() [2/2]

template<class T>

bool osg::ref_ptr< T >::operator== | ( | const T * | ptr | ) | const

inline

## release()

template<class T>

T * osg::ref_ptr< T >::release | ( |  | ) |

inline

release the pointer from ownership by this ref_ptr<>, decrementing the objects refencedCount() via unref_nodelete() to prevent the Object object from being deleted even if the reference count goes to zero. Use when using a local ref_ptr<> to an Object that you want to return from a function/method via a C pointer, whilst preventing the normal ref_ptr<> destructor from cleaning up the object. When using release() you are implicitly expecting other code to take over management of the object, otherwise a memory leak will result.

Referenced by osg::clone(), and osg::cloneType().

## swap()

template<class T>

void osg::ref_ptr< T >::swap | ( | ref_ptr< T > & | rp | ) |

inline

Referenced by osg::swap().

## valid()

template<class T>

bool osg::ref_ptr< T >::valid | ( |  | ) | const

inline

Referenced by osg::observer_ptr< object_type >::lock(), osg::observer_ptr< object_type >::observer_ptr(), osg::ref_ptr< osg::Vec3Array >::operator unspecified_bool_type(), osg::observer_ptr< object_type >::operator=(), and osgDB::readRefShaderFile().

## Friends And Related Symbol Documentation

## operator!=

template<class T>

bool operator!= | ( | const T * | ptr,
|  | const ref_ptr< T > & | rp )

friend

## operator==

template<class T>

bool operator== | ( | const T * | ptr,
|  | const ref_ptr< T > & | rp )

friend

## ref_ptr

template<class T>
template<class Other>

friend class ref_ptr

friend

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

- ref_ptr