emlabcpp
modern opinionated embedded C++ library
emlabcpp::protocol::handler< T, E > Struct Template Reference

handler< T > should be used to execute actual serialization and deserealization of protocol definition. More...

#include <handler.h>

Public Types

using def = converter_for< T, E >
 
using value_type = typename def::value_type
 
using message_type = message< max_size >
 

Static Public Member Functions

static message_type serialize (value_type const &val)
 
static std::variant< value_type, error_recordextract (view< std::byte const * > const &msg)
 

Static Public Attributes

static constexpr std::size_t max_size = def::max_size
 

Detailed Description

template<convertible T, std::endian E = std::endian::big>
struct emlabcpp::protocol::handler< T, E >

handler< T > should be used to execute actual serialization and deserealization of protocol definition.

It provides serialize/extract methods that should be used by the user. You may want to have this class (With the include) to be present in separate .cpp file, as the compile time can be quite heavy.

Member Typedef Documentation

◆ def

template<convertible T, std::endian E = std::endian::big>
using emlabcpp::protocol::handler< T, E >::def = converter_for< T, E >

◆ message_type

template<convertible T, std::endian E = std::endian::big>
using emlabcpp::protocol::handler< T, E >::message_type = message< max_size >

◆ value_type

template<convertible T, std::endian E = std::endian::big>
using emlabcpp::protocol::handler< T, E >::value_type = typename def::value_type

Member Function Documentation

◆ extract()

template<convertible T, std::endian E = std::endian::big>
static std::variant< value_type, error_record > emlabcpp::protocol::handler< T, E >::extract ( view< std::byte const * > const &  msg)
inlinestatic

◆ serialize()

template<convertible T, std::endian E = std::endian::big>
static message_type emlabcpp::protocol::handler< T, E >::serialize ( value_type const &  val)
inlinestatic

Member Data Documentation

◆ max_size

template<convertible T, std::endian E = std::endian::big>
constexpr std::size_t emlabcpp::protocol::handler< T, E >::max_size = def::max_size
staticconstexpr

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