34 template <
typename Packet >
48 static constexpr
auto endianess = Packet::endianess;
60 std::span< std::byte, checksum_size >{
67 static std::variant< value_type, error_record >
72 [&msg]( std::tuple< prefix_type, value_type, checksum_type > pack )
73 -> std::variant< value_type, error_record > {
80 if ( present_checksum != calculated_checksum )
84 return std::get< 1 >( pack );
86 [&](
error_record const err ) -> std::variant< value_type, error_record > {
Generic class to represent view of some container.
Definition: view.h:41
constexpr Iterator begin() const
Start of the dataset iterator.
Definition: view.h:104
constexpr size_type size() const
Size of the view over dataset uses std::ranges::distance() to tell the size.
Definition: view.h:135
MIT License.
Definition: multiplexer.h:33
static constexpr auto CHECKSUM_ERR
wrong checksum in the protocol
Definition: error.h:58
mark error_mark
Definition: error.h:40
bounded< std::size_t, max_size, max_size > size_type
Definition: serializer.h:74
static constexpr std::size_t max_size
Definition: serializer.h:73
std::variant< int64_t, float, bool, string_buffer > value_type
Definition: base.h:51
decltype(auto) match(Variant &&var, Callables &&... cals)
Definition: match.h:55
constexpr view< Iter > view_n(Iter begin, std::size_t const n)
Creates view over 'n' items of dataset starting at 'begin' This does not check validity of the range!
Definition: view.h:198
physical_quantity represents all physical units defined using the International System of Units and m...
Definition: physical_quantity.h:56
handler< T > should be used to execute actual serialization and deserealization of protocol definitio...
Definition: handler.h:39
static std::variant< value_type, error_record > extract(view< std::byte const * > const &msg)
Definition: handler.h:57
static message_type serialize(value_type const &val)
Definition: handler.h:45
Definition: packet_handler.h:36
typename Packet::prefix_type prefix_type
Definition: packet_handler.h:38
typename Packet::checksum_type checksum_type
Definition: packet_handler.h:42
static constexpr std::size_t size_offset
Definition: packet_handler.h:45
static constexpr std::size_t checksum_size
Definition: packet_handler.h:46
static constexpr auto endianess
Definition: packet_handler.h:48
static std::variant< value_type, error_record > extract(view< std::byte const * > const &msg)
Definition: packet_handler.h:68
typename Packet::payload_type payload_type
Definition: packet_handler.h:39
static message_type serialize(value_type const &val)
Definition: packet_handler.h:50
typename Packet::message_type message_type
Definition: packet_handler.h:37
typename Packet::value_type value_type
Definition: packet_handler.h:40
typename Packet::size_type size_type
Definition: packet_handler.h:41
static constexpr std::size_t size_size
Definition: packet_handler.h:47
static constexpr void serialize_at(std::span< std::byte, max_size > buffer, T item)
Definition: serializer.h:48