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, float val)

A serialization method for float 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.

template<typename T, size_t N>
static inline size_t serialize(uint8_t *buffer, const std::array<T, N> &val)

A serialization method for std::arrays (works for urcl::vector6d_t, etc).

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

  • val – The array to serialize.

Returns:

Size in byte of the serialization.