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 - 2025 (C). Alex Robenko. All rights reserved.
3//
4// This Source Code Form is subject to the terms of the Mozilla Public
5// License, v. 2.0. If a copy of the MPL was not distributed with this
6// file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
10
11#pragma once
12
14
15namespace comms
16{
17
18namespace protocol
19{
20
23template <typename TField, typename TNextLayer, typename TDerived, typename... TOptions>
24using ProtocolLayerBase = comms::frame::FrameLayerBase<TField, TNextLayer, TDerived, TOptions...>;
25
28template <typename TField,typename TNextLayer, typename TDerived, typename... TOptions>
33
36template <typename TField,typename TNextLayer, typename TDerived, typename... TOptions>
41
44inline auto missingSize(std::size_t& val) -> decltype(comms::frame::missingSize(val))
45{
46 return comms::frame::missingSize(val);
47}
48
51template <typename TId>
52auto msgId(TId& val) -> decltype(comms::frame::msgId(val))
53{
54 return comms::frame::msgId(val);
55}
56
59inline auto msgIndex(std::size_t& val) -> decltype(comms::frame::msgIndex(val))
60{
61 return comms::frame::msgIndex(val);
62}
63
66template <typename TIter>
67auto msgPayload(TIter& iter, std::size_t& len) -> decltype(comms::frame::msgPayload(iter, len))
68{
69 return comms::frame::msgPayload(iter, len);
70}
71
72} // namespace protocol
73
74} // namespace comms
75
78#define COMMS_PROTOCOL_LAYERS_ACCESS(...) COMMS_FRAME_LAYERS_ACCESS(__VA_ARGS__)
79
82#define COMMS_PROTOCOL_LAYERS_NAMES(...) COMMS_FRAME_LAYERS_NAMES(__VA_ARGS__)
83
86#define COMMS_PROTOCOL_LAYERS_ACCESS_INNER(...) COMMS_FRAME_LAYERS_ACCESS_INNER(__VA_ARGS__)
87
90#define COMMS_PROTOCOL_LAYERS_NAMES_INNER(...) COMMS_FRAME_LAYERS_NAMES_INNER(__VA_ARGS__)
91
94#define COMMS_PROTOCOL_LAYERS_ACCESS_OUTER(...) COMMS_FRAME_LAYERS_ACCESS_OUTER(__VA_ARGS__)
95
98#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:61
details::MissingSizeRetriever missingSize(std::size_t &val)
Add "missing size" output parameter to frame's "read" operation.
Definition FrameLayerBase.h:1560
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:1651
details::MsgIndexRetriever msgIndex(std::size_t &val)
Add "message index" output parameter to frame's "read" operation.
Definition FrameLayerBase.h:1623
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:1520
details::MsgIdRetriever< TId > msgId(TId &val)
Add "message ID" output parameter to frame's "read" operation.
Definition FrameLayerBase.h:1586
auto missingSize(std::size_t &val) -> decltype(comms::frame::missingSize(val))
Same as comms::frame::missingSize()
Definition ProtocolLayerBase.h:44
constexpr auto toFrameLayerBase(const ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions... > &layer) -> decltype(comms::frame::toFrameLayerBase(layer))
Same as comms::frame::toFrameLayerBase()
Definition ProtocolLayerBase.h:37
auto msgId(TId &val) -> decltype(comms::frame::msgId(val))
Same as comms::frame::msgId()
Definition ProtocolLayerBase.h:52
auto msgPayload(TIter &iter, std::size_t &len) -> decltype(comms::frame::msgPayload(iter, len))
Same as comms::frame::msgPayload()
Definition ProtocolLayerBase.h:67
auto toProtocolLayerBase(ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions... > &layer) -> decltype(comms::frame::toFrameLayerBase(layer))
Same as comms::frame::toFrameLayerBase()
Definition ProtocolLayerBase.h:29
auto msgIndex(std::size_t &val) -> decltype(comms::frame::msgIndex(val))
Same as comms::frame::msgIndex()
Definition ProtocolLayerBase.h:59
Main namespace for all classes / functions of COMMS library.