class RED::Object

Base REDsdk object class. More...

#include <REDObject.h>

Inherits: IREDObject.

Inherited by: Adapter, Address, AnimationClip, AnimationData, BoundingSphere, ChunkInterpretersDictionary, Color, Factory, FileHeader, FileInfo, FileSystemTools, FrameStatistics, ImageTools, IOTools, LayerSet, LogEntry, Map, Matrix, PassStatistics, PostProcess, Quaternion, RenderCode, RenderLayer, RenderShaderData, RenderShaderParameter, RNG, Shader, ShapePath, State, StateShaderPlatformData, StreamingPolicy, String, Thread, Timer, UserData, UserVariable, Vector, Vector3, Vector4, ViewpointStatistics, VolumetricEffect and WindowRenderInfo.

Public functions:

Object ( )
virtual ~Object ( )
virtual void *As ( const RED::CID & iCID )
virtual const void *As ( const RED::CID & iCID ) const
template< class T_As > const T_As *As ( ) const
template< class T_As > T_As *As ( )
unsigned intGetID ( ) const
voidoperator delete ( void * iAddress )
voidoperator delete ( void * iAddress, void * iWhere )
voidoperator delete ( void * iAddress, int iCaller )
voidoperator delete[] ( void * iAddress )
voidoperator delete[] ( void * iAddress, int iCaller )
voidoperator delete[] ( void * iAddress, void * iWhere )
void *operator new ( size_t iSize, int iCaller )
void *operator new ( size_t iSize )
void *operator new ( size_t iSize, void * iWhere )
void *operator new[] ( size_t iSize, int iCaller )
void *operator new[] ( size_t iSize, void * iWhere )
void *operator new[] ( size_t iSize )
voidSetID ( const char * iIDString )
voidSetID ( unsigned int iID )
voidSetID ( const RED::String & iString )

Public static functions:

static RED::CIDGetClassID ( )
static unsigned intGetIDFromData ( const char * iData, RED::uint64 iLength )
static unsigned intGetIDFromString ( const char * iString )

Protected variables:

unsigned int_id

Private static variables:

static unsigned int_counter

Detailed description:

Base REDsdk object class.

All REDsdk objects derive from this class to enable the use of the interface system. A great advantage in using that class as a base class for your objects is that all your allocation/deallocation operations will be managed by the built-in memory allocator. Therefore, if you enable memory leak tracking, you'll be able to receive detailed memory usage reports.

Each RED::Object instance can have an ID set. This ID is not guaranteed to be unique and it's up to the user to manage it. However, by having a strict ID management policy, you can easily use that feature to search nodes in DAGs, find materials or textures and so on.

The object ID is stored internally as an unsigned int. It can be set using two different methods:

  myObject->SetID( 123456789 );

or

  myObject->SetID( "MyObject" );

In the second case, a hash key is computed from the input string an stored as the object ID. Once again, using hash keys do not preserve from conflicts and there is always a probability that two different strings give the same hash key.

Functions documentation

Default constructor.

Each created object receives a default unique identifier value. First object receives an ID equal to 0x80000000, which is incremented by one each time an object is created.

This method prevents most ID collisions to arise. However, we do not guarantee that two objects created on two different threads will receive different IDs, as two concurrent threads may assign the same value before incrementing the counter. On the other hand, two objects created on the same thread will never get the same ID.

The RED::Object::GetIDFromString or RED::String::GetIDFromString methods can be used to convert an unicode string into a numeric ID with a low name collision risk.
The RED::Object::SetID method can be used to define a numeric ID from the contents of a string as a char* or from the raw contents of an UTF-8 RED::String.

public virtual RED::Object::~Object()

Destructor.

Reimplemented by: RED::AnimationClip::GetClassID, RED::AnimationData::GetClassID, RED::BoundingSphere::GetClassID, RED::Color::GetClassID, RED::FastRandom::GetClassID, RED::FileHeader::GetClassID, RED::FileInfo::GetClassID, RED::FrameStatistics::GetClassID, RED::LayerSet::GetClassID, RED::Map::GetClassID, RED::Map::GetClassID, RED::Map::GetClassID, RED::Map::GetClassID, RED::Map::GetClassID, RED::Map::GetClassID, RED::Map::GetClassID, RED::Map::GetClassID, RED::Map::GetClassID, RED::Matrix::GetClassID, RED::PassStatistics::GetClassID, RED::PostProcess::GetClassID, RED::Quaternion::GetClassID, RED::Random::GetClassID, RED::RayCutoffShader::GetClassID, RED::RayGIDiffuseShader::GetClassID, RED::RayGIReflectionColorShader::GetClassID, RED::RayGIRefractionColorShader::GetClassID, RED::RayReflectionShader::GetClassID, RED::RayRefractionShader::GetClassID, RED::ReflectionShader::GetClassID, RED::RenderCode::GetClassID, RED::RenderLayer::GetClassID, RED::RenderShader::GetClassID, RED::RenderShaderAAFilter::GetClassID, RED::RenderShaderAmbient::GetClassID, RED::RenderShaderAnisotropic::GetClassID, RED::RenderShaderData::GetClassID, RED::RenderShaderEdges::GetClassID, RED::RenderShaderEnvironmental::GetClassID, RED::RenderShaderLambert::GetClassID, RED::RenderShaderLogo::GetClassID, RED::RenderShaderParameter::GetClassID, RED::RenderShaderPhong::GetClassID, RED::RenderShaderRefractionEffect::GetClassID, RED::RenderShaderSectionCut::GetClassID, RED::RenderShaderSolid::GetClassID, RED::RenderShaderText::GetClassID, RED::RenderShaderVertexColor::GetClassID, RED::RenderShaderViewport::GetClassID, RED::RNG::GetClassID, RED::Shader::GetClassID, RED::ShaderString::GetClassID, RED::ShapePath::GetClassID, RED::State::GetClassID, RED::StateShader::GetClassID, RED::StateShaderPlatformData::GetClassID, RED::StreamingPolicy::GetClassID, RED::String::GetClassID, RED::Thread::GetClassID, RED::Timer::GetClassID, RED::UserData::GetClassID, RED::UserDataRaw::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector::GetClassID, RED::Vector3::GetClassID, RED::Vector4::GetClassID, RED::ViewpointStatistics::GetClassID, RED::VolumetricEffect::GetClassID, RED::VolumetricEffectBoxVolume::GetClassID, RED::VolumetricEffectClouds::GetClassID, RED::VolumetricEffectLightVolume::GetClassID and RED::WindowRenderInfo::GetClassID.

public static unsigned int RED::Object::GetIDFromData(const char *iData,
RED::uint64iLength
)

Gets a unique ID from a data array.

Converts the input iData into an unique ID. This ID can be used as an identifier on all REDsdk objects with a low collision risk between two names.

Parameters:

iDatathe data array to convert into a unique key.
iLengthlength of the data array in bytes.

Returns:

The unique key computed from the string.
public static unsigned int RED::Object::GetIDFromString(const char *iString)

Gets a unique ID from a string.

Converts the input iString into an unique ID. This ID can be used as an identifier on all REDsdk objects with a low collision risk between two names.

Parameters:

iString:The string to convert into a unique key.

Returns:

The unique key computed from the string.
public virtual void * RED::Object::As(const RED::CID &iCID)

Converts the object to an instance of the given type.

Parameters:

iCID:Requested class.

Returns:

An object pointer of the given class on success, NULL otherwise.

Implements: RED::IREDObject::As.

Reimplemented by: RED::AnimationClip::As, RED::AnimationData::As, RED::BoundingSphere::As, RED::Color::As, RED::FastRandom::As, RED::FileHeader::As, RED::FileInfo::As, RED::FrameStatistics::As, RED::LayerSet::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Matrix::As, RED::PassStatistics::As, RED::PostProcess::As, RED::Quaternion::As, RED::Random::As, RED::RayCutoffShader::As, RED::RayGIDiffuseShader::As, RED::RayGIReflectionColorShader::As, RED::RayGIRefractionColorShader::As, RED::RayReflectionShader::As, RED::RayRefractionShader::As, RED::ReflectionShader::As, RED::RenderCode::As, RED::RenderLayer::As, RED::RenderShader::As, RED::RenderShaderAAFilter::As, RED::RenderShaderAmbient::As, RED::RenderShaderAnisotropic::As, RED::RenderShaderData::As, RED::RenderShaderEdges::As, RED::RenderShaderEnvironmental::As, RED::RenderShaderLambert::As, RED::RenderShaderLogo::As, RED::RenderShaderParameter::As, RED::RenderShaderPhong::As, RED::RenderShaderRefractionEffect::As, RED::RenderShaderSectionCut::As, RED::RenderShaderSolid::As, RED::RenderShaderText::As, RED::RenderShaderVertexColor::As, RED::RenderShaderViewport::As, RED::RNG::As, RED::Shader::As, RED::ShaderString::As, RED::ShapePath::As, RED::State::As, RED::StateShader::As, RED::StateShaderPlatformData::As, RED::StreamingPolicy::As, RED::String::As, RED::Thread::As, RED::Timer::As, RED::UserData::As, RED::UserDataRaw::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector3::As, RED::Vector4::As, RED::ViewpointStatistics::As, RED::VolumetricEffect::As, RED::VolumetricEffectBoxVolume::As, RED::VolumetricEffectClouds::As, RED::VolumetricEffectLightVolume::As and RED::WindowRenderInfo::As.

public virtual const void * RED::Object::As(const RED::CID &iCID) const

Converts the object to an instance of the given type.

Parameters:

iCID:Requested class.

Returns:

An object pointer of the given class on success, NULL otherwise.

Implements: RED::IREDObject::As.

Reimplemented by: RED::AnimationClip::As, RED::AnimationData::As, RED::BoundingSphere::As, RED::Color::As, RED::FastRandom::As, RED::FileHeader::As, RED::FileInfo::As, RED::FrameStatistics::As, RED::LayerSet::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Matrix::As, RED::PassStatistics::As, RED::PostProcess::As, RED::Quaternion::As, RED::Random::As, RED::RayCutoffShader::As, RED::RayGIDiffuseShader::As, RED::RayGIReflectionColorShader::As, RED::RayGIRefractionColorShader::As, RED::RayReflectionShader::As, RED::RayRefractionShader::As, RED::ReflectionShader::As, RED::RenderCode::As, RED::RenderLayer::As, RED::RenderShader::As, RED::RenderShaderAAFilter::As, RED::RenderShaderAmbient::As, RED::RenderShaderAnisotropic::As, RED::RenderShaderData::As, RED::RenderShaderEdges::As, RED::RenderShaderEnvironmental::As, RED::RenderShaderLambert::As, RED::RenderShaderLogo::As, RED::RenderShaderParameter::As, RED::RenderShaderPhong::As, RED::RenderShaderRefractionEffect::As, RED::RenderShaderSectionCut::As, RED::RenderShaderSolid::As, RED::RenderShaderText::As, RED::RenderShaderVertexColor::As, RED::RenderShaderViewport::As, RED::RNG::As, RED::Shader::As, RED::ShaderString::As, RED::ShapePath::As, RED::State::As, RED::StateShader::As, RED::StateShaderPlatformData::As, RED::StreamingPolicy::As, RED::String::As, RED::Thread::As, RED::Timer::As, RED::UserData::As, RED::UserDataRaw::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector3::As, RED::Vector4::As, RED::ViewpointStatistics::As, RED::VolumetricEffect::As, RED::VolumetricEffectBoxVolume::As, RED::VolumetricEffectClouds::As, RED::VolumetricEffectLightVolume::As and RED::WindowRenderInfo::As.

template< class T_As > public const T_As * RED::Object::As() const

Template version of the as const method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to a const instance of class T on success, NULL otherwise.

Reimplements: RED::IREDObject::As.

Reimplemented by: RED::AnimationClip::As, RED::AnimationData::As, RED::BoundingSphere::As, RED::Color::As, RED::FastRandom::As, RED::FileHeader::As, RED::FileInfo::As, RED::FrameStatistics::As, RED::LayerSet::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Matrix::As, RED::PassStatistics::As, RED::PostProcess::As, RED::Quaternion::As, RED::Random::As, RED::RayCutoffShader::As, RED::RayGIDiffuseShader::As, RED::RayGIReflectionColorShader::As, RED::RayGIRefractionColorShader::As, RED::RayReflectionShader::As, RED::RayRefractionShader::As, RED::ReflectionShader::As, RED::RenderCode::As, RED::RenderLayer::As, RED::RenderShader::As, RED::RenderShaderAAFilter::As, RED::RenderShaderAmbient::As, RED::RenderShaderAnisotropic::As, RED::RenderShaderData::As, RED::RenderShaderEdges::As, RED::RenderShaderEnvironmental::As, RED::RenderShaderLambert::As, RED::RenderShaderLogo::As, RED::RenderShaderParameter::As, RED::RenderShaderPhong::As, RED::RenderShaderRefractionEffect::As, RED::RenderShaderSectionCut::As, RED::RenderShaderSolid::As, RED::RenderShaderText::As, RED::RenderShaderVertexColor::As, RED::RenderShaderViewport::As, RED::RNG::As, RED::Shader::As, RED::ShaderString::As, RED::ShapePath::As, RED::State::As, RED::StateShader::As, RED::StateShaderPlatformData::As, RED::StreamingPolicy::As, RED::String::As, RED::Thread::As, RED::Timer::As, RED::UserData::As, RED::UserDataRaw::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector3::As, RED::Vector4::As, RED::ViewpointStatistics::As, RED::VolumetricEffect::As, RED::VolumetricEffectBoxVolume::As, RED::VolumetricEffectClouds::As, RED::VolumetricEffectLightVolume::As and RED::WindowRenderInfo::As.

template< class T_As > public T_As * RED::Object::As()

Template version of the as method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to an instance of class T on success, NULL otherwise.

Reimplements: RED::IREDObject::As.

Reimplemented by: RED::AnimationClip::As, RED::AnimationData::As, RED::BoundingSphere::As, RED::Color::As, RED::FastRandom::As, RED::FileHeader::As, RED::FileInfo::As, RED::FrameStatistics::As, RED::LayerSet::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Map::As, RED::Matrix::As, RED::PassStatistics::As, RED::PostProcess::As, RED::Quaternion::As, RED::Random::As, RED::RayCutoffShader::As, RED::RayGIDiffuseShader::As, RED::RayGIReflectionColorShader::As, RED::RayGIRefractionColorShader::As, RED::RayReflectionShader::As, RED::RayRefractionShader::As, RED::ReflectionShader::As, RED::RenderCode::As, RED::RenderLayer::As, RED::RenderShader::As, RED::RenderShaderAAFilter::As, RED::RenderShaderAmbient::As, RED::RenderShaderAnisotropic::As, RED::RenderShaderData::As, RED::RenderShaderEdges::As, RED::RenderShaderEnvironmental::As, RED::RenderShaderLambert::As, RED::RenderShaderLogo::As, RED::RenderShaderParameter::As, RED::RenderShaderPhong::As, RED::RenderShaderRefractionEffect::As, RED::RenderShaderSectionCut::As, RED::RenderShaderSolid::As, RED::RenderShaderText::As, RED::RenderShaderVertexColor::As, RED::RenderShaderViewport::As, RED::RNG::As, RED::Shader::As, RED::ShaderString::As, RED::ShapePath::As, RED::State::As, RED::StateShader::As, RED::StateShaderPlatformData::As, RED::StreamingPolicy::As, RED::String::As, RED::Thread::As, RED::Timer::As, RED::UserData::As, RED::UserDataRaw::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector::As, RED::Vector3::As, RED::Vector4::As, RED::ViewpointStatistics::As, RED::VolumetricEffect::As, RED::VolumetricEffectBoxVolume::As, RED::VolumetricEffectClouds::As, RED::VolumetricEffectLightVolume::As and RED::WindowRenderInfo::As.

public unsigned int RED::Object::GetID() const

Gets the id of the object.

Returns:

The id of the object.
public void RED::Object::operator delete(void *iAddress)

Local operator delete definition.

Parameters:

iAddress:Released memory address.
public void RED::Object::operator delete(void *iAddress,
void *iWhere
)

Local operator delete definition.

Parameters:

iAddress:Released memory address.
iWhere:Placement delete position parameter.
public void RED::Object::operator delete(void *iAddress,
intiCaller
)

Local operator delete [] definition.

Parameters:

iAddress:Released memory address.
iCaller:Caller of the memory release operation.
public void RED::Object::operator delete[](void *iAddress)

Local operator delete [] definition.

Parameters:

iAddress:Released memory address.
public void RED::Object::operator delete[](void *iAddress,
intiCaller
)

Local operator delete [] definition.

Parameters:

iAddress:Released memory address.
iCaller:Caller of the memory release operation.
public void RED::Object::operator delete[](void *iAddress,
void *iWhere
)

Local operator delete [] definition.

Parameters:

iAddress:Released memory address.
iWhere:Placement delete position parameter.
public void * RED::Object::operator new(size_tiSize,
intiCaller
)

Local operator new definition.

The custom new operator is called through 'rnew'. See the RED::MemoryAllocator class for all details on customized allocations.

Parameters:

iSize:Byte size of the allocation.
iCaller:Identifier of the allocation caller.

Returns:

The allocated address. NULL if an error has occurred.
public void * RED::Object::operator new(size_tiSize)

Local operator new definition.

Parameters:

iSize:Byte size of the allocation.

Returns:

The allocated address. NULL if an error has occurred.
public void * RED::Object::operator new(size_tiSize,
void *iWhere
)

Local operator new definition.

Parameters:

iSize:Byte size of the allocation.
iWhere:Placement new position parameter.

Returns:

The allocated address. NULL if an error has occurred.
public void * RED::Object::operator new[](size_tiSize,
intiCaller
)

Local operator new [] definition.

The custom new operator is called through 'rnew'. See the RED::MemoryAllocator class for all details on customized allocations.

Parameters:

iSize:Byte size of the allocation.
iCaller:Identifier of the allocation caller.

Returns:

The allocated address. NULL if an error has occurred.
public void * RED::Object::operator new[](size_tiSize,
void *iWhere
)

Local operator new [] definition.

Parameters:

iSize:Byte size of the allocation.
iWhere:Placement new position parameter.

Returns:

The allocated address. NULL if an error has occurred.
public void * RED::Object::operator new[](size_tiSize)

Local operator new [] definition.

Parameters:

iSize:Byte size of the allocation.

Returns:

The allocated address. NULL if an error has occurred.
public void RED::Object::SetID(const char *iIDString)

Sets the id of the object.

Parameters:

iIDString:The string to convert into a unique numerical ID.
public void RED::Object::SetID(unsigned intiID)

Sets the id of the object.

Parameters:

iID:The new id of the object.
public void RED::Object::SetID(const RED::String &iString)

Sets the id of the object.

Parameters:

iString:Source string contents used to define the ID of the object. The string untranslated buffer is used to define the numerical ID value.

Variables documentation

protected unsigned int RED::Object::_id

_id: id of the object.

private static unsigned int RED::Object::_counter

_counter: Global ID counter. Incremented by one each time an object is being created.