emlabcpp
modern opinionated embedded C++ library
emlabcpp::protocol::register_handler< Map > Struct Template Reference

Handler for serialization and extraction of datatypes used by the register_map. More...

#include <register_handler.h>

Public Types

using map_type = Map
 
using key_type = typename map_type::key_type
 
using message_type = typename map_type::message_type
 
template<key_type Key>
using reg_value_type = typename map_type::template reg_value_type< Key >
 
template<key_type Key>
using reg_def_type = typename map_type::template reg_def_type< Key >
 

Static Public Member Functions

template<key_type Key>
static message_type serialize (reg_value_type< Key > val)
 
static message_type select (map_type const &m, key_type key)
 
template<key_type Key>
static std::variant< reg_value_type< Key >, error_recordextract (view< std::byte const * > const &msg)
 
static std::optional< error_recordinsert (map_type &m, key_type key, view< std::byte const * > const &buff)
 

Static Public Attributes

static constexpr std::size_t max_size = map_type::max_value_size
 

Detailed Description

template<typename Map>
struct emlabcpp::protocol::register_handler< Map >

Handler for serialization and extraction of datatypes used by the register_map.

This provides interface for handling conversion of bytes to types used in the map. serialize and extract works directly with the types used by the map, based on compile time key. select and insert works with the map itself based on runtime information.

Member Typedef Documentation

◆ key_type

template<typename Map >
using emlabcpp::protocol::register_handler< Map >::key_type = typename map_type::key_type

◆ map_type

template<typename Map >
using emlabcpp::protocol::register_handler< Map >::map_type = Map

◆ message_type

template<typename Map >
using emlabcpp::protocol::register_handler< Map >::message_type = typename map_type::message_type

◆ reg_def_type

template<typename Map >
template<key_type Key>
using emlabcpp::protocol::register_handler< Map >::reg_def_type = typename map_type::template reg_def_type< Key >

◆ reg_value_type

template<typename Map >
template<key_type Key>
using emlabcpp::protocol::register_handler< Map >::reg_value_type = typename map_type::template reg_value_type< Key >

Member Function Documentation

◆ extract()

◆ insert()

template<typename Map >
static std::optional< error_record > emlabcpp::protocol::register_handler< Map >::insert ( map_type m,
key_type  key,
view< std::byte const * > const &  buff 
)
inlinestatic

References emlabcpp::match(), and emlabcpp::res.

◆ select()

template<typename Map >
static message_type emlabcpp::protocol::register_handler< Map >::select ( map_type const &  m,
key_type  key 
)
inlinestatic

◆ serialize()

template<typename Map >
template<key_type Key>
static message_type emlabcpp::protocol::register_handler< Map >::serialize ( reg_value_type< Key >  val)
inlinestatic

Member Data Documentation

◆ max_size

template<typename Map >
constexpr std::size_t emlabcpp::protocol::register_handler< Map >::max_size = map_type::max_value_size
staticconstexpr

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