Next: deserialiser operations, Up: deserialiser [Contents][Index]
deserialiser trait: type definitionsType of the deserialiser trait. Instances of this type are meant to be handed by value
to function calls.
Type of methods table for the deserialiser trait. It has the following fields:
ccname_trait_method_type(ccstructs_deserialiser_T, required_size) * required_sizePointer to function implementing the required_size() method.
ccname_trait_method_type(ccstructs_deserialiser_T, read) * readPointer to function implementing the read() method.
Type of functions implementing the required_size() method. Return the minimum number of
bytes needed to hold the serialisation of the source struct; it is possible that the actual
serialisation has consumed less memory.
Example: let’s say we must read the serialised struct from a file, how many bytes do we need to
read from the file to be sure to have it all? This function answers this question.
Type of functions implementing the read() method. Deserialise the struct from the block of
memory referenced by B, which must be big enough to hold the number of bytes returned by the
method required_size(). Return a new block referencing the memory right after the
deserialised data. If an error occurs: raise an exception violation by performing a non–local exit
to L.
Next: deserialiser operations, Up: deserialiser [Contents][Index]
This document describes version 0.3.0-devel.3 of CCStructs.