# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Member Functions | Protected Attributes

# vl::Object Class Reference

The base class for all the reference counted objects. More...

`#include <Object.hpp>`

Inheritance diagram for vl::Object:

List of all members.

## Public Member Functions

virtual const char * | className ()
| Returns the name of the class.
| Object ()
| Constructor.
| Object (const Object &other)
| Copy constructor: copies the name, ref count mutex and user data.
Object & | operator= (const Object &other)
| Copy operator: copies the object's name, ref count mutex and user data.
const std::string & | objectName () const
| The name of the object, by default set to the object's class name.
void | setObjectName (const std::string &name)
| The name of the object, by default set to the object's class name.
void | setRefCountMutex (IMutex *mutex)
| The mutex used to protect the reference counting of an Object across multiple threads.
IMutex * | refCountMutex ()
| The mutex used to protect the reference counting of an Object across multiple threads.
const IMutex * | refCountMutex () const
| The mutex used to protect the reference counting of an Object across multiple threads.
int | referenceCount () const
| Returns the number of references of an object.
void | incReference ()
| Increments the reference count of an object.
void | decReference ()
| Decrements the reference count of an object and deletes it if both automaticDelete() is `true` the count reaches 0.
void | setAutomaticDelete (bool autodel_on)
| If set to true the Object is deleted when its reference count reaches 0.
bool | automaticDelete () const
| If set to true the Object is deleted when its reference count reaches 0.
template<class T >
T * | as ()
| Casts an Object to the specified class.
template<class T >
const T * | as () const
| Casts an Object to the specified class.

## Protected Member Functions

virtual | ~Object ()

## Protected Attributes

std::string | mObjectName
IMutex * | mRefCountMutex
int | mReferenceCount
bool | mAutomaticDelete

## Detailed Description

The base class for all the reference counted objects.

See also vl::ref.

Definition at line 54 of file Object.hpp.

## Constructor & Destructor Documentation

vl::Object::Object | ( | ) | `[inline]`

Constructor.

Definition at line 62 of file Object.hpp.

References VL_DEBUG_SET_OBJECT_NAME.

vl::Object::Object | ( | const Object & | other ) | `[inline]`

Copy constructor: copies the name, ref count mutex and user data.

Definition at line 79 of file Object.hpp.

References mObjectName, and mRefCountMutex.

Object::~Object | ( | ) | `[protected, virtual]`

Definition at line 45 of file Object.cpp.

References automaticDelete(), vl::Log::bug(), mObjectName, and mReferenceCount.

## Member Function Documentation

virtual const char* vl::Object::className | ( | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented in vl::ArrayAbstract, vl::Array< T_VectorType, T_Scalar, T_GL_Size, T_GL_Type >, vl::Buffer, vl::BufferedStream< Element_Type, Chunk_Size >, vl::CatmullRomInterpolator< T >, vl::Collection< T >, vl::DiskDirectory, vl::DiskFile, vl::FileSystem, vl::GZipCodec, vl::Image, vl::Interpolator, vl::KeyValues, vl::LinearInterpolator< T >, vl::LoadWriterManager, vl::Log, vl::StandardLog, vl::MemoryDirectory, vl::MemoryFile, vl::Plane, vl::LoadWriterBMP, vl::LoadWriterDAT, vl::LoadWriterDDS, vl::LoadWriterDICOM, vl::LoadWriterJPG, vl::LoadWriterPNG, vl::LoadWriterTGA, vl::LoadWriterTIFF, vl::Random, vl::ResourceDatabase, vl::ResourceLoadWriter, vl::TextStream, vl::Time, vl::Transform, vl::VirtualDirectory, vl::VirtualFile, vl::VLSettings, vl::ZippedDirectory, vl::ZippedFileInfo, vl::ZippedFile, vl::Actor, vl::ActorKdTree, vl::ActorTree, vl::ActorTreeAbstract, vl::Applet, vl::BezierPatch, vl::BezierSurface, vl::Billboard, vl::BlitFramebuffer, vl::Camera, vl::Clear, vl::ClipPlane, vl::CopyTexSubImage, vl::CopyTexSubImage1D, vl::CopyTexSubImage2D, vl::CopyTexSubImage3D, vl::DepthSortCallback, vl::DistanceLODEvaluator, vl::VertexMapper, vl::DoubleVertexRemover, vl::DrawArrays, vl::DrawCall, vl::DrawElements< Tgltype, arr_type >, vl::DrawPixels::Pixels, vl::DrawPixels, vl::DrawRangeElements< index_type, Tgltype, arr_type >, vl::EdgeExtractor, vl::EdgeRenderer, vl::EdgeUpdateCallback, vl::ShaderSequence, vl::Effect, vl::EnableSet, vl::Extrusion, vl::Glyph, vl::Font, vl::FontManager, vl::FBOAbstractAttachment, vl::FBORenderbufferAttachment, vl::FBOColorBufferAttachment, vl::FBODepthBufferAttachment, vl::FBOStencilBufferAttachment, vl::FBODepthStencilBufferAttachment, vl::FBOAbstractTextureAttachment, vl::FBOTexture1DAttachment, vl::FBOTexture2DAttachment, vl::FBOTextureAttachment, vl::FBOTexture3DAttachment, vl::FBOTextureLayerAttachment, vl::FBORenderTarget, vl::Frustum, vl::Geometry, vl::GeometryLoadCallback, vl::GhostCameraManipulator, vl::GLBufferObject, vl::GLSLShader, vl::GLSLVertexShader, vl::GLSLFragmentShader, vl::GLSLGeometryShader, vl::GLSLTessControlShader, vl::GLSLTessEvaluationShader, vl::GLSLProgram, vl::ImagePBO, vl::IndexIteratorAbstract, vl::IndexIterator, vl::IndexIteratorDrawArrays, vl::IndexIteratorElements< TArray >, vl::Light, vl::LODEvaluator, vl::MorphingCallback, vl::MultiDrawElements< Tgltype, arr_type >, vl::OcclusionCullRenderer, vl::OpenGLContext, vl::PatchParameter, vl::PixelLODEvaluator, vl::LoadWriter3DS, vl::LoadWriterAC3D, vl::LoadWriterMD2, vl::LoadWriterOBJ, vl::ObjMaterial, vl::ObjMesh, vl::LoadWriterPLY, vl::LoadWriterSTL, vl::PolygonSimplifier, vl::ProjViewTransfCallback, vl::RayIntersection, vl::RayIntersectionGeometry, vl::RayIntersector, vl::ReadPixels, vl::Renderable, vl::Renderer, vl::RendererAbstract, vl::RenderEventCallback, vl::Rendering, vl::RenderingAbstract, vl::RenderingTree, vl::RenderQueue, vl::RenderQueueSorter, vl::RenderQueueSorterByShader, vl::RenderQueueSorterByRenderable, vl::RenderQueueSorterBasic, vl::RenderQueueSorterStandard, vl::RenderQueueSorterOcclusion, vl::RenderQueueSorterAggressive, vl::RenderState, vl::TextureState, vl::RenderStateSet, vl::RenderTarget, vl::RenderToken, vl::SceneManager, vl::SceneManagerActorKdTree, vl::SceneManagerActorTree, vl::SceneManagerBVH< T >, vl::Portal, vl::Sector, vl::SceneManagerPortals, vl::Scissor, vl::PixelTransfer, vl::Hint, vl::CullFace, vl::FrontFace, vl::DepthFunc, vl::DepthMask, vl::PolygonMode, vl::ShadeModel, vl::BlendFunc, vl::BlendEquation, vl::SampleCoverage, vl::AlphaFunc, vl::Material, vl::LightModel, vl::Fog, vl::PolygonOffset, vl::LogicOp, vl::DepthRange, vl::LineWidth, vl::PointSize, vl::PolygonStipple, vl::LineStipple, vl::PointParameter, vl::StencilFunc, vl::StencilOp, vl::StencilMask, vl::BlendColor, vl::ColorMask, vl::TextureMatrix, vl::TexEnv, vl::TexGen, vl::TextureUnit, vl::Shader, vl::ShaderNode, vl::Terrain, vl::Tessellator, vl::Text, vl::Texture, vl::TrackballManipulator, vl::TriangleIteratorAbstract, vl::TriangleIteratorIndexed< TArray >, vl::TriangleIteratorDirect, vl::TriangleIteratorMulti< TArray >, vl::UIEventListener, vl::Uniform, vl::UniformSet, vl::VertexAttribInfo, vl::Viewport, vl::Atom, vl::Bond, vl::Molecule, vl::SceneManagerVectorGraphics, vl::VectorGraphics, vl::Volume, vl::VolumeInfo, vl::RaycastVolume, vl::SlicedVolume, vl::VolumePlot, vl::BufferedStream< unsigned char, 128 *1024 >, vl::Collection< LoadCallback >, vl::Collection< WriteCallback >, vl::Collection< Shader >, vl::Collection< VolumeInfo >, vl::Collection< Actor >, vl::Collection< DrawCall >, vl::Collection< RenderEventCallback >, vl::Collection< VertexAttribInfo >, vl::Collection< TextureArray >, vl::Collection< ResourceLoadWriter >, vl::Collection< Pixels >, vl::Collection< VirtualDirectory >, vl::Collection< ActorEventCallback >, vl::Collection< SceneManager >, vl::Collection< VectorGraphics >, vl::Collection< RenderingAbstract >, vl::DrawElements< GL_UNSIGNED_SHORT, ArrayUShort1 >, vl::DrawElements< GL_UNSIGNED_INT, ArrayUInt1 >, vl::DrawElements< GL_UNSIGNED_BYTE, ArrayUByte1 >, vl::DrawRangeElements< GLushort, GL_UNSIGNED_SHORT, ArrayUShort1 >, vl::DrawRangeElements< GLubyte, GL_UNSIGNED_BYTE, ArrayUByte1 >, vl::DrawRangeElements< GLuint, GL_UNSIGNED_INT, ArrayUInt1 >, vl::MultiDrawElements< GL_UNSIGNED_SHORT, ArrayUShort1 >, vl::MultiDrawElements< GL_UNSIGNED_INT, ArrayUInt1 >, vl::MultiDrawElements< GL_UNSIGNED_BYTE, ArrayUByte1 >, vl::SceneManagerBVH< ActorKdTree >, and vl::SceneManagerBVH< ActorTree >.

Definition at line 59 of file Object.hpp.

Object& vl::Object::operator= | ( | const Object & | other ) | `[inline]`

Copy operator: copies the object's name, ref count mutex and user data.

Definition at line 99 of file Object.hpp.

References mObjectName, and mRefCountMutex.

Referenced by vl::Shader::operator=(), and vl::VirtualFile::operator=().

const std::string& vl::Object::objectName | ( | ) | const`[inline]`

The name of the object, by default set to the object's class name.

Definition at line 115 of file Object.hpp.

Referenced by vl::TextureUnit::apply(), vl::GLSLShader::compile(), vl::GLSLProgram::infoLog(), vl::MorphingCallback::init(), vl::GLSLProgram::linkProgram(), vl::Image::operator=(), vl::Image::print(), vl::GLSLProgram::programBinary(), and vl::GLSLProgram::useProgram().

void vl::Object::setObjectName | ( | const std::string & | name ) | `[inline]`

The name of the object, by default set to the object's class name.

Definition at line 118 of file Object.hpp.

Referenced by vl::Texture::createTexture(), vl::Image::Image(), vl::Image::operator=(), and vl::GLSLShader::setSource().

void vl::Object::setRefCountMutex | ( | IMutex * | mutex ) | `[inline]`

The mutex used to protect the reference counting of an Object across multiple threads.

Definition at line 121 of file Object.hpp.

IMutex* vl::Object::refCountMutex | ( | ) | `[inline]`

The mutex used to protect the reference counting of an Object across multiple threads.

Definition at line 124 of file Object.hpp.

const IMutex* vl::Object::refCountMutex | ( | ) | const`[inline]`

The mutex used to protect the reference counting of an Object across multiple threads.

Definition at line 127 of file Object.hpp.

int vl::Object::referenceCount | ( | ) | const`[inline]`

Returns the number of references of an object.

Definition at line 130 of file Object.hpp.

void vl::Object::incReference | ( | ) | `[inline]`

Increments the reference count of an object.

Definition at line 136 of file Object.hpp.

References vl::IMutex::lock().

void vl::Object::decReference | ( | ) | `[inline]`

Decrements the reference count of an object and deletes it if both automaticDelete() is `true` the count reaches 0.

Definition at line 150 of file Object.hpp.

References vl::IMutex::lock(), vl::IMutex::unlock(), and VL_CHECK.

void vl::Object::setAutomaticDelete | ( | bool | autodel_on ) | `[inline]`

If set to true the Object is deleted when its reference count reaches 0.

Definition at line 170 of file Object.hpp.

Referenced by vl::ActorTreeAbstract::ActorTreeAbstract(), vl::DrawPixels::DrawPixels(), vl::Geometry::Geometry(), vl::LoadWriterManager::LoadWriterManager(), vl::MarchingCubes::MarchingCubes(), vlMFC::MDIWindow::MDIWindow(), vlMFC::MFCWindow::MFCWindow(), vlQt4::Qt4Widget::Qt4Widget(), vl::SceneManagerVectorGraphics::SceneManagerVectorGraphics(), vl::VectorGraphics::VectorGraphics(), and vlWX::WXGLCanvas::WXGLCanvas().

bool vl::Object::automaticDelete | ( | ) | const`[inline]`

If set to true the Object is deleted when its reference count reaches 0.

Definition at line 173 of file Object.hpp.

Referenced by ~Object().

template<class T >

T* vl::Object::as | ( | ) | `[inline]`

Casts an Object to the specified class.

Definition at line 177 of file Object.hpp.

Referenced by vl::PolygonSimplifier::collapse(), and vl::Applet::initialize().

template<class T >

const T* vl::Object::as | ( | ) | const`[inline]`

Casts an Object to the specified class.

Definition at line 181 of file Object.hpp.

## Member Data Documentation

std::string vl::Object::mObjectName`[protected]`

Definition at line 195 of file Object.hpp.

Referenced by vl::Image::clear(), vl::GLSLFragmentShader::GLSLFragmentShader(), vl::GLSLGeometryShader::GLSLGeometryShader(), vl::GLSLTessControlShader::GLSLTessControlShader(), vl::GLSLTessEvaluationShader::GLSLTessEvaluationShader(), vl::GLSLVertexShader::GLSLVertexShader(), vl::LoadWriterDICOM::LoadWriterDICOM(), Object(), operator=(), and ~Object().

IMutex* vl::Object::mRefCountMutex`[protected]`

Definition at line 197 of file Object.hpp.

Referenced by Object(), and operator=().

int vl::Object::mReferenceCount`[protected]`

Definition at line 198 of file Object.hpp.

Referenced by ~Object().

bool vl::Object::mAutomaticDelete`[protected]`

Definition at line 199 of file Object.hpp.

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/Object.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlCore/Object.cpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:35.
Permission is granted to use this page to write and publish articles regarding Visualization Library.