IREDObject

Functions

void *

As

const void *

As

class T

As

class T

As

Detailed Description

class IREDObject

Mother class of all REDsdk objects.

@related class RED::Object, class RED::Factory, class RED::CID

REDsdk makes an extensive use of the interface concept. Every object in REDsdk inherits the RED::IREDObject class providing an explicit casting mechanism made of a collection of As methods. Giving an interface descriptor (RED::CID), the user can retrieve a pointer on an interface if the object implements it.

Interface classes are prefixed with a ‘I’ in REDsdk.

There are two ways for retrieving interfaces on RED::IREDObject instances:

(we assume that resmgr is a valid pointer to a RED::Object instance)

RED::IResourceManager* iresmgr = resmgr->As< RED::IResourceManager >();

or

RED::IResourceManager* iresmgr = (RED::IResourceManager*)resmgr->As( RED::IResourceManager::GetClassID() );

Note that const and non-const definitions exist for both methods.

Subclassed by ART::IAssetManager, ART::IAtlas, ART::ICamera, ART::IEntity, ART::IGeometry, ART::ILight, ART::IMaterial, ART::IObserver, ART::IOptions, ART::IPlanet, ART::IReflectionProbe, ART::IStar, ART::IStatistics, ART::IWorld, RED::IAnimationClipController, RED::IChunkSaver, RED::ICloudsVolumeShape, RED::IDataManager, RED::IFont, RED::IGeometryDatabase, RED::IGraphicDevice, RED::IImage, RED::IImage2D, RED::IImage3D, RED::IImageComposite, RED::IImageCube, RED::IImageReadback, RED::ILicense, RED::ILightShape, RED::ILineShape, RED::IMaterial, RED::IMaterialController, RED::IMaterialControllerProperty, RED::IMeshShape, RED::IMoonLightShape, RED::IOptions, RED::IPhysicalLightShape, RED::IPointShape, RED::IREDFile, RED::IReferenceManager, RED::IReferenceSolving, RED::IResourceManager, RED::IShape, RED::ISkeletalAnimationBlender, RED::ISkeletalAnimationController, RED::ISkyLightShape, RED::ISoftBucket, RED::ISoftLight, RED::ISoftRayContext, RED::ISoftRenderingContext, RED::ISoftShaderContext, RED::IStream, RED::ISunLightShape, RED::ITextShape, RED::ITransformShape, RED::IUserData, RED::IViewpoint, RED::IViewpointRenderList, RED::IVolumeShape, RED::IWindow, RED::Object, RNET::IMessage, RNET::IPeer

Public Functions

virtual void *As(const RED::CID &iCID) = 0

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.

virtual const void *As(const RED::CID &iCID) const = 0

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.

template<class T>
T *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.

template<class T>
const T *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.