IReferenceManager

Functions

CID

GetClassID

RED_RC

RegisterReference

Object *

GetReference

RED_RC

RegisterToReferencesSolver

RED_RC

SolvePendingReferences

bool

IsReferenced

RED_RC

GetCurrentDataContext

Detailed Description

class IReferenceManager : public RED::IREDObject

This class manages references as they are loaded through a .red file.

@related class RED::IREDFile, class RED::IReferenceSolving

Loading a .red file is a two steps process. First, the content of the file is loaded and interpreted (a list of dependencies between loaded data is built). Second, the dependencies between the loaded data are solved. That’s the purpose of the ReferenceManager. Every loaded data that acts as a reference must register itself to the ReferenceManager. Every data that points on references must record itself too to be later solved.

Public Functions

virtual RED_RC RegisterReference(RED::uint64 iReferenceID, RED::Object *iReference) = 0

Registers a reference to be used by the pending references solver.

If the reference is already registered, RED_OK is returned.

Parameters
  • iReferenceID – ID of the reference.

  • iReference – pointer to the reference.

Returns

RED_OK on success,

RED_BAD_PARAM if ‘iReference’ is an invalid pointer, RED_ALLOC_FAILURE on a memory allocation error,

RED_FAIL otherwise.

virtual RED::Object *GetReference(RED::uint64 iReferenceID) = 0

Gets a reference pointer by its ID.

Parameters

iReferenceID – ID of the reference to retrieve.

Returns

A pointer to the requested reference on success,

RED_FAIL otherwise.

virtual RED_RC RegisterToReferencesSolver(RED::IReferenceSolving *iClient) = 0

Registers an object implementing RED::IReferenceSolving to the references solver.

The registered objects will be automatically called on a call to ResolvePendingReferences.

Parameters

iClient – Pointer to an object implementing the RED::IReferenceSolving interface.

Returns

RED_OK on success,

RED_BAD_PARAM if ‘iClient’ is an invalid pointer,

RED_ALLOC_FAILURE on a memory allocation error,

RED_FAIL otherwise.

virtual RED_RC SolvePendingReferences(const RED::State &iState) = 0

Solves the pending references made between chunks.

The SolveReferences method of the registered objects implementing the RED::IReferenceSolving interface is call. If any of these objects return a RED_RC other than RED_OK, the RED_RC is returned by the method.

Parameters

iState – Current transaction.

Returns

RED_OK on success,

RED_ALLOC_FAILURE on a memory allocation error,

RED_FAIL otherwise.

virtual bool IsReferenced(RED::IReferenceSolving *iClient) const = 0

Is the solvable object already referenced?

Parameters

iClientObject to test.

Returns

true if the object is already registered in the reference solver, false otherwise.

virtual RED_RC GetCurrentDataContext(unsigned int &oDataContext) = 0

Gets the current data context ID.

When solving the references, a user may need to create new data in the current context (Event registration for example).

Parameters

oDataContext – reference to the current data context.

Returns

RED_OK on success,

RED_BAD_PARAM if ‘iClient’ is an invalid pointer,

RED_ALLOC_FAILURE on a memory allocation error,

RED_FAIL otherwise.

Public Static Functions

static inline RED::CID GetClassID()