emlabcpp
modern opinionated embedded C++ library
tuple.h
Go to the documentation of this file.
1 
24 #pragma once
25 
26 #include "./traits.h"
27 
28 namespace emlabcpp::protocol
29 {
30 
36 //
38 //
41 template < std::endian Endianess, typename... Ds >
43 {
44  template < typename... SubDs >
45  using with_items = tuple< Endianess, Ds..., SubDs... >;
46 
47  using def_tuple = std::tuple< Ds... >;
48 
49  template < std::size_t N >
50  using nth_def = std::tuple_element_t< N, def_tuple >;
51 
54 
55  static constexpr std::size_t max_size = traits::max_size;
56 
57  using value_type = typename traits::value_type;
59 
60  constexpr static value_type
62  {
63  return value_type{ args... };
64  }
65 };
66 
67 } // namespace emlabcpp::protocol
Protocol library has custom type that represents message, however this is just simple overaly over st...
Definition: message.h:40
MIT License.
Definition: multiplexer.h:33
Endianess
Definition: serializer.h:70
static constexpr std::size_t max_size
Definition: serializer.h:73
Each definition of item provided to protocol library should have specialization of 'proto_traits' str...
Definition: traits.h:44
std::variant< int64_t, float, bool, string_buffer > value_type
Definition: base.h:51
Args const & args
Definition: min_max.h:83
More complex constructs have custom mechanics that internally produces def_type alias used by the lib...
Definition: base.h:122
Follows a set of special data types used for definition of protocol.
Definition: base.h:79
tuple is high levle alternative to use just 'std::tuple' that is more friendly for standalone protoco...
Definition: tuple.h:43
std::tuple< Ds... > def_tuple
Definition: tuple.h:47
static constexpr std::size_t max_size
Definition: tuple.h:55
constexpr static value_type make_val(typename proto_traits< Ds >::value_type const &... args)
Definition: tuple.h:61
typename traits::value_type value_type
Definition: tuple.h:57
std::tuple_element_t< N, def_tuple > nth_def
Definition: tuple.h:50