My Project
Static Public Member Functions | List of all members
serialize_header Struct Reference

Class to serialize and unserialize a packet (as a std::vector of bytes) with an id representing the type of data. More...

#include <Serialization.hpp>

Static Public Member Functions

template<class Seriazable >
static std::vector< byte > serializeHeader (uint8_t id, Seriazable const &obj)
 A method to serialize an object (the object passed as template argument) into a vector of byte with his type at front. More...
 
static uint8_t getId (std::vector< byte > const &bytes)
 Get the Id object from the bytes. More...
 

Detailed Description

Class to serialize and unserialize a packet (as a std::vector of bytes) with an id representing the type of data.

Member Function Documentation

◆ getId()

static uint8_t serialize_header::getId ( std::vector< byte > const &  bytes)
inlinestatic

Get the Id object from the bytes.

Parameters
bytesUnkwown type Serialized Object with an id representing his type at front
Returns
uint8_t Id representing the type of Object contained in bytes

◆ serializeHeader()

template<class Seriazable >
static std::vector<byte> serialize_header::serializeHeader ( uint8_t  id,
Seriazable const &  obj 
)
inlinestatic

A method to serialize an object (the object passed as template argument) into a vector of byte with his type at front.

Template Parameters
SeriazableType of Structure to serialize
Parameters
idType of structure represented with an enum
objObject to serialize
Returns
std::vector<byte> Serialized object

The documentation for this struct was generated from the following file: