emlabcpp
modern opinionated embedded C++ library
emlabcpp::protocol::command< ID, Defs > Struct Template Reference

Command group represents a segment in the message, that may contain multiple different variants of value, that are identified by ID at the beginning of the segment. More...

#include <command_group.h>

Public Types

using id_type = decltype(ID)
 
using value_type = std::tuple< tag< ID >, typename proto_traits< Defs >::value_type... >
 
using def_type = std::tuple< tag< ID >, Defs... >
 
template<typename... NewDefs>
using with_args = command< ID, Defs..., NewDefs... >
 

Static Public Member Functions

constexpr static value_type make_val (typename proto_traits< Defs >::value_type const &... args)
 Creates value of the command based on the args. More...
 

Static Public Attributes

static constexpr id_type id = ID
 

Detailed Description

template<auto ID, convertible... Defs>
struct emlabcpp::protocol::command< ID, Defs >

Command group represents a segment in the message, that may contain multiple different variants of value, that are identified by ID at the beginning of the segment.

The ID is defined in the definition. This simulates abstraction of set of commands that can be sent that is frequently used by embedded devices. One command in a group defined by ID and definitions for items contained in this command. It is preferable to use the command::with_args<...> alias that just extens the list of defined items in the command. For example: command<32>::with_args<uint32_t, uint32_t> Internally, the example leads to definition std::tuple< tag<32>, uint32_t, uint32_t >

Member Typedef Documentation

◆ def_type

template<auto ID, convertible... Defs>
using emlabcpp::protocol::command< ID, Defs >::def_type = std::tuple< tag< ID >, Defs... >

◆ id_type

template<auto ID, convertible... Defs>
using emlabcpp::protocol::command< ID, Defs >::id_type = decltype( ID )

◆ value_type

template<auto ID, convertible... Defs>
using emlabcpp::protocol::command< ID, Defs >::value_type = std::tuple< tag< ID >, typename proto_traits< Defs >::value_type... >

◆ with_args

template<auto ID, convertible... Defs>
template<typename... NewDefs>
using emlabcpp::protocol::command< ID, Defs >::with_args = command< ID, Defs..., NewDefs... >

Member Function Documentation

◆ make_val()

template<auto ID, convertible... Defs>
constexpr static value_type emlabcpp::protocol::command< ID, Defs >::make_val ( typename proto_traits< Defs >::value_type const &...  args)
inlinestaticconstexpr

Creates value of the command based on the args.

References emlabcpp::args.

Member Data Documentation

◆ id

template<auto ID, convertible... Defs>
constexpr id_type emlabcpp::protocol::command< ID, Defs >::id = ID
staticconstexpr

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