Class PackageSerializer

Class Documentation

class PackageSerializer

A helper class to serialize packages. Contains methods for serializing all relevant datatypes.

Public Static Functions

template<typename T>
static inline size_t serialize(uint8_t *buffer, T val)

A generalized serialization method for arbitrary datatypes.

Template Parameters:

T – The type to serialize

Parameters:
  • buffer – The buffer to write the serialization into

  • val – The value to serialize

Returns:

Size in byte of the serialization

static inline size_t serialize(uint8_t *buffer, double val)

A serialization method for double values.

Parameters:
  • buffer – The buffer to write the serialization into.

  • val – The value to serialize.

Returns:

Size in byte of the serialization.

static inline size_t serialize(uint8_t *buffer, std::string val)

A serialization method for strings.

Parameters:
  • buffer – The buffer to write the serialization into.

  • val – The string to serialize.

Returns:

Size in byte of the serialization.