COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
TransportValueLayerOptionsParser.h
1//
2// Copyright 2017 - 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
10#pragma once
11
12#include "comms/options.h"
13#include "comms/frame/details/TransportValueLayerAllBases.h"
14
15#include <tuple>
16#include <type_traits>
17
18namespace comms
19{
20
21namespace frame
22{
23
24namespace details
25{
26
27template <typename... TOptions>
28class TransportValueLayerOptionsParser;
29
30template <>
31class TransportValueLayerOptionsParser<>
32{
33public:
34 static const bool HasPseudoValue = false;
35 static constexpr bool HasExtendingClass = false;
36
37 using ExtendingClass = void;
38
39 template <typename TBase>
40 using BuildPseudoBase = TBase;
41
42 template <typename TLayer>
43 using DefineExtendingClass = TLayer;
44
45 template <typename TNextLayer>
46 using ForceReadUntilDataSplitIfNeeded =
48 std::is_void<typename FrameLayerMsgPtr<TNextLayer>::Type>::value
49 >::template Type <
52 // If the MsgPtr is not defined, then the MsgIdLayer is
53 // probably an outer layer, as the result the message
54 // object is properly allocated when transport value
55 // read operation is reached.
56 >;
57};
58
59template <typename... TOptions>
60class TransportValueLayerOptionsParser<comms::option::def::PseudoValue, TOptions...> :
61 public TransportValueLayerOptionsParser<TOptions...>
62{
63public:
64 static const bool HasPseudoValue = true;
65
66 template <typename TBase>
67 using BuildPseudoBase = TransportValueLayerPseudoBase<TBase>;
68};
69
70template <typename T, typename... TOptions>
71class TransportValueLayerOptionsParser<comms::option::def::ExtendingClass<T>, TOptions...> :
72 public TransportValueLayerOptionsParser<TOptions...>
73{
74public:
75 static constexpr bool HasExtendingClass = true;
76 using ExtendingClass = T;
77
78 template <typename TLayer>
79 using DefineExtendingClass = ExtendingClass;
80};
81
82template <typename... TOptions>
83class TransportValueLayerOptionsParser<
84 comms::option::def::FrameLayerSuppressReadUntilDataSplitForcing,
85 TOptions...> :
86 public TransportValueLayerOptionsParser<TOptions...>
87{
88public:
89 template <typename TNextLayer>
90 using ForceReadUntilDataSplitIfNeeded = comms::option::app::EmptyOption;
91};
92
93template <typename... TOptions>
94class TransportValueLayerOptionsParser<
95 comms::option::app::EmptyOption,
96 TOptions...> : public TransportValueLayerOptionsParser<TOptions...>
97{
98};
99
100template <typename... TBundledOptions, typename... TOptions>
101class TransportValueLayerOptionsParser<
102 std::tuple<TBundledOptions...>,
103 TOptions...> : public TransportValueLayerOptionsParser<TBundledOptions..., TOptions...>
104{
105};
106
107} // namespace details
108
109} // namespace frame
110
111} // namespace comms
comms::option::def::ExtendingClass< T > ExtendingClass
Same as comms::option::def::ExtendingClass.
Definition options.h:1962
Main namespace for all classes / functions of COMMS library.
STL namespace.
Contains definition of all the options used by the COMMS library.
No-op option, doesn't have any effect.
Definition options.h:1284
Option to force comms::frame::FrameLayerBase class to split read operation "until" and "from" data (p...
Definition options.h:1118
Replacement to std::conditional.
Definition type_traits.h:32