Ice 3.8
C++ API Reference
Loading...
Searching...
No Matches
StreamHelpers.h
1// Copyright (c) ZeroC, Inc.
2
3#ifndef ICE_STREAM_HELPERS_H
4#define ICE_STREAM_HELPERS_H
5
6#include "InputStream.h"
7#include "OutputStream.h"
8#include "StringConverter.h"
9
10#include <iterator>
11#include <ostream>
12
13#if defined(_MSC_VER)
14// With MSVC, __has_include(<span>) evaluates to 1 in c++17 mode and the <span> header then issues a warning that can't
15// be disabled. This is a permissible but impractical behavior. See https://github.com/microsoft/STL/issues/4010.
16# if _MSVC_LANG >= 202002L
17# include <span>
18# endif
19#elif __has_include(<span>)
20# include <span>
21#endif
22
23namespace Ice
24{
25 // StreamHelper templates used by streams to read, write and print data.
26
27#ifdef ICE_DOXYGEN
28 /// Prints a value to a stream.
29 /// @tparam T The type of the value. It's either built-in Slice type or a type generated by the Slice compiler.
30 /// @param stream The stream.
31 /// @param v The value to print.
32 /// @remarks Depending on the type, @p v is passed by value or by const reference.
33 template<typename T> void print(std::ostream& stream, T v);
34
35 // We only provide this declaration for Doxygen. This template is specialized for all types that we support, and
36 // we want the compilation (not linking) to fail if a specialization is missing.
37
38 /// A helper template class for writing (marshaling) and reading (unmarshaling) values to and from a stream of
39 /// Slice-encoded bytes. This helper also prints Slice-defined types.
40 /// @tparam T The type of the value.
41 /// @tparam st The stream helper category.
42 /// @headerfile Ice/Ice.h
43 template<typename T, StreamHelperCategory st> struct StreamHelper
44 {
45 /// Writes a value to the stream.
46 /// @param stream The stream.
47 /// @param v The value to write.
48 /// @remark Each specialization chooses whether @p v is passed by value or by const reference.
49 static void write(OutputStream* stream, T v);
50
51 /// Reads a value from the stream.
52 /// @param stream The stream.
53 /// @param[out] v A reference to the value to read into.
54 static void read(InputStream* stream, T& v);
55
56 /// Prints a value to the stream.
57 /// @param stream The stream.
58 /// @param v The value to print.
59 /// @remark Each specialization chooses whether @p v is passed by value or by const reference.
60 static void print(std::ostream& stream, T v);
61 };
62#endif
63
64 /// @cond INTERNAL
65
66 /// Prints a value with a pass-by-value type (such as `bool`, `int32`, or an enumeration) to a stream.
67 /// @tparam T The type of the value.
68 /// @param stream The stream.
69 /// @param v The value to print.
70 template<
71 typename T,
72 std::enable_if_t<
75 bool> = true>
76 inline void print(std::ostream& stream, T v)
77 {
79 }
80
81 /// Prints an optional value with a pass-by-value type (such as `bool`, `int32`, or an enumeration) to a stream.
82 /// @tparam T The type of the value.
83 /// @param stream The stream.
84 /// @param v The value to print. nullopt is printed as "nullopt".
85 template<
86 typename T,
87 std::enable_if_t<
90 bool> = true>
91 inline void print(std::ostream& stream, std::optional<T> v)
92 {
93 if (v)
94 {
95 Ice::print(stream, *v);
96 }
97 else
98 {
99 stream << "nullopt";
100 }
101 }
102
103 /// Prints a value with a pass-by-const-reference type to the stream.
104 /// @tparam T The type of the value.
105 /// @param stream The stream.
106 /// @param v The value to print.
107 template<
108 typename T,
109 std::enable_if_t<
112 bool> = true>
113 inline void print(std::ostream& stream, const T& v)
114 {
116 }
117
118 /// Prints an optional value with a pass-by-const-reference type to the stream.
119 /// @tparam T The type of the value.
120 /// @param stream The stream.
121 /// @param v The value to print. nullopt is printed as "nullopt".
122 template<
123 typename T,
124 std::enable_if_t<
128 bool> = true>
129 inline void print(std::ostream& stream, const std::optional<T>& v)
130 {
131 if (v)
132 {
133 Ice::print(stream, *v);
134 }
135 else
136 {
137 stream << "nullopt";
138 }
139 }
140
141 template<typename T> struct StreamHelper<T, StreamHelperCategoryBuiltinValue>
142 {
143 static void write(OutputStream* stream, T v) { stream->write(v); }
144
145 static void read(InputStream* stream, T& v) { stream->read(v); }
146
147 static void print(std::ostream& stream, T v) { stream << v; }
148 };
149
150 template<> struct StreamHelper<bool, StreamHelperCategoryBuiltinValue>
151 {
152 static void print(std::ostream& stream, bool v) { stream << (v ? "true" : "false"); }
153 };
154
155 template<> struct StreamHelper<std::uint8_t, StreamHelperCategoryBuiltinValue>
156 {
157 static void print(std::ostream& stream, std::uint8_t v) { stream << static_cast<int>(v); }
158 };
159
160 template<> struct StreamHelper<std::byte, StreamHelperCategoryBuiltinValue>
161 {
162 static void print(std::ostream& stream, std::byte v) { stream << static_cast<int>(v); }
163 };
164
165 template<> struct StreamHelper<std::string_view, StreamHelperCategoryBuiltinValue>
166 {
167 static void write(OutputStream* stream, std::string_view v) { stream->write(v); }
168
169 // No read: we marshal string views but unmarshal strings.
170 // No print: we only print fields.
171 };
172
173 template<> struct StreamHelper<std::wstring_view, StreamHelperCategoryBuiltinValue>
174 {
175 static void write(OutputStream* stream, std::wstring_view v) { stream->write(v); }
176
177 // No read: we marshal wstring views but don't unmarshal wstrings.
178 // No print: we only print fields.
179 };
180
181 /// Helper for built-in types that are not passed by value.
182 template<typename T> struct StreamHelper<T, StreamHelperCategoryBuiltin>
183 {
184 static void write(OutputStream* stream, const T& v) { stream->write(v); }
185
186 static void read(InputStream* stream, T& v) { stream->read(v); }
187
188 static void print(std::ostream& stream, const T& v) { stream << v; }
189 };
190
191 template<> struct StreamHelper<std::wstring, StreamHelperCategoryBuiltin>
192 {
193 static void print(std::ostream& stream, const std::wstring& v) { stream << Ice::wstringToString(v); }
194 };
195
196 template<> struct StreamHelper<std::vector<bool>, StreamHelperCategoryBuiltin>
197 {
198 static void print(std::ostream& stream, const std::vector<bool>& v)
199 {
200 stream << '[';
201 bool firstElement = true;
202 for (bool element : v)
203 {
204 if (!firstElement)
205 {
206 stream << ", ";
207 }
208 firstElement = false;
209 Ice::print(stream, element);
210 }
211 stream << ']';
212 }
213 };
214
215 //
216 // "helpers" for the StreamHelper<T, StreamHelperCategoryStruct>. slice2cpp generates specializations as needed.
217 //
218
219 /// Reader used/generated for structs. Always specialized.
220 template<typename T> struct StreamReader;
221
222 template<typename T> struct StreamHelper<T, StreamHelperCategoryStruct>
223 {
224 static void write(OutputStream* stream, const T& v) { stream->writeAll(v.ice_tuple()); }
225
226 static void read(InputStream* stream, T& v) { StreamReader<T>::read(stream, v); }
227
228 static void print(std::ostream& stream, const T& v) { stream << v; }
229 };
230
231 template<typename T> struct StreamHelper<T, StreamHelperCategoryEnum>
232 {
233 static void write(OutputStream* stream, T v)
234 {
235 if (static_cast<std::int32_t>(v) < StreamableTraits<T>::minValue ||
236 static_cast<std::int32_t>(v) > StreamableTraits<T>::maxValue)
237 {
238 IceInternal::Ex::throwMarshalException(__FILE__, __LINE__, "enumerator out of range");
239 }
240 stream->writeEnum(static_cast<std::int32_t>(v), StreamableTraits<T>::maxValue);
241 }
242
243 static void read(InputStream* stream, T& v)
244 {
245 std::int32_t value = stream->readEnum(StreamableTraits<T>::maxValue);
246 if (value < StreamableTraits<T>::minValue || value > StreamableTraits<T>::maxValue)
247 {
248 IceInternal::Ex::throwMarshalException(__FILE__, __LINE__, "enumerator out of range");
249 }
250 v = static_cast<T>(value); // NOLINT
251 }
252
253 static void print(std::ostream& stream, T v) { stream << v; }
254 };
255
256 template<typename T> struct StreamHelper<T, StreamHelperCategorySequence>
257 {
258 static void write(OutputStream* stream, const T& v)
259 {
260 stream->writeSize(static_cast<std::int32_t>(v.size()));
261 for (const auto& element : v)
262 {
263 stream->write(element);
264 }
265 }
266
267 static void read(InputStream* stream, T& v)
268 {
269 std::int32_t sz = stream->readAndCheckSeqSize(StreamableTraits<typename T::value_type>::minWireSize);
270 T(static_cast<size_t>(sz)).swap(v);
271 for (auto& element : v)
272 {
273 stream->read(element);
274 }
275 }
276
277 static void print(std::ostream& stream, const T& v)
278 {
279 stream << '[';
280 bool firstElement = true;
281 for (const auto& element : v)
282 {
283 if (!firstElement)
284 {
285 stream << ", ";
286 }
287 firstElement = false;
288 Ice::print(stream, element);
289 }
290 stream << ']';
291 }
292 };
293
294 /// Helper for the array custom sequence mapping.
295 template<typename T> struct StreamHelper<std::pair<const T*, const T*>, StreamHelperCategorySequence>
296 {
297 static void write(OutputStream* stream, std::pair<const T*, const T*> v) { stream->write(v.first, v.second); }
298
299 static void read(InputStream* stream, std::pair<const T*, const T*>& v) { stream->read(v); }
300
301 // No print: we only print fields.
302 };
303
304#ifdef __cpp_lib_span
305 /// Helper for span (C++20 or later).
306 template<typename T> struct StreamHelper<std::span<T>, StreamHelperCategorySequence>
307 {
308 static void write(OutputStream* stream, const std::span<T>& v) { stream->write(v.data(), v.data() + v.size()); }
309
310 // No read. span are only for view types.
311 // No print: we only print fields.
312 };
313#endif
314
315 template<typename T> struct StreamHelper<T, StreamHelperCategoryDictionary>
316 {
317 static void write(OutputStream* stream, const T& v)
318 {
319 stream->writeSize(static_cast<std::int32_t>(v.size()));
320 for (const auto& entry : v)
321 {
322 stream->write(entry.first);
323 stream->write(entry.second);
324 }
325 }
326
327 static void read(InputStream* stream, T& v)
328 {
329 std::int32_t sz = stream->readSize();
330 v.clear();
331 while (sz--)
332 {
333 typename T::value_type p;
334 stream->read(const_cast<typename T::key_type&>(p.first));
335 auto i = v.insert(v.end(), p);
336 // Read the value in place: when it holds a class instance, the stream can keep the address of this
337 // instance and set it later.
338 stream->read(i->second);
339 }
340 }
341
342 static void print(std::ostream& stream, const T& v)
343 {
344 stream << '[';
345 bool firstEntry = true;
346 for (const auto& entry : v)
347 {
348 if (!firstEntry)
349 {
350 stream << ", ";
351 }
352 firstEntry = false;
353 stream << '{';
354 Ice::print(stream, entry.first);
355 stream << " : ";
356 Ice::print(stream, entry.second);
357 stream << '}';
358 }
359 stream << ']';
360 }
361 };
362
363 template<typename T> struct StreamHelper<T, StreamHelperCategoryUserException>
364 {
365 static void write(OutputStream* stream, const T& v) { stream->writeException(v); }
366
367 // no read: we don't use this helper for unmarshaling.
368
369 // We provide print for consistency even though user exceptions cannot appear in fields.
370 static void print(std::ostream& stream, const T& v) { stream << v; }
371 };
372
373 template<typename T> struct StreamHelper<T, StreamHelperCategoryProxy>
374 {
375 static void write(OutputStream* stream, const T& v) { stream->write(v); }
376
377 static void read(InputStream* stream, T& v) { stream->read(v); }
378
379 static void print(std::ostream& stream, const T& v) { stream << v; }
380 };
381
382 template<typename T> struct StreamHelper<T, StreamHelperCategoryClass>
383 {
384 static void write(OutputStream* stream, const T& v) { stream->write(v); }
385
386 static void read(InputStream* stream, T& v) { stream->read(v); }
387
388 static void print(std::ostream& stream, const T& v) { stream << v; }
389 };
390
391 //
392 // Helpers to read/write optional fields and arguments.
393 //
394
395 /// Extracts / computes the optionalFormat.
396 // This is used _only_ for the base StreamOptionalHelper below.
397 // /!\ Do not use in StreamOptionalHelper specializations, and do not provide specialization not handled by the
398 // base StreamOptionalHelper.
399 template<StreamHelperCategory st, int minWireSize, bool fixedLength> struct GetOptionalFormat;
400
401 /// Specialization for 1-byte built-in fixed-length types.
402 template<> struct GetOptionalFormat<StreamHelperCategoryBuiltinValue, 1, true>
403 {
404 static constexpr OptionalFormat value = OptionalFormat::F1;
405 };
406
407 /// Specialization for 2-byte built-in fixed-length types.
408 template<> struct GetOptionalFormat<StreamHelperCategoryBuiltinValue, 2, true>
409 {
410 static constexpr OptionalFormat value = OptionalFormat::F2;
411 };
412
413 /// Specialization for 4-byte built-in fixed-length types.
414 template<> struct GetOptionalFormat<StreamHelperCategoryBuiltinValue, 4, true>
415 {
416 static constexpr OptionalFormat value = OptionalFormat::F4;
417 };
418
419 /// Specialization for 8-byte built-in fixed-length types.
420 template<> struct GetOptionalFormat<StreamHelperCategoryBuiltinValue, 8, true>
421 {
422 static constexpr OptionalFormat value = OptionalFormat::F8;
423 };
424
425 /// Specialization for built-in variable-length types.
426 template<> struct GetOptionalFormat<StreamHelperCategoryBuiltinValue, 1, false>
427 {
428 static constexpr OptionalFormat value = OptionalFormat::VSize;
429 };
430
431 /// Specialization for built-in variable-length types.
432 template<> struct GetOptionalFormat<StreamHelperCategoryBuiltin, 1, false>
433 {
434 static constexpr OptionalFormat value = OptionalFormat::VSize;
435 };
436
437 /// Specialization for enum types.
438 template<int minWireSize> struct GetOptionalFormat<StreamHelperCategoryEnum, minWireSize, false>
439 {
440 static constexpr OptionalFormat value = OptionalFormat::Size;
441 };
442
443 /// Base helper template for reading and writing optional values. The default implementations reads/writes the
444 /// value as-is.
445 template<typename T, StreamHelperCategory st, bool fixedLength> struct StreamOptionalHelper
446 {
447 using Traits = StreamableTraits<T>;
448
449 // If this optionalFormat fails to compile, you must either define your specialization
450 // for GetOptionalFormat (in which case the optional data will be marshaled/unmarshaled
451 // with straight calls to write/read on the stream), or define your own
452 // StreamOptionalHelper specialization (which gives you more control over marshaling)
453 //
454 static constexpr OptionalFormat optionalFormat = GetOptionalFormat<st, Traits::minWireSize, fixedLength>::value;
455
456 static void write(OutputStream* stream, const T& v) { stream->write(v); }
457
458 static void read(InputStream* stream, T& v) { stream->read(v); }
459 };
460
461 /// Helper to write fixed-size structs.
462 template<typename T> struct StreamOptionalHelper<T, StreamHelperCategoryStruct, true>
463 {
464 static constexpr OptionalFormat optionalFormat = OptionalFormat::VSize;
465
466 static void write(OutputStream* stream, const T& v)
467 {
468 stream->writeSize(StreamableTraits<T>::minWireSize);
469 stream->write(v);
470 }
471
472 static void read(InputStream* stream, T& v)
473 {
474 stream->skipSize();
475 stream->read(v);
476 }
477 };
478
479 /// Helper to write variable-size structs.
480 template<typename T> struct StreamOptionalHelper<T, StreamHelperCategoryStruct, false>
481 {
482 static constexpr OptionalFormat optionalFormat = OptionalFormat::FSize;
483
484 static void write(OutputStream* stream, const T& v)
485 {
486 OutputStream::size_type pos = stream->startSize();
487 stream->write(v);
488 stream->endSize(pos);
489 }
490
491 static void read(InputStream* stream, T& v)
492 {
493 stream->skip(4);
494 stream->read(v);
495 }
496 };
497
498 // InputStream and OutputStream have special logic for optional proxies that does not rely on the
499 // StreamOptional helpers.
500
501 /// Helper to read/write optional sequences or dictionaries.
502 template<typename T, bool fixedLength, int sz> struct StreamOptionalContainerHelper;
503
504 /// Encodes containers of variable-size elements with the FSize optional type, since we can't easily figure out
505 /// total number of bytes we're about to write.
506 // This is the same encoding as variable size structs so we just re-use its implementation.
507 template<typename T, int sz> struct StreamOptionalContainerHelper<T, false, sz>
508 {
509 static constexpr OptionalFormat optionalFormat = OptionalFormat::FSize;
510
511 static void write(OutputStream* stream, const T& v, std::int32_t)
512 {
513 StreamOptionalHelper<T, StreamHelperCategoryStruct, false>::write(stream, v);
514 }
515
516 static void read(InputStream* stream, T& v)
517 {
518 StreamOptionalHelper<T, StreamHelperCategoryStruct, false>::read(stream, v);
519 }
520 };
521
522 /// Encodes containers of fixed-size elements with the VSize optional type since we can figure out the total number
523 /// of bytes we're about to write.
524 template<typename T, int sz> struct StreamOptionalContainerHelper<T, true, sz>
525 {
526 static constexpr OptionalFormat optionalFormat = OptionalFormat::VSize;
527
528 static void write(OutputStream* stream, const T& v, std::int32_t n)
529 {
530 // The total number of bytes is the number of elements * the size of an element and the size-encoded number
531 // of elements (1 or 5 depending on the number of elements).
532 stream->writeSize(sz * n + (n < 255 ? 1 : 5));
533 stream->write(v);
534 }
535
536 static void read(InputStream* stream, T& v)
537 {
538 stream->skipSize();
539 stream->read(v);
540 }
541 };
542
543 // Optimization: containers of 1 byte elements are encoded with the VSize optional type. There's no need to encode
544 // an additional size for those, the number of elements of the container can be used to skip the optional.
545 template<typename T> struct StreamOptionalContainerHelper<T, true, 1>
546 {
547 static constexpr OptionalFormat optionalFormat = OptionalFormat::VSize;
548
549 static void write(OutputStream* stream, const T& v, std::int32_t) { stream->write(v); }
550
551 static void read(InputStream* stream, T& v) { stream->read(v); }
552 };
553
554 // Helper to write sequences, delegates to the optional container helper template partial specializations.
555 template<typename T> struct StreamOptionalHelper<T, StreamHelperCategorySequence, false>
556 {
557 using E = typename T::value_type;
558 static constexpr int size = StreamableTraits<E>::minWireSize;
559 static constexpr bool fixedLength = StreamableTraits<E>::fixedLength;
560
561 // The optional type of a sequence depends on whether or not elements are fixed
562 // or variable size elements and their size.
563 static constexpr OptionalFormat optionalFormat =
564 StreamOptionalContainerHelper<T, fixedLength, size>::optionalFormat;
565
566 static void write(OutputStream* stream, const T& v)
567 {
568 StreamOptionalContainerHelper<T, fixedLength, size>::write(stream, v, static_cast<std::int32_t>(v.size()));
569 }
570
571 static void read(InputStream* stream, T& v)
572 {
573 StreamOptionalContainerHelper<T, fixedLength, size>::read(stream, v);
574 }
575 };
576
577 // Helper to write sequences, delegates to the optional container helper template partial specializations.
578 template<typename T> struct StreamOptionalHelper<std::pair<const T*, const T*>, StreamHelperCategorySequence, false>
579 {
580 using P = std::pair<const T*, const T*>;
581 static constexpr int size = StreamableTraits<T>::minWireSize;
582 static constexpr bool fixedLength = StreamableTraits<T>::fixedLength;
583
584 // The optional type of a sequence depends on whether or not elements are fixed
585 // or variable size elements and their size.
586 static constexpr OptionalFormat optionalFormat =
587 StreamOptionalContainerHelper<P, fixedLength, size>::optionalFormat;
588
589 static void write(OutputStream* stream, const P& v)
590 {
591 auto n = static_cast<std::int32_t>(v.second - v.first);
592 StreamOptionalContainerHelper<P, fixedLength, size>::write(stream, v, n);
593 }
594
595 static void read(InputStream* stream, P& v)
596 {
597 StreamOptionalContainerHelper<P, fixedLength, size>::read(stream, v);
598 }
599 };
600
601 // Helper to write dictionaries, delegates to the optional container helper template partial specializations.
602 template<typename T> struct StreamOptionalHelper<T, StreamHelperCategoryDictionary, false>
603 {
604 using K = typename T::key_type;
605 using V = typename T::mapped_type;
606
608 static constexpr bool fixedLength = StreamableTraits<K>::fixedLength && StreamableTraits<V>::fixedLength;
609
610 // The optional type of a dictionary depends on whether or not elements are fixed
611 // or variable size elements.
612 static constexpr OptionalFormat optionalFormat =
613 StreamOptionalContainerHelper<T, fixedLength, size>::optionalFormat;
614
615 static void write(OutputStream* stream, const T& v)
616 {
617 StreamOptionalContainerHelper<T, fixedLength, size>::write(stream, v, static_cast<std::int32_t>(v.size()));
618 }
619
620 static void read(InputStream* stream, T& v)
621 {
622 StreamOptionalContainerHelper<T, fixedLength, size>::read(stream, v);
623 }
624 };
625
626 // Specializations for ProtocolVersion and EncodingVersion
627 template<> struct StreamableTraits<ProtocolVersion>
628 {
630 static constexpr int minWireSize = 2;
631 static constexpr bool fixedLength = true;
632 };
633
634 template<> struct StreamReader<ProtocolVersion>
635 {
636 static void read(InputStream* istr, ProtocolVersion& v) { istr->readAll(v.major, v.minor); }
637 };
638
639 template<> struct StreamableTraits<EncodingVersion>
640 {
642 static constexpr int minWireSize = 2;
643 static constexpr bool fixedLength = true;
644 };
645
646 template<> struct StreamReader<EncodingVersion>
647 {
648 static void read(InputStream* istr, EncodingVersion& v) { istr->readAll(v.major, v.minor); }
649 };
650
651 /// @endcond
652}
653
654#endif
Represents a byte buffer used for unmarshaling data encoded using the Slice encoding.
Definition InputStream.h:50
std::size_t size_type
The size type for this byte buffer.
Represents a byte buffer used for marshaling data using the Slice encoding.
constexpr StreamHelperCategory StreamHelperCategoryBuiltin
Built-in types usually passed by reference.
void print(std::ostream &stream, T v)
Prints a value to a stream.
OptionalFormat
The optional format, used for marshaling optional fields and arguments.
@ VSize
Variable "size encoding" using either 1 or 5 bytes followed by data.
@ FSize
Fixed "size encoding" using 4 bytes followed by data.
constexpr StreamHelperCategory StreamHelperCategoryDictionary
Dictionary types.
constexpr StreamHelperCategory StreamHelperCategoryEnum
Generated enum types.
constexpr StreamHelperCategory StreamHelperCategoryProxy
Proxy types.
int StreamHelperCategory
The stream helper category allows to select a StreamHelper specialization for a specific category of ...
constexpr StreamHelperCategory StreamHelperCategoryClass
Generated class types.
constexpr StreamHelperCategory StreamHelperCategoryStruct
Generated struct types.
constexpr StreamHelperCategory StreamHelperCategorySequence
Sequence types.
constexpr StreamHelperCategory StreamHelperCategoryBuiltinValue
Built-in types usually passed by value.
constexpr StreamHelperCategory StreamHelperCategoryUserException
User exception types.
std::string wstringToString(const std::wstring &str, const StringConverterPtr &nc=nullptr, const WstringConverterPtr &wc=nullptr)
Converts a wide string to a narrow string.
The Ice RPC framework.
Definition SampleEvent.h:66
Represents a version of the Slice encoding.
Definition Version.h:74
Represents a version of the Ice protocol.
Definition Version.h:43
static void write(OutputStream *stream, T v)
Writes a value to the stream.
static void print(std::ostream &stream, T v)
Prints a value to the stream.
static void read(InputStream *stream, T &v)
Reads a value from the stream.
A helper template class for writing (marshaling) and reading (unmarshaling) values to and from a stre...
static constexpr bool fixedLength
Indicates if the type is always encoded on a fixed number of bytes.
static constexpr int minWireSize
The minimum number of bytes needed to marshal this type.
static constexpr StreamHelperCategory helper
The category trait, used for selecting the appropriate StreamHelper.
Provides traits for a type that can be marshaled or unmarshaled to/from a stream of bytes using the S...