Visualization Library 2.0.0-b3

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(), vl::VLXClassWrapper_Array::export_ArrayT(), vl::VLXClassWrapper_ActorEventCallback::exportActorEventCallback(), vl::VLXClassWrapper_DrawCall::exportDrawCall(), vl::VLXClassWrapper_LODEvaluator::exportLODEvaluator(), vl::VLXClassWrapper_Geometry::exportVLX(), vl::VLXClassWrapper_DrawCall::exportVLX(), vl::VLXClassWrapper_PatchParameter::exportVLX(), vl::VLXClassWrapper_ResourceDatabase::exportVLX(), vl::VLXClassWrapper_Uniform::exportVLX(), vl::VLXClassWrapper_Shader::exportVLX(), vl::VLXClassWrapper_LODEvaluator::exportVLX(), vl::VLXClassWrapper_Effect::exportVLX(), vl::VLXClassWrapper_Actor::exportVLX(), vl::VLXClassWrapper_Camera::exportVLX(), vl::VLXClassWrapper_Viewport::exportVLX(), vl::VLXClassWrapper_Transform::exportVLX(), vl::VLXClassWrapper_Light::exportVLX(), vl::VLXClassWrapper_ClipPlane::exportVLX(), vl::VLXClassWrapper_GLSLProgram::exportVLX(), vl::VLXClassWrapper_GLSLShader::exportVLX(), vl::VLXClassWrapper_VertexAttrib::exportVLX(), vl::VLXClassWrapper_Color::exportVLX(), vl::VLXClassWrapper_SecondaryColor::exportVLX(), vl::VLXClassWrapper_Normal::exportVLX(), vl::VLXClassWrapper_Material::exportVLX(), vl::VLXClassWrapper_ActorEventCallback::exportVLX(), vl::VLXClassWrapper_Texture::exportVLX(), vl::VLXClassWrapper_TexParameter::exportVLX(), vl::VLXClassWrapper_TextureSampler::exportVLX(), vl::Geometry::flipNormals(), vl::VLXClassWrapper_ActorEventCallback::importActorEventCallback(), vl::VLXClassWrapper_DrawCall::importDrawCall(), vl::VLXClassWrapper_GLSLProgram::importGLSLProgram(), vl::VLXClassWrapper_LODEvaluator::importLODEvaluator(), vl::VLXClassWrapper_Transform::importTransform(), vl::Terrain::init(), vl::Applet::initialize(), vl::DaeLoader::load(), vl::loadVLB(), vl::loadVLT(), vl::DepthSortCallback::onActorRenderStarted(), vl::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

Increments the reference count of an object.

Definition at line 241 of file Object.hpp.

◆ 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 vl::VLTTokenizer::getToken(), and vl::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

◆ 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: