Template Function liberate::serialization::deserialize_int

Function Documentation

template<typename outT, typename inT, std::enable_if_t<liberate::types::is_8bit_type<inT>::value, int> = 0>
constexpr integer_serialization_enabled<outT> liberate::serialization::deserialize_int(outT &output, inT const *input, std::size_t const &input_length)

Deserialize from buffer.

The buffer is defined by a pointer and a size. The input is an integer value for which deserialize_int is explicitly enabled (see above).

If the buffer is too small, zero is returned. Otherwise, the number of units read from the buffer is.

Note: the function is restricted to 8-bit input buffer types only, though the detail implementation works for other values. The reason is that for actual cross-platform value serialization, only 8-bit buffers matter.

See also serialize_int

  • outT The output type, which can be any of the types enabled by integer_serialization_enabled.

  • inT The input type, which can be any 8-bit integer type.

Parameters
  • output[out] The deserialized value.

  • input[in] The input buffer to read from.

  • input_length[in] The size of the input buffer.

Returns

The number of bytes of input buffer consumed, or 0 on errors.