Visualization Library 2.0.0

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

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vl::Object Class Reference

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

#include <Object.hpp>

+ Inheritance diagram for vl::Object:

Public Member Functions

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

Protected Member Functions

virtual ~Object ()
 

Protected Attributes

std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Detailed Description

The base class for all the reference counted objects.

See also vl::ref.

Definition at line 158 of file Object.hpp.

Constructor & Destructor Documentation

◆ Object() [1/2]

vl::Object::Object ( )
inline

Constructor.

Definition at line 164 of file Object.hpp.

References NULL.

◆ Object() [2/2]

vl::Object::Object ( const Object other)
inline

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

Definition at line 181 of file Object.hpp.

References mObjectName, and mRefCountMutex.

◆ ~Object()

Object::~Object ( )
protectedvirtual

Definition at line 45 of file Object.cpp.

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

Member Function Documentation

◆ as() [1/2]

template<class T >
T* vl::Object::as ( )
inline

Casts an Object to the specified class.

Definition at line 282 of file Object.hpp.

Referenced by vl::expandResourceDatabase(), vlX::VLXClassWrapper_Array::export_ArrayT(), vlX::VLXClassWrapper_ActorEventCallback::exportActorEventCallback(), vlX::VLXClassWrapper_DrawCall::exportDrawCall(), vlX::VLXClassWrapper_LODEvaluator::exportLODEvaluator(), vlX::VLXClassWrapper_Geometry::exportVLX(), vlX::VLXClassWrapper_DrawCall::exportVLX(), vlX::VLXClassWrapper_PatchParameter::exportVLX(), vlX::VLXClassWrapper_ResourceDatabase::exportVLX(), vlX::VLXClassWrapper_Uniform::exportVLX(), vlX::VLXClassWrapper_Shader::exportVLX(), vlX::VLXClassWrapper_LODEvaluator::exportVLX(), vlX::VLXClassWrapper_Effect::exportVLX(), vlX::VLXClassWrapper_Actor::exportVLX(), vlX::VLXClassWrapper_Camera::exportVLX(), vlX::VLXClassWrapper_Viewport::exportVLX(), vlX::VLXClassWrapper_Transform::exportVLX(), vlX::VLXClassWrapper_Light::exportVLX(), vlX::VLXClassWrapper_ClipPlane::exportVLX(), vlX::VLXClassWrapper_GLSLProgram::exportVLX(), vlX::VLXClassWrapper_GLSLShader::exportVLX(), vlX::VLXClassWrapper_VertexAttrib::exportVLX(), vlX::VLXClassWrapper_Color::exportVLX(), vlX::VLXClassWrapper_SecondaryColor::exportVLX(), vlX::VLXClassWrapper_Normal::exportVLX(), vlX::VLXClassWrapper_Material::exportVLX(), vlX::VLXClassWrapper_ActorEventCallback::exportVLX(), vlX::VLXClassWrapper_Texture::exportVLX(), vlX::VLXClassWrapper_TexParameter::exportVLX(), vlX::VLXClassWrapper_TextureSampler::exportVLX(), vl::Geometry::flipNormals(), vlX::VLXClassWrapper_ActorEventCallback::importActorEventCallback(), vlX::VLXClassWrapper_DrawCall::importDrawCall(), vlX::VLXClassWrapper_GLSLProgram::importGLSLProgram(), vlX::VLXClassWrapper_LODEvaluator::importLODEvaluator(), vlX::VLXClassWrapper_Transform::importTransform(), vl::Terrain::init(), vl::Applet::initialize(), vl::DaeLoader::load(), vlX::loadVLB(), vlX::loadVLT(), vl::DepthSortCallback::onActorRenderStarted(), vlX::VLXValue::setArray(), vl::Geometry::shrinkDrawCalls(), and vl::Geometry::sortVertices().

◆ as() [2/2]

template<class T >
const T* vl::Object::as ( ) const
inline

Casts an Object to the specified class.

Definition at line 286 of file Object.hpp.

◆ automaticDelete()

bool vl::Object::automaticDelete ( ) const
inline

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

Definition at line 278 of file Object.hpp.

Referenced by ~Object().

◆ decReference()

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 255 of file Object.hpp.

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

◆ incReference()

void vl::Object::incReference ( ) const
inline

◆ objectName()

const std::string& vl::Object::objectName ( ) const
inline

◆ operator=()

Object& vl::Object::operator= ( const Object other)
inline

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

Definition at line 201 of file Object.hpp.

References mObjectName, and mRefCountMutex.

Referenced by vlX::VLXValue::~VLXValue().

◆ refCountMutex() [1/2]

IMutex* vl::Object::refCountMutex ( )
inline

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

Definition at line 229 of file Object.hpp.

◆ refCountMutex() [2/2]

const IMutex* vl::Object::refCountMutex ( ) const
inline

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

Definition at line 232 of file Object.hpp.

◆ referenceCount()

int vl::Object::referenceCount ( ) const
inline

Returns the number of references of an object.

Definition at line 235 of file Object.hpp.

◆ setAutomaticDelete()

void vl::Object::setAutomaticDelete ( bool  autodel_on)
inline

◆ setObjectName() [1/2]

void vl::Object::setObjectName ( const char *  name)
inline

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

Definition at line 220 of file Object.hpp.

Referenced by vl::Image::convertFormat(), vl::Image::convertType(), vl::Texture::createTexture(), vl::DaeLoader::generateGeometry(), vl::Image::Image(), vlX::VLXClassWrapper_Actor::importActor(), vlX::VLXClassWrapper_Camera::importCamera(), vlX::VLXClassWrapper_DrawCall::importDrawCall(), vlX::VLXClassWrapper_Effect::importEffect(), vlX::VLXClassWrapper_GLSLProgram::importGLSLProgram(), vlX::VLXClassWrapper_Light::importLight(), vlX::VLXClassWrapper_Material::importMaterial(), vlX::VLXClassWrapper_Renderable::importRenderable(), vlX::VLXClassWrapper_ResourceDatabase::importResourceDatabase(), vlX::VLXClassWrapper_Shader::importShader(), vlX::VLXClassWrapper_Texture::importTexture(), vlX::VLXClassWrapper_Transform::importTransform(), vlX::VLXClassWrapper_VertexAttrib::importVertexAttrib(), vlX::VLXClassWrapper_Viewport::importViewport(), vl::DaeLoader::load(), vl::load3DS(), vl::loadAC3D(), vl::loadBMP(), vl::loadDDS(), vl::loadDICOM(), vl::loadImage(), vl::loadJPG(), vl::ObjLoader::loadOBJ(), vl::loadPNG(), vl::loadTGA(), vl::makeBox(), vl::makeCapsule(), vl::makeCircle(), vl::makeCone(), vl::makeCylinder(), vl::makeGrid(), vl::makeIcosahedron(), vl::makeIcosphere(), vl::makePoints(), vl::makePyramid(), vl::makeTorus(), vl::makeUVSphere(), vl::DaeLoader::parseEffects(), vl::DaeLoader::parseLight(), vl::GLSLShader::setSource(), and vl::DaeLoader::setupLights().

◆ setObjectName() [2/2]

void vl::Object::setObjectName ( const std::string &  name)
inline

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

Definition at line 223 of file Object.hpp.

◆ setRefCountMutex()

void vl::Object::setRefCountMutex ( IMutex mutex)
inline

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

Definition at line 226 of file Object.hpp.

Member Data Documentation

◆ mAutomaticDelete

bool vl::Object::mAutomaticDelete
protected

Definition at line 304 of file Object.hpp.

◆ mObjectName

std::string vl::Object::mObjectName
protected

Definition at line 300 of file Object.hpp.

Referenced by Object(), operator=(), vl::Image::reset(), and ~Object().

◆ mRefCountMutex

IMutex* vl::Object::mRefCountMutex
protected

Definition at line 302 of file Object.hpp.

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

◆ mReferenceCount

int vl::Object::mReferenceCount
mutableprotected

Definition at line 303 of file Object.hpp.

Referenced by ~Object().


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