class RED::IReferenceManager

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

#include <REDIReferenceManager.h>

Inherits: IREDObject.

Public functions:

virtual RED_RCGetCurrentDataContext ( unsigned int & oDataContext ) = 0
virtual RED::Object *GetReference ( RED::uint64 iReferenceID ) = 0
virtual boolIsReferenced ( RED::IReferenceSolving * iClient ) const = 0
virtual RED_RCRegisterReference ( RED::uint64 iReferenceID, RED::Object * iReference ) = 0
virtual RED_RCRegisterToReferencesSolver ( RED::IReferenceSolving * iClient ) = 0
virtual RED_RCSolvePendingReferences ( const RED::State & iState ) = 0

Public static functions:

static RED::CIDGetClassID ( )

Detailed description:

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

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.

Functions documentation

public virtual RED_RC RED::IReferenceManager::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.

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.
public virtual bool RED::IReferenceManager::IsReferenced(RED::IReferenceSolving *iClient) const = 0

Is the solvable object already referenced?

Parameters:

iClient:Object to test.

Returns:

true if the object is already registered in the reference solver, false otherwise.
public virtual RED_RC RED::IReferenceManager::RegisterReference(RED::uint64iReferenceID,
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.

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.

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.