COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
ProtocolLayerBase.h
Go to the documentation of this file.
1//
2// Copyright 2025 - 2026 (C). Alex Robenko. All rights reserved.
3//
4// SPDX-License-Identifier: MPL-2.0
5//
6// This Source Code Form is subject to the terms of the Mozilla Public
7// License, v. 2.0. If a copy of the MPL was not distributed with this
8// file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
12
13#pragma once
14
16
17namespace comms
18{
19
20namespace protocol
21{
22
25template <typename TField, typename TNextLayer, typename TDerived, typename... TOptions>
26using ProtocolLayerBase = comms::frame::FrameLayerBase<TField, TNextLayer, TDerived, TOptions...>;
27
30template <typename TField,typename TNextLayer, typename TDerived, typename... TOptions>
35
38template <typename TField,typename TNextLayer, typename TDerived, typename... TOptions>
43
46inline auto missingSize(std::size_t& val) -> decltype(comms::frame::missingSize(val))
47{
48 return comms::frame::missingSize(val);
49}
50
53template <typename TId>
54auto msgId(TId& val) -> decltype(comms::frame::msgId(val))
55{
56 return comms::frame::msgId(val);
57}
58
61inline auto msgIndex(std::size_t& val) -> decltype(comms::frame::msgIndex(val))
62{
63 return comms::frame::msgIndex(val);
64}
65
68template <typename TIter>
69auto msgPayload(TIter& iter, std::size_t& len) -> decltype(comms::frame::msgPayload(iter, len))
70{
71 return comms::frame::msgPayload(iter, len);
72}
73
74} // namespace protocol
75
76} // namespace comms
77
80#define COMMS_PROTOCOL_LAYERS_ACCESS(...) COMMS_FRAME_LAYERS_ACCESS(__VA_ARGS__)
81
84#define COMMS_PROTOCOL_LAYERS_NAMES(...) COMMS_FRAME_LAYERS_NAMES(__VA_ARGS__)
85
88#define COMMS_PROTOCOL_LAYERS_ACCESS_INNER(...) COMMS_FRAME_LAYERS_ACCESS_INNER(__VA_ARGS__)
89
92#define COMMS_PROTOCOL_LAYERS_NAMES_INNER(...) COMMS_FRAME_LAYERS_NAMES_INNER(__VA_ARGS__)
93
96#define COMMS_PROTOCOL_LAYERS_ACCESS_OUTER(...) COMMS_FRAME_LAYERS_ACCESS_OUTER(__VA_ARGS__)
97
100#define COMMS_PROTOCOL_LAYERS_NAMES_OUTER(...) COMMS_FRAME_LAYERS_NAMES_OUTER(__VA_ARGS__)
Contains definition of comms::frame::FrameLayerBase.
Base class for all the middle (non MsgDataLayer) protocol transport layers.
Definition FrameLayerBase.h:65
details::MissingSizeRetriever missingSize(std::size_t &val)
Add "missing size" output parameter to frame's "read" operation.
Definition FrameLayerBase.h:1564
details::MsgPayloadRetriever< TIter > msgPayload(TIter &iter, std::size_t &len)
Add "payload start" and "payload size" output parameters to frame's "read" operation.
Definition FrameLayerBase.h:1655
details::MsgIndexRetriever msgIndex(std::size_t &val)
Add "message index" output parameter to frame's "read" operation.
Definition FrameLayerBase.h:1627
FrameLayerBase< TField, TNextLayer, TDerived, TOptions... > & toFrameLayerBase(FrameLayerBase< TField, TNextLayer, TDerived, TOptions... > &layer)
Upcast protocol layer in order to have access to its internal types.
Definition FrameLayerBase.h:1524
details::MsgIdRetriever< TId > msgId(TId &val)
Add "message ID" output parameter to frame's "read" operation.
Definition FrameLayerBase.h:1590
auto missingSize(std::size_t &val) -> decltype(comms::frame::missingSize(val))
Same as comms::frame::missingSize()
Definition ProtocolLayerBase.h:46
constexpr auto toFrameLayerBase(const ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions... > &layer) -> decltype(comms::frame::toFrameLayerBase(layer))
Same as comms::frame::toFrameLayerBase()
Definition ProtocolLayerBase.h:39
auto msgId(TId &val) -> decltype(comms::frame::msgId(val))
Same as comms::frame::msgId()
Definition ProtocolLayerBase.h:54
auto msgPayload(TIter &iter, std::size_t &len) -> decltype(comms::frame::msgPayload(iter, len))
Same as comms::frame::msgPayload()
Definition ProtocolLayerBase.h:69
auto toProtocolLayerBase(ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions... > &layer) -> decltype(comms::frame::toFrameLayerBase(layer))
Same as comms::frame::toFrameLayerBase()
Definition ProtocolLayerBase.h:31
auto msgIndex(std::size_t &val) -> decltype(comms::frame::msgIndex(val))
Same as comms::frame::msgIndex()
Definition ProtocolLayerBase.h:61
Main namespace for all classes / functions of COMMS library.