11#include "OptionsParser.h"
29struct FieldsOptionsCompatibilityCalc
31 static const std::size_t Value =
32 static_cast<std::size_t
>(T1) +\
33 static_cast<std::size_t
>(T2) +
34 static_cast<std::size_t
>(T3) +
35 static_cast<std::size_t
>(T4) +
36 static_cast<std::size_t
>(T5) +
37 static_cast<std::size_t
>(T6);
42template <
typename TBasic,
typename... TOptions>
45 using ParsedOptions = OptionsParser<TOptions...>;
47 static const bool CustomReaderIncompatible =
48 ParsedOptions::HasSerOffset ||
49 ParsedOptions::HasFixedLengthLimit ||
50 ParsedOptions::HasFixedBitLengthLimit ||
51 ParsedOptions::HasVarLengthLimits ||
52 ParsedOptions::HasAvailableLengthLimit ||
53 ParsedOptions::HasSequenceElemLengthForcing ||
54 ParsedOptions::HasSequenceSizeForcing ||
55 ParsedOptions::HasSequenceLengthForcing ||
56 ParsedOptions::HasSequenceFixedSize ||
57 ParsedOptions::HasSequenceSizeFieldPrefix ||
58 ParsedOptions::HasSequenceSerLengthFieldPrefix ||
59 ParsedOptions::HasSequenceElemSerLengthFieldPrefix ||
60 ParsedOptions::HasSequenceElemFixedSerLengthFieldPrefix ||
61 ParsedOptions::HasSequenceTrailingFieldSuffix ||
62 ParsedOptions::HasSequenceTerminationFieldSuffix ||
63 ParsedOptions::HasEmptySerialization ||
64 ParsedOptions::HasMissingOnReadFail;
67 static const bool VarLengthIncompatible =
68 ParsedOptions::HasFixedLengthLimit ||
69 ParsedOptions::HasFixedBitLengthLimit ||
70 ParsedOptions::HasAvailableLengthLimit;
73 (!ParsedOptions::HasVarLengthLimits) || (!VarLengthIncompatible),
74 "VarLength option is incompatible with FixedLength, FixedBitLength "
75 "and AvailableLengthLimit");
78 1U >= FieldsOptionsCompatibilityCalc<
79 ParsedOptions::HasSequenceSizeFieldPrefix,
80 ParsedOptions::HasSequenceSerLengthFieldPrefix,
81 ParsedOptions::HasSequenceFixedSize,
82 ParsedOptions::HasSequenceSizeForcing,
83 ParsedOptions::HasSequenceLengthForcing,
84 ParsedOptions::HasSequenceTerminationFieldSuffix>::Value,
85 "The following options are incompatible, cannot be used together: "
86 "SequenceSizeFieldPrefix, SequenceSerLengthFieldPrefix, "
87 "SequenceFixedSize, SequenceSizeForcingEnabled, SequenceLengthForcingEnabled, "
88 "SequenceTerminationFieldSuffix");
91 1U >= FieldsOptionsCompatibilityCalc<
92 ParsedOptions::HasSequenceElemSerLengthFieldPrefix,
93 ParsedOptions::HasSequenceElemFixedSerLengthFieldPrefix,
94 ParsedOptions::HasSequenceTerminationFieldSuffix>::Value,
95 "The following options are incompatible, cannot be used together: "
96 "SequenceElemSerLengthFieldPrefix, SequenceElemFixedSerLengthFieldPrefix "
97 "SequenceTerminationFieldSuffix");
100 (!ParsedOptions::HasSequenceTrailingFieldSuffix) ||
101 (!ParsedOptions::HasSequenceTerminationFieldSuffix),
102 "The following options are incompatible, cannot be used together: "
103 "SequenceTrailingFieldSuffix, SequenceTerminationFieldSuffix");
106 (!ParsedOptions::HasFailOnInvalid) ||
107 (!ParsedOptions::HasIgnoreInvalid),
108 "The following options are incompatible, cannot be used together: "
109 "FailOnInvalid, IgnoreInvalid");
112 1U >= FieldsOptionsCompatibilityCalc<
113 ParsedOptions::HasCustomStorageType,
114 ParsedOptions::HasFixedSizeStorage,
115 ParsedOptions::HasOrigDataView>::Value,
116 "The following options are incompatible, cannot be used together: "
117 "CustomStorageType, FixedSizeStorage, OrigDataView");
120 (!ParsedOptions::HasSequenceFixedSizeUseFixedSizeStorage) ||
121 (ParsedOptions::HasSequenceFixedSize),
122 "The option SequenceFixedSizeUseFixedSizeStorage cannot be used without SequenceFixedSize.");
125 (!ParsedOptions::HasSequenceFixedSizeUseFixedSizeStorage) ||
126 (!ParsedOptions::HasFixedSizeStorage),
127 "The following options are incompatible, cannot be used together: "
128 "SequenceFixedSizeUseFixedSizeStorage, FixedSizeStorage");
130 using FieldTypeAdapted =
131 typename ParsedOptions::template AdaptFieldType<TBasic>;
133 using InvalidByDefaultAdapted =
134 typename ParsedOptions::template AdaptInvalidByDefault<FieldTypeAdapted>;
136 using VersionStorageAdapted =
137 typename ParsedOptions::template AdaptVersionStorage<InvalidByDefaultAdapted>;
139 using SerOffsetAdapted =
140 typename ParsedOptions::template AdaptSerOffset<VersionStorageAdapted>;
142 using VersionsRangeAdapted =
143 typename ParsedOptions::template AdaptVersionsRange<SerOffsetAdapted>;
145 using FixedLengthLimitAdapted =
146 typename ParsedOptions::template AdaptFixedLengthLimit<VersionsRangeAdapted>;
148 using FixedBitLengthLimitAdapted =
149 typename ParsedOptions::template AdaptFixedBitLengthLimit<FixedLengthLimitAdapted>;
151 using VarLengthLimitsAdapted =
152 typename ParsedOptions::template AdaptVarLengthLimits<FixedBitLengthLimitAdapted>;
154 using AvailableLengthLimitAdapted =
155 typename ParsedOptions::template AdaptAvailableLengthLimit<VarLengthLimitsAdapted>;
157 using SequenceElemLengthForcingAdapted =
158 typename ParsedOptions::template AdaptSequenceElemLengthForcing<AvailableLengthLimitAdapted>;
160 using SequenceElemSerLengthFieldPrefixAdapted =
161 typename ParsedOptions::template AdaptSequenceElemSerLengthFieldPrefix<SequenceElemLengthForcingAdapted>;
163 using SequenceElemFixedSerLengthFieldPrefixAdapted =
164 typename ParsedOptions::template AdaptSequenceElemFixedSerLengthFieldPrefix<SequenceElemSerLengthFieldPrefixAdapted>;
166 using SequenceSizeForcingAdapted =
167 typename ParsedOptions::template AdaptSequenceSizeForcing<SequenceElemFixedSerLengthFieldPrefixAdapted>;
169 using SequenceLengthForcingAdapted =
170 typename ParsedOptions::template AdaptSequenceLengthForcing<SequenceSizeForcingAdapted>;
172 using SequenceFixedSizeAdapted =
173 typename ParsedOptions::template AdaptSequenceFixedSize<SequenceLengthForcingAdapted>;
175 using SequenceSizeFieldPrefixAdapted =
176 typename ParsedOptions::template AdaptSequenceSizeFieldPrefix<SequenceFixedSizeAdapted>;
178 using SequenceSerLengthFieldPrefixAdapted =
179 typename ParsedOptions::template AdaptSequenceSerLengthFieldPrefix<SequenceSizeFieldPrefixAdapted>;
181 using SequenceTrailingFieldSuffixAdapted =
182 typename ParsedOptions::template AdaptSequenceTrailingFieldSuffix<SequenceSerLengthFieldPrefixAdapted>;
184 using SequenceTerminationFieldSuffixAdapted =
185 typename ParsedOptions::template AdaptSequenceTerminationFieldSuffix<SequenceTrailingFieldSuffixAdapted>;
187 using RemLengthMemberFieldAdapted =
188 typename ParsedOptions::template AdaptRemLengthMemberField<SequenceTerminationFieldSuffixAdapted>;
190 using DefaultValueInitialiserAdapted =
191 typename ParsedOptions::template AdaptDefaultValueInitialiser<RemLengthMemberFieldAdapted>;
193 using MultiRangeValidationAdapted =
194 typename ParsedOptions::template AdaptMultiRangeValidation<DefaultValueInitialiserAdapted>;
196 using CustomValidatorAdapted =
197 typename ParsedOptions::template AdaptCustomValidator<MultiRangeValidationAdapted>;
199 using FailOnInvalidAdapted =
200 typename ParsedOptions::template AdaptFailOnInvalid<CustomValidatorAdapted>;
202 using IgnoreInvalidAdapted =
203 typename ParsedOptions::template AdaptIgnoreInvalid<FailOnInvalidAdapted>;
205 using EmptySerializationAdapted =
206 typename ParsedOptions::template AdaptEmptySerialization<IgnoreInvalidAdapted>;
208 using CustomReadWrapAdapted =
209 typename ParsedOptions::template AdaptCustomRead<EmptySerializationAdapted>;
211 using CustomRefreshWrapAdapted =
212 typename ParsedOptions::template AdaptCustomRefresh<CustomReadWrapAdapted>;
214 using CustomWriteWrapAdapted =
215 typename ParsedOptions::template AdaptCustomWrite<CustomRefreshWrapAdapted>;
217 using MissingOnInvalidAdapted =
218 typename ParsedOptions::template AdaptMissingOnInvalid<CustomWriteWrapAdapted>;
220 using MissingOnReadFailAdapted =
221 typename ParsedOptions::template AdaptMissingOnReadFail<MissingOnInvalidAdapted>;
223 using VariantResetOnDestructAdapted =
224 typename ParsedOptions::template AdaptVariantResetOnDestruct<MissingOnReadFailAdapted>;
227 using Type = VariantResetOnDestructAdapted;
230template <
typename TBasic,
typename... TOptions>
231using AdaptBasicFieldT =
typename AdaptBasicField<TBasic, TOptions...>::Type;
Main namespace for all classes / functions of COMMS library.