Functions
serialization.h File Reference

Serialization helper. More...

Functions

VTM_API int vtm_pack_float (float in, uint32_t *out)
 
VTM_API int vtm_pack_double (double in, uint64_t *out)
 
VTM_API int vtm_unpack_float (uint32_t in, float *out)
 
VTM_API int vtm_unpack_double (uint64_t in, double *out)
 

Function Documentation

VTM_API int vtm_pack_float ( float  in,
uint32_t *  out 
)

Serializes a float value so that it can be stored in 4 bytes.

Parameters
inthe float that should be packed
[out]outholds the serialized data
Returns
VTM_OK if the packing was successful
VTM_E_INVALID_ARG if input is NaN
VTM_API int vtm_pack_double ( double  in,
uint64_t *  out 
)

Serializes a double value so that it can be stored in 8 bytes.

Parameters
inthe double that should be packed
[out]outholds the serialized data
Returns
VTM_OK if the packing was successful
VTM_E_INVALID_ARG if input is NaN
VTM_API int vtm_unpack_float ( uint32_t  in,
float *  out 
)

Deserializes a 4 byte packed float value.

Parameters
inthe packed data
[out]outthe unpacked float value
Returns
VTM_OK if the unpacking was successful
VTM_ERROR if an error occured
VTM_API int vtm_unpack_double ( uint64_t  in,
double *  out 
)

Deserializes a 8 byte packed double value.

Parameters
inthe packed data
[out]outthe unpacked double value
Returns
VTM_OK if the unpacking was successful
VTM_ERROR if an error occured