Object

Functions

SET_CID

IMPLEMENT_AS

Object

~Object

void

SetID

void

SetID

void

SetID

unsigned int

GetID

void *

operator new

void *

operator new[]

void *

operator new

void *

operator new

void *

operator new[]

void *

operator new[]

void

operator delete

void

operator delete[]

void

operator delete

void

operator delete[]

void

operator delete

void

operator delete[]

unsigned int

GetIDFromString

unsigned int

GetIDFromData

Detailed Description

class Object : public RED::IREDObject

Base REDsdk object class.

@related class RED::IREDObject

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.

Subclassed by RED::Map< unsigned int, RED::IChunkInterpreterProto >, RED::Map< unsigned int, RED::String >, RED::Map< unsigned int, RED::Vector< unsigned int > >, RED::Map< RED::String, RED::IMAGE_TOOLS_LOAD_CALLBACK >, RED::Map< const void *, RED::MemoryLeakTracker::MemInfos >, RED::Map< unsigned int, RED::ShapePath >, RED::Map< RED::String, int >, RED::Map< DATA_KIND, unsigned int >, RED::Map< const RED::Object *, bool >, RED::Vector< RED::AnimationClip::AnimationChannel >, RED::Vector< RED::AnimationClip::AnimationKey >, RED::Vector< RED::Vector< Cell > >, RED::Vector< unsigned int >, RED::Vector< float >, RED::Vector< unsigned char >, RED::Vector< RED::Object * >, RED::Vector< RED::Vector< RED::RenderShaderData > >, RED::Vector< RED::RenderShaderParameter >, RED::Vector< RED::ShapePath::LeafData >, RED::Vector< RED::StateShaderPlatformData >, RED::Vector< RED::String >, RED::AnimationClip, RED::AnimationData, RED::AxisAlignedBoundingBox, RED::BoundingSphere, RED::ChunkInterpretersDictionary, RED::Color, RED::Factory, RED::FileHeader, RED::FileInfo, RED::FileSystemTools, RED::FrameStatistics, RED::IOTools, RED::ImageTools, RED::LayerSet, RED::Map< Key, Item >, RED::Matrix, RED::PassStatistics, RED::PostProcess, RED::Quaternion, RED::RNG, RED::RenderCode, RED::RenderLayer, RED::RenderShaderData, RED::RenderShaderParameter, RED::Shader, RED::ShapePath, RED::State, RED::StateShaderPlatformData, RED::StreamingPolicy, RED::String, RED::Thread, RED::Timer, RED::UserData, RED::Vector< T >, RED::Vector3, RED::Vector4, RED::ViewpointStatistics, RED::VolumetricEffect, RED::WindowRenderInfo, RFK::UserVariable, RNET::Adapter, RNET::Address, RNET::LogEntry

Public Functions

SET_CID(CID_class_REDObject)
IMPLEMENT_AS()
Object()

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.

virtual ~Object()

Destructor.

inline void SetID(unsigned int iID)

Sets the id of the object.

Parameters

iID – The new id of the object.

void SetID(const char *iIDString)

Sets the id of the object.

Parameters

iIDString – The string to convert into a unique numerical ID.

void 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.

inline unsigned int GetID() const

Gets the id of the object.

Returns

The id of the object.

void *operator new(size_t iSize, int iCaller)

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.

void *operator new[](size_t iSize, int iCaller)

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.

void *operator new(size_t iSize)

Local operator new definition.

Parameters

iSize – Byte size of the allocation.

Returns

The allocated address. NULL if an error has occurred.

void *operator new(size_t iSize, 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.

void *operator new[](size_t iSize)

Local operator new [] definition.

Parameters

iSize – Byte size of the allocation.

Returns

The allocated address. NULL if an error has occurred.

void *operator new[](size_t iSize, 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.

void operator delete(void *iAddress)

Local operator delete definition.

Parameters

iAddress – Released memory address.

void operator delete[](void *iAddress)

Local operator delete [] definition.

Parameters

iAddress – Released memory address.

void operator delete(void *iAddress, void *iWhere)

Local operator delete definition.

Parameters
  • iAddress – Released memory address.

  • iWhere – Placement delete position parameter.

void operator delete[](void *iAddress, void *iWhere)

Local operator delete [] definition.

Parameters
  • iAddress – Released memory address.

  • iWhere – Placement delete position parameter.

void operator delete(void *iAddress, int iCaller)

Local operator delete [] definition.

Parameters
  • iAddress – Released memory address.

  • iCaller – Caller of the memory release operation.

void operator delete[](void *iAddress, int iCaller)

Local operator delete [] definition.

Parameters
  • iAddress – Released memory address.

  • iCaller – Caller of the memory release operation.

Public Static Functions

static unsigned int 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.

static unsigned int GetIDFromData(const char *iData, RED::uint64 iLength)

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
  • iData – the data array to convert into a unique key.

  • iLength – length of the data array in bytes.

Returns

The unique key computed from the string.