emlabcpp
modern opinionated embedded C++ library
|
Command group should be used as a collection of commands that are selected based on the ID, during the deserialization first command that matches is selected. More...
#include <command_group.h>
Public Types | |
using | cmds_type = std::tuple< Cmds... > |
template<auto ID> | |
using | cmd_type = std::tuple_element_t< id_index< ID >, cmds_type > |
template<auto ID> | |
using | cmd_value_type = typename cmd_type< ID >::value_type |
template<typename... SubCmds> | |
using | with_commands = command_group< Endianess, Cmds..., SubCmds... > |
using | def_type = endianess_wrapper< Endianess, group< typename Cmds::def_type... > > |
using | traits = proto_traits< def_type > |
using | value_type = typename traits::value_type |
using | message_type = message< max_size > |
Public Member Functions | |
template<auto id, typename... Args> | |
requires ((id==Cmds::id)||...) const expr static value_type make_val(Args const &... args) | |
Creates value of the command group, that is variant with value of the command 'id' that will receive the appropiate 'args'. More... | |
Static Public Attributes | |
template<auto ID> | |
static constexpr std::size_t | id_index = get_id_index( ID ) |
static constexpr std::size_t | max_size = proto_traits< def_type >::max_size |
Command group should be used as a collection of commands that are selected based on the ID, during the deserialization first command that matches is selected.
The command_group acts as def_type that is handled by the protocol library. The internal definition produced is just std::variant of tuples that form the commands itself. Note that group without commands is not usable by the protocol library as that case is specialized and doesn ot contain any protocol definitions. This is required implementation detail.
using emlabcpp::protocol::command_group< Endianess, Cmds >::cmd_type = std::tuple_element_t< id_index< ID >, cmds_type > |
using emlabcpp::protocol::command_group< Endianess, Cmds >::cmd_value_type = typename cmd_type< ID >::value_type |
using emlabcpp::protocol::command_group< Endianess, Cmds >::cmds_type = std::tuple< Cmds... > |
using emlabcpp::protocol::command_group< Endianess, Cmds >::def_type = endianess_wrapper< Endianess, group< typename Cmds::def_type... > > |
using emlabcpp::protocol::command_group< Endianess, Cmds >::message_type = message< max_size > |
using emlabcpp::protocol::command_group< Endianess, Cmds >::traits = proto_traits< def_type > |
using emlabcpp::protocol::command_group< Endianess, Cmds >::value_type = typename traits::value_type |
using emlabcpp::protocol::command_group< Endianess, Cmds >::with_commands = command_group< Endianess, Cmds..., SubCmds... > |
|
inline |
Creates value of the command group, that is variant with value of the command 'id' that will receive the appropiate 'args'.
References emlabcpp::args, EMLABCPP_ASSERT, emlabcpp::for_each_index(), and emlabcpp::res.
|
staticconstexpr |
|
staticconstexpr |