ChunkInterpretersDictionary
Functions
RED_RC |
RegisterChunkInterpreter |
RED_RC |
GetChunkInterpreter |
void | ClearAllChunksInterpreters |
Detailed Description
-
class
ChunkInterpretersDictionary
: public RED::Object That class registers all the REDsdk default chunk interpreters.
@related class RED::IChunkSaver, class RED::IREDFile, class RED::IStream
Chunks are “atoms” of .red files. Data are organized into chunks inside a file and a valid chunk interpreter must be registered for every kind of chunk encountered to successfully load a file. By default, REDsdk provides valid registered chunk interpreters for every type of streamable built-in data.
The dictionary is used in a static manner to register all known file chunks into a lookup table used to select the right interpretation routine for every chunk to translate.
Custom user chunks may be registered for user data interpretation. This way, you can add and “versionize” as many chunks you wish and extend the .red file format to fulfill your requirements.
Public Static Functions
-
static RED_RC
RegisterChunkInterpreter
(unsigned int iChunkSignature, RED::IChunkInterpreterProto iChunkInterpreter) Registers a chunk interpreter.
The range of valid custom chunk signatures is [0x0000ffff, 0xffffffff]. If the chunk interpreter is already registered, RED_OK is returned.
Parameters: - iChunkSignature – Chunk’s signature.
- iChunkInterpreter – Pointer to an implementation of the RED::IChunkInterpreter interface.
Returns: RED_OK on success,
RED_BAD_PARAM if the iChunkInterpreter pointer is invalid,
RED_ALLOC_FAILURE on a memory allocation error,
RED_FAIL otherwise.
-
static RED_RC
GetChunkInterpreter
(RED::IChunkInterpreterProto &oChunkInterpreter, unsigned int iChunkSignature) Gets a chunk interpreter for a given chunk signature.
Parameters: - oChunkInterpreter – Returned chunk interpreter, NULL if we have no interpreter for ‘iSignature’.
- iChunkSignature – Signature of the chunk interpreter to retrieve.
Returns: RED_OK when the operation has succeeded,
RED_BAD_PARAM if the chunk signature is not known,
RED_ALLOC_FAILURE if a memory allocation has failed.
-
static void
ClearAllChunksInterpreters
() Cleans everything up before process exits.
-
static RED_RC