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