Zserio C++ runtime library  1.2.0
Built for Zserio 2.16.0
ArrayTraits.h
Go to the documentation of this file.
1 #ifndef ZSERIO_ARRAY_TRAITS_H_INC
2 #define ZSERIO_ARRAY_TRAITS_H_INC
3 
4 #include <string>
5 #include <type_traits>
6 #include <vector>
7 
10 #include "zserio/BitStreamReader.h"
11 #include "zserio/BitStreamWriter.h"
12 #include "zserio/DeltaContext.h"
13 #include "zserio/Enums.h"
14 #include "zserio/SizeConvertUtil.h"
15 #include "zserio/Traits.h"
16 
17 namespace zserio
18 {
19 
20 namespace detail
21 {
22 
23 template <typename T>
24 T read_bits(BitStreamReader& in, uint8_t numBits);
25 
26 template <>
27 inline int8_t read_bits<int8_t>(BitStreamReader& in, uint8_t numBits)
28 {
29  return static_cast<int8_t>(in.readSignedBits(numBits));
30 }
31 
32 template <>
33 inline int16_t read_bits<int16_t>(BitStreamReader& in, uint8_t numBits)
34 {
35  return static_cast<int16_t>(in.readSignedBits(numBits));
36 }
37 
38 template <>
39 inline int32_t read_bits<int32_t>(BitStreamReader& in, uint8_t numBits)
40 {
41  return in.readSignedBits(numBits);
42 }
43 
44 template <>
45 inline int64_t read_bits<int64_t>(BitStreamReader& in, uint8_t numBits)
46 {
47  return in.readSignedBits64(numBits);
48 }
49 
50 template <>
51 inline uint8_t read_bits<uint8_t>(BitStreamReader& in, uint8_t numBits)
52 {
53  return static_cast<uint8_t>(in.readBits(numBits));
54 }
55 
56 template <>
57 inline uint16_t read_bits<uint16_t>(BitStreamReader& in, uint8_t numBits)
58 {
59  return static_cast<uint16_t>(in.readBits(numBits));
60 }
61 
62 template <>
63 inline uint32_t read_bits<uint32_t>(BitStreamReader& in, uint8_t numBits)
64 {
65  return in.readBits(numBits);
66 }
67 
68 template <>
69 inline uint64_t read_bits<uint64_t>(BitStreamReader& in, uint8_t numBits)
70 {
71  return in.readBits64(numBits);
72 }
73 
74 template <typename T>
75 void write_bits(BitStreamWriter& out, T value, uint8_t numBits);
76 
77 template <>
78 inline void write_bits<int8_t>(BitStreamWriter& out, int8_t value, uint8_t numBits)
79 {
80  out.writeSignedBits(static_cast<int32_t>(value), numBits);
81 }
82 
83 template <>
84 inline void write_bits<int16_t>(BitStreamWriter& out, int16_t value, uint8_t numBits)
85 {
86  out.writeSignedBits(static_cast<int32_t>(value), numBits);
87 }
88 
89 template <>
90 inline void write_bits<int32_t>(BitStreamWriter& out, int32_t value, uint8_t numBits)
91 {
92  out.writeSignedBits(value, numBits);
93 }
94 
95 template <>
96 inline void write_bits<int64_t>(BitStreamWriter& out, int64_t value, uint8_t numBits)
97 {
98  out.writeSignedBits64(value, numBits);
99 }
100 
101 template <>
102 inline void write_bits<uint8_t>(BitStreamWriter& out, uint8_t value, uint8_t numBits)
103 {
104  out.writeBits(static_cast<uint32_t>(value), numBits);
105 }
106 
107 template <>
108 inline void write_bits<uint16_t>(BitStreamWriter& out, uint16_t value, uint8_t numBits)
109 {
110  out.writeBits(static_cast<uint32_t>(value), numBits);
111 }
112 
113 template <>
114 inline void write_bits<uint32_t>(BitStreamWriter& out, uint32_t value, uint8_t numBits)
115 {
116  out.writeBits(value, numBits);
117 }
118 
119 template <>
120 inline void write_bits<uint64_t>(BitStreamWriter& out, uint64_t value, uint8_t numBits)
121 {
122  out.writeBits64(value, numBits);
123 }
124 
125 } // namespace detail
126 
133 template <typename T, uint8_t NUM_BITS>
135 {
136 public:
138  using ElementType = T;
139 
145  static size_t bitSizeOf()
146  {
147  return NUM_BITS;
148  }
149 
155  static size_t bitSizeOf(ElementType)
156  {
157  return bitSizeOf();
158  }
159 
165  static size_t bitSizeOf(size_t, ElementType)
166  {
167  return bitSizeOf();
168  }
169 
177  static size_t initializeOffsets(size_t bitPosition, ElementType)
178  {
179  return bitPosition + NUM_BITS;
180  }
181 
189  static ElementType read(BitStreamReader& in, size_t = 0)
190  {
191  return detail::read_bits<T>(in, NUM_BITS);
192  }
193 
200  static void write(BitStreamWriter& out, ElementType element)
201  {
202  detail::write_bits(out, element, NUM_BITS);
203  }
204 
206  static constexpr bool IS_BITSIZEOF_CONSTANT = true;
207 };
208 
215 template <typename T, typename ELEMENT_BIT_SIZE, typename = void>
217 {
218 public:
220  using ElementType = T;
221 
227  static size_t bitSizeOf()
228  {
229  return ELEMENT_BIT_SIZE::get();
230  }
231 
237  static size_t bitSizeOf(ElementType)
238  {
239  return bitSizeOf();
240  }
241 
247  static size_t bitSizeOf(size_t, ElementType)
248  {
249  return bitSizeOf();
250  }
251 
259  static size_t initializeOffsets(size_t bitPosition, ElementType)
260  {
261  return bitPosition + bitSizeOf();
262  }
263 
271  static ElementType read(BitStreamReader& in, size_t = 0)
272  {
273  return detail::read_bits<T>(in, ELEMENT_BIT_SIZE::get());
274  }
275 
282  static void write(BitStreamWriter& out, ElementType element)
283  {
284  detail::write_bits(out, element, ELEMENT_BIT_SIZE::get());
285  }
286 
288  static constexpr bool IS_BITSIZEOF_CONSTANT = true;
289 };
290 
297 template <typename T, typename ELEMENT_BIT_SIZE>
298 class DynamicBitFieldArrayTraits<T, ELEMENT_BIT_SIZE,
299  typename std::enable_if<has_owner_type<ELEMENT_BIT_SIZE>::value>::type>
300 {
301 public:
303  using ElementType = T;
304 
306  using OwnerType = typename ELEMENT_BIT_SIZE::OwnerType;
307 
315  static size_t bitSizeOf(const OwnerType& owner)
316  {
317  return ELEMENT_BIT_SIZE::get(owner);
318  }
319 
327  static size_t bitSizeOf(const OwnerType& owner, ElementType)
328  {
329  return bitSizeOf(owner);
330  }
331 
339  static size_t bitSizeOf(const OwnerType& owner, size_t, ElementType)
340  {
341  return bitSizeOf(owner);
342  }
343 
352  static size_t initializeOffsets(const OwnerType& owner, size_t bitPosition, ElementType)
353  {
354  return bitPosition + bitSizeOf(owner);
355  }
356 
365  static ElementType read(const OwnerType& owner, BitStreamReader& in, size_t = 0)
366  {
367  return detail::read_bits<T>(in, ELEMENT_BIT_SIZE::get(owner));
368  }
369 
377  static void write(const OwnerType& owner, BitStreamWriter& out, ElementType element)
378  {
379  detail::write_bits(out, element, ELEMENT_BIT_SIZE::get(owner));
380  }
381 
383  static constexpr bool IS_BITSIZEOF_CONSTANT = true;
384 };
385 
389 template <typename T>
391 {
393  using ElementType = T;
394 
400  static size_t bitSizeOf()
401  {
402  return NUM_BITS;
403  }
404 
410  static size_t bitSizeOf(ElementType)
411  {
412  return bitSizeOf();
413  }
414 
420  static size_t bitSizeOf(size_t, ElementType)
421  {
422  return bitSizeOf();
423  }
424 
432  static size_t initializeOffsets(size_t bitPosition, ElementType)
433  {
434  return bitPosition + NUM_BITS;
435  }
436 
444  static ElementType read(BitStreamReader& in, size_t = 0)
445  {
446  return detail::read_bits<T>(in, NUM_BITS);
447  }
448 
455  static void write(BitStreamWriter& out, ElementType element)
456  {
457  detail::write_bits(out, element, NUM_BITS);
458  }
459 
461  static constexpr bool IS_BITSIZEOF_CONSTANT = true;
462 
463 private:
464  static constexpr uint8_t NUM_BITS = sizeof(T) * 8;
465 };
466 
470 template <typename T>
472 
476 template <>
477 struct VarIntNNArrayTraits<int16_t>
478 {
480  using ElementType = int16_t;
481 
489  static size_t bitSizeOf(ElementType element)
490  {
491  return zserio::bitSizeOfVarInt16(element);
492  }
493 
501  static size_t bitSizeOf(size_t, ElementType element)
502  {
503  return bitSizeOf(element);
504  }
505 
514  static size_t initializeOffsets(size_t bitPosition, ElementType element)
515  {
516  return bitPosition + bitSizeOf(bitPosition, element);
517  }
518 
526  static ElementType read(BitStreamReader& in, size_t = 0)
527  {
528  return in.readVarInt16();
529  }
530 
537  static void write(BitStreamWriter& out, ElementType element)
538  {
539  out.writeVarInt16(element);
540  }
541 
543  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
544 };
545 
549 template <>
550 struct VarIntNNArrayTraits<int32_t>
551 {
553  using ElementType = int32_t;
554 
562  static size_t bitSizeOf(ElementType element)
563  {
564  return zserio::bitSizeOfVarInt32(element);
565  }
566 
574  static size_t bitSizeOf(size_t, ElementType element)
575  {
576  return bitSizeOf(element);
577  }
578 
587  static size_t initializeOffsets(size_t bitPosition, ElementType element)
588  {
589  return bitPosition + bitSizeOf(bitPosition, element);
590  }
591 
599  static ElementType read(BitStreamReader& in, size_t = 0)
600  {
601  return in.readVarInt32();
602  }
603 
610  static void write(BitStreamWriter& out, ElementType element)
611  {
612  out.writeVarInt32(element);
613  }
614 
616  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
617 };
618 
622 template <>
623 struct VarIntNNArrayTraits<int64_t>
624 {
626  using ElementType = int64_t;
627 
635  static size_t bitSizeOf(ElementType element)
636  {
637  return zserio::bitSizeOfVarInt64(element);
638  }
639 
647  static size_t bitSizeOf(size_t, ElementType element)
648  {
649  return bitSizeOf(element);
650  }
651 
660  static size_t initializeOffsets(size_t bitPosition, ElementType element)
661  {
662  return bitPosition + bitSizeOf(bitPosition, element);
663  }
664 
672  static ElementType read(BitStreamReader& in, size_t = 0)
673  {
674  return in.readVarInt64();
675  }
676 
683  static void write(BitStreamWriter& out, ElementType element)
684  {
685  out.writeVarInt64(element);
686  }
687 
689  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
690 };
691 
695 template <>
696 struct VarIntNNArrayTraits<uint16_t>
697 {
699  using ElementType = uint16_t;
700 
708  static size_t bitSizeOf(ElementType element)
709  {
710  return zserio::bitSizeOfVarUInt16(element);
711  }
712 
720  static size_t bitSizeOf(size_t, ElementType element)
721  {
722  return bitSizeOf(element);
723  }
724 
733  static size_t initializeOffsets(size_t bitPosition, ElementType element)
734  {
735  return bitPosition + bitSizeOf(bitPosition, element);
736  }
737 
745  static ElementType read(BitStreamReader& in, size_t = 0)
746  {
747  return in.readVarUInt16();
748  }
749 
756  static void write(BitStreamWriter& out, ElementType element)
757  {
758  out.writeVarUInt16(element);
759  }
760 
762  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
763 };
764 
768 template <>
769 struct VarIntNNArrayTraits<uint32_t>
770 {
772  using ElementType = uint32_t;
773 
781  static size_t bitSizeOf(ElementType element)
782  {
783  return zserio::bitSizeOfVarUInt32(element);
784  }
785 
793  static size_t bitSizeOf(size_t, ElementType element)
794  {
795  return bitSizeOf(element);
796  }
797 
806  static size_t initializeOffsets(size_t bitPosition, ElementType element)
807  {
808  return bitPosition + bitSizeOf(bitPosition, element);
809  }
810 
818  static ElementType read(BitStreamReader& in, size_t = 0)
819  {
820  return in.readVarUInt32();
821  }
822 
829  static void write(BitStreamWriter& out, ElementType element)
830  {
831  out.writeVarUInt32(element);
832  }
833 
835  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
836 };
837 
841 template <>
842 struct VarIntNNArrayTraits<uint64_t>
843 {
845  using ElementType = uint64_t;
846 
854  static size_t bitSizeOf(ElementType element)
855  {
856  return zserio::bitSizeOfVarUInt64(element);
857  }
858 
866  static size_t bitSizeOf(size_t, ElementType element)
867  {
868  return bitSizeOf(element);
869  }
870 
879  static size_t initializeOffsets(size_t bitPosition, ElementType element)
880  {
881  return bitPosition + bitSizeOf(bitPosition, element);
882  }
883 
891  static ElementType read(BitStreamReader& in, size_t = 0)
892  {
893  return in.readVarUInt64();
894  }
895 
902  static void write(BitStreamWriter& out, ElementType element)
903  {
904  out.writeVarUInt64(element);
905  }
906 
908  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
909 };
910 
914 template <typename T>
916 
920 template <>
921 struct VarIntArrayTraits<int64_t>
922 {
924  using ElementType = int64_t;
925 
933  static size_t bitSizeOf(ElementType element)
934  {
935  return zserio::bitSizeOfVarInt(element);
936  }
937 
945  static size_t bitSizeOf(size_t, ElementType element)
946  {
947  return bitSizeOf(element);
948  }
949 
958  static size_t initializeOffsets(size_t bitPosition, ElementType element)
959  {
960  return bitPosition + bitSizeOf(bitPosition, element);
961  }
962 
970  static ElementType read(BitStreamReader& in, size_t = 0)
971  {
972  return in.readVarInt();
973  }
974 
981  static void write(BitStreamWriter& out, ElementType element)
982  {
983  out.writeVarInt(element);
984  }
985 
987  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
988 };
989 
993 template <>
994 struct VarIntArrayTraits<uint64_t>
995 {
997  using ElementType = uint64_t;
998 
1006  static size_t bitSizeOf(ElementType element)
1007  {
1008  return zserio::bitSizeOfVarUInt(element);
1009  }
1010 
1018  static size_t bitSizeOf(size_t, ElementType element)
1019  {
1020  return bitSizeOf(element);
1021  }
1022 
1031  static size_t initializeOffsets(size_t bitPosition, ElementType element)
1032  {
1033  return bitPosition + bitSizeOf(bitPosition, element);
1034  }
1035 
1043  static ElementType read(BitStreamReader& in, size_t = 0)
1044  {
1045  return in.readVarUInt();
1046  }
1047 
1054  static void write(BitStreamWriter& out, ElementType element)
1055  {
1056  out.writeVarUInt(element);
1057  }
1058 
1060  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
1061 };
1062 
1067 {
1069  using ElementType = uint32_t;
1070 
1078  static size_t bitSizeOf(ElementType element)
1079  {
1080  return zserio::bitSizeOfVarSize(element);
1081  }
1082 
1090  static size_t bitSizeOf(size_t, ElementType element)
1091  {
1092  return bitSizeOf(element);
1093  }
1094 
1103  static size_t initializeOffsets(size_t bitPosition, ElementType element)
1104  {
1105  return bitPosition + bitSizeOf(bitPosition, element);
1106  }
1107 
1115  static ElementType read(BitStreamReader& in, size_t = 0)
1116  {
1117  return in.readVarSize();
1118  }
1119 
1126  static void write(BitStreamWriter& out, ElementType element)
1127  {
1128  out.writeVarSize(element);
1129  }
1130 
1132  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
1133 };
1134 
1139 {
1141  using ElementType = float;
1142 
1148  static size_t bitSizeOf()
1149  {
1150  return 16;
1151  }
1152 
1158  static size_t bitSizeOf(size_t, ElementType)
1159  {
1160  return bitSizeOf();
1161  }
1162 
1171  static size_t initializeOffsets(size_t bitPosition, ElementType element)
1172  {
1173  return bitPosition + bitSizeOf(bitPosition, element);
1174  }
1175 
1183  static ElementType read(BitStreamReader& in, size_t = 0)
1184  {
1185  return in.readFloat16();
1186  }
1187 
1194  static void write(BitStreamWriter& out, ElementType element)
1195  {
1196  out.writeFloat16(element);
1197  }
1198 
1200  static constexpr bool IS_BITSIZEOF_CONSTANT = true;
1201 };
1202 
1207 {
1209  using ElementType = float;
1210 
1216  static size_t bitSizeOf()
1217  {
1218  return 32;
1219  }
1220 
1226  static size_t bitSizeOf(size_t, ElementType)
1227  {
1228  return bitSizeOf();
1229  }
1230 
1239  static size_t initializeOffsets(size_t bitPosition, ElementType element)
1240  {
1241  return bitPosition + bitSizeOf(bitPosition, element);
1242  }
1243 
1251  static ElementType read(BitStreamReader& in, size_t = 0)
1252  {
1253  return in.readFloat32();
1254  }
1255 
1262  static void write(BitStreamWriter& out, ElementType element)
1263  {
1264  out.writeFloat32(element);
1265  }
1266 
1268  static constexpr bool IS_BITSIZEOF_CONSTANT = true;
1269 };
1270 
1275 {
1277  using ElementType = double;
1278 
1284  static size_t bitSizeOf()
1285  {
1286  return 64;
1287  }
1288 
1294  static size_t bitSizeOf(size_t, ElementType)
1295  {
1296  return bitSizeOf();
1297  }
1298 
1307  static size_t initializeOffsets(size_t bitPosition, ElementType element)
1308  {
1309  return bitPosition + bitSizeOf(bitPosition, element);
1310  }
1311 
1319  static ElementType read(BitStreamReader& in, size_t = 0)
1320  {
1321  return in.readFloat64();
1322  }
1323 
1330  static void write(BitStreamWriter& out, ElementType element)
1331  {
1332  out.writeFloat64(element);
1333  }
1334 
1336  static constexpr bool IS_BITSIZEOF_CONSTANT = true;
1337 };
1338 
1343 {
1345  using ElementType = bool;
1346 
1352  static size_t bitSizeOf()
1353  {
1354  return 1;
1355  }
1356 
1362  static size_t bitSizeOf(size_t, ElementType)
1363  {
1364  return bitSizeOf();
1365  }
1366 
1375  static size_t initializeOffsets(size_t bitPosition, ElementType element)
1376  {
1377  return bitPosition + bitSizeOf(bitPosition, element);
1378  }
1379 
1387  static ElementType read(BitStreamReader& in, size_t = 0)
1388  {
1389  return in.readBool();
1390  }
1391 
1398  static void write(BitStreamWriter& out, ElementType element)
1399  {
1400  out.writeBool(element);
1401  }
1402 
1404  static constexpr bool IS_BITSIZEOF_CONSTANT = true;
1405 };
1406 
1410 template <template <typename> class ALLOC = std::allocator>
1412 {
1415 
1417  using allocator_type = typename ElementType::allocator_type;
1418 
1426  static size_t bitSizeOf(size_t, const ElementType& element)
1427  {
1428  return zserio::bitSizeOfBytes(element);
1429  }
1430 
1439  static size_t initializeOffsets(size_t bitPosition, const ElementType& element)
1440  {
1441  return bitPosition + bitSizeOf(bitPosition, element);
1442  }
1443 
1450  template <typename RAW_ARRAY>
1451  static void read(RAW_ARRAY& rawArray, BitStreamReader& in, size_t = 0)
1452  {
1453  rawArray.emplace_back(in.readBytes(rawArray.get_allocator()));
1454  }
1455 
1462  static void write(BitStreamWriter& out, const ElementType& element)
1463  {
1464  out.writeBytes(element);
1465  }
1466 
1468  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
1469 };
1470 
1472 
1476 template <template <typename> class ALLOC = std::allocator>
1478 {
1481 
1483  using allocator_type = typename ElementType::allocator_type;
1484 
1492  static size_t bitSizeOf(size_t, const ElementType& element)
1493  {
1494  return zserio::bitSizeOfString(element);
1495  }
1496 
1505  static size_t initializeOffsets(size_t bitPosition, const ElementType& element)
1506  {
1507  return bitPosition + bitSizeOf(bitPosition, element);
1508  }
1509 
1516  template <typename RAW_ARRAY>
1517  static void read(RAW_ARRAY& rawArray, BitStreamReader& in, size_t = 0)
1518  {
1519  rawArray.emplace_back(in.readString(rawArray.get_allocator()));
1520  }
1521 
1528  static void write(BitStreamWriter& out, const ElementType& element)
1529  {
1530  out.writeString(element);
1531  }
1532 
1534  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
1535 };
1536 
1538 
1542 template <template <typename> class ALLOC = std::allocator>
1544 {
1547 
1550 
1558  static size_t bitSizeOf(size_t, const ElementType& element)
1559  {
1560  return zserio::bitSizeOfBitBuffer(element);
1561  }
1562 
1571  static size_t initializeOffsets(size_t bitPosition, const ElementType& element)
1572  {
1573  return bitPosition + bitSizeOf(bitPosition, element);
1574  }
1575 
1582  template <typename RAW_ARRAY>
1583  static void read(RAW_ARRAY& rawArray, BitStreamReader& in, size_t = 0)
1584  {
1585  rawArray.emplace_back(in.readBitBuffer(rawArray.get_allocator()));
1586  }
1587 
1594  static void write(BitStreamWriter& out, const ElementType& element)
1595  {
1596  out.writeBitBuffer(element);
1597  }
1598 
1600  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
1601 };
1602 
1604 
1608 template <typename T>
1610 {
1612  using ElementType = T;
1613 
1621  static size_t bitSizeOf(size_t, ElementType element)
1622  {
1623  return zserio::bitSizeOf(element);
1624  }
1625 
1634  static size_t initializeOffsets(size_t bitPosition, ElementType element)
1635  {
1636  return zserio::initializeOffsets(bitPosition, element);
1637  }
1638 
1646  static ElementType read(BitStreamReader& in, size_t = 0)
1647  {
1648  return zserio::read<ElementType>(in);
1649  }
1650 
1657  static void write(BitStreamWriter& out, ElementType element)
1658  {
1659  zserio::write(out, element);
1660  }
1661 
1662  // Be aware that T can be varuint, so bitSizeOf cannot return constant value.
1664  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
1665 };
1666 
1670 template <typename T>
1672 {
1674  using ElementType = T;
1675 
1683  static size_t bitSizeOf(size_t, ElementType element)
1684  {
1685  return element.bitSizeOf();
1686  }
1687 
1696  static size_t initializeOffsets(size_t bitPosition, ElementType element)
1697  {
1698  return element.initializeOffsets(bitPosition);
1699  }
1700 
1708  static ElementType read(BitStreamReader& in, size_t = 0)
1709  {
1710  return ElementType(in);
1711  }
1712 
1719  static void write(BitStreamWriter& out, ElementType element)
1720  {
1721  element.write(out);
1722  }
1723 
1724  // Be aware that T can be varuint, so bitSizeOf cannot return constant value.
1726  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
1727 };
1728 
1732 template <typename T, typename ELEMENT_FACTORY>
1734 {
1735 public:
1737  using ElementType = T;
1738 
1740  using allocator_type = typename ElementType::allocator_type;
1741 
1743  using OwnerType = typename ELEMENT_FACTORY::OwnerType;
1744 
1753  static size_t bitSizeOf(const OwnerType&, size_t bitPosition, const ElementType& element)
1754  {
1755  return element.bitSizeOf(bitPosition);
1756  }
1757 
1766  static size_t initializeOffsets(OwnerType&, size_t bitPosition, ElementType& element)
1767  {
1768  return element.initializeOffsets(bitPosition);
1769  }
1770 
1779  template <typename RAW_ARRAY>
1780  static void read(OwnerType& owner, RAW_ARRAY& rawArray, BitStreamReader& in, size_t index)
1781  {
1782  ELEMENT_FACTORY::create(owner, rawArray, in, index);
1783  }
1784 
1791  static void write(const OwnerType&, BitStreamWriter& out, const ElementType& element)
1792  {
1793  element.write(out);
1794  }
1795 
1797  static constexpr bool IS_BITSIZEOF_CONSTANT = false;
1798 };
1799 
1800 namespace detail
1801 {
1802 
1803 template <typename ARRAY_TRAITS>
1804 struct packed_array_traits_overloaded : std::false_type
1805 {};
1806 
1807 template <typename T, typename ELEMENT_FACTORY>
1808 struct packed_array_traits_overloaded<ObjectArrayTraits<T, ELEMENT_FACTORY>> : std::true_type
1809 {};
1810 
1811 } // namespace detail
1812 
1818 template <typename ARRAY_TRAITS, typename = void>
1820 {
1821 public:
1823  using ArrayTraits = ARRAY_TRAITS;
1824 
1826  using ElementType = typename ARRAY_TRAITS::ElementType;
1827 
1836  static void initContext(DeltaContext& deltaContext, ElementType element)
1837  {
1838  deltaContext.template init<ArrayTraits>(element);
1839  }
1840 
1851  static size_t bitSizeOf(DeltaContext& deltaContext, size_t, ElementType element)
1852  {
1853  return deltaContext.template bitSizeOf<ArrayTraits>(element);
1854  }
1855 
1867  static size_t initializeOffsets(DeltaContext& deltaContext, size_t bitPosition, ElementType element)
1868  {
1869  return bitPosition + bitSizeOf(deltaContext, bitPosition, element);
1870  }
1871 
1882  static ElementType read(DeltaContext& deltaContext, BitStreamReader& in, size_t = 0)
1883  {
1884  return deltaContext.template read<ArrayTraits>(in);
1885  }
1886 
1896  static void write(DeltaContext& deltaContext, BitStreamWriter& out, ElementType element)
1897  {
1898  deltaContext.template write<ArrayTraits>(out, element);
1899  }
1900 };
1901 
1907 template <typename ARRAY_TRAITS>
1908 class PackedArrayTraits<ARRAY_TRAITS, typename std::enable_if<has_owner_type<ARRAY_TRAITS>::value>::type>
1909 {
1910 public:
1912  using ArrayTraits = ARRAY_TRAITS;
1913 
1915  using ElementType = typename ARRAY_TRAITS::ElementType;
1916 
1918  using OwnerType = typename ARRAY_TRAITS::OwnerType;
1919 
1929  static void initContext(const OwnerType& owner, DeltaContext& deltaContext, ElementType element)
1930  {
1931  deltaContext.template init<ArrayTraits>(owner, element);
1932  }
1933 
1945  static size_t bitSizeOf(const OwnerType& owner, DeltaContext& deltaContext, size_t, ElementType element)
1946  {
1947  return deltaContext.template bitSizeOf<ArrayTraits>(owner, element);
1948  }
1949 
1962  static size_t initializeOffsets(
1963  const OwnerType& owner, DeltaContext& deltaContext, size_t bitPosition, ElementType element)
1964  {
1965  return bitPosition + bitSizeOf(owner, deltaContext, bitPosition, element);
1966  }
1967 
1979  static ElementType read(const OwnerType& owner, DeltaContext& deltaContext, BitStreamReader& in, size_t = 0)
1980  {
1981  return deltaContext.template read<ArrayTraits>(owner, in);
1982  }
1983 
1994  static void write(
1995  const OwnerType& owner, DeltaContext& deltaContext, BitStreamWriter& out, ElementType element)
1996  {
1997  deltaContext.template write<ArrayTraits>(owner, out, element);
1998  }
1999 };
2000 
2004 template <typename T>
2006 {
2007 public:
2010 
2012  using ElementType = T;
2013 
2020  static void initContext(DeltaContext& deltaContext, ElementType element)
2021  {
2022  zserio::initPackingContext(deltaContext, element);
2023  }
2024 
2033  static size_t bitSizeOf(DeltaContext& deltaContext, size_t, ElementType element)
2034  {
2035  return zserio::bitSizeOf(deltaContext, element);
2036  }
2037 
2047  static size_t initializeOffsets(DeltaContext& deltaContext, size_t bitPosition, ElementType element)
2048  {
2049  return zserio::initializeOffsets(deltaContext, bitPosition, element);
2050  }
2051 
2060  static ElementType read(DeltaContext& deltaContext, BitStreamReader& in, size_t = 0)
2061  {
2062  return zserio::read<ElementType>(deltaContext, in);
2063  }
2064 
2072  static void write(DeltaContext& deltaContext, BitStreamWriter& out, ElementType element)
2073  {
2074  zserio::write(deltaContext, out, element);
2075  }
2076 };
2077 
2081 template <typename T>
2083 {
2084 public:
2087 
2089  using ElementType = T;
2090 
2096  static void initContext(DeltaContext& deltaContext, const ElementType& element)
2097  {
2098  element.initPackingContext(deltaContext);
2099  }
2100 
2110  static size_t bitSizeOf(DeltaContext& deltaContext, size_t bitPosition, const ElementType& element)
2111  {
2112  return element.bitSizeOf(deltaContext, bitPosition);
2113  }
2114 
2124  static size_t initializeOffsets(DeltaContext& deltaContext, size_t bitPosition, const ElementType& element)
2125  {
2126  return element.initializeOffsets(deltaContext, bitPosition);
2127  }
2128 
2137  static ElementType read(DeltaContext& deltaContext, BitStreamReader& in, size_t = 0)
2138  {
2139  return ElementType(deltaContext, in);
2140  }
2141 
2149  static void write(DeltaContext& deltaContext, BitStreamWriter& out, const ElementType& element)
2150  {
2151  element.write(deltaContext, out);
2152  }
2153 };
2154 
2155 // note: enable_if is needed to be more specific then specialization for types which needs owner type
2159 template <typename T, typename ELEMENT_FACTORY>
2160 class PackedArrayTraits<ObjectArrayTraits<T, ELEMENT_FACTORY>,
2161  typename std::enable_if<has_owner_type<ObjectArrayTraits<T, ELEMENT_FACTORY>>::value>::type>
2162 {
2163 public:
2166 
2168  using ElementType = T;
2169 
2171  using allocator_type = typename T::allocator_type;
2172 
2175 
2181  template <typename PACKING_CONTEXT>
2182  static void initContext(
2183  const typename ArrayTraits::OwnerType&, PACKING_CONTEXT& packingContext, const ElementType& element)
2184  {
2185  element.initPackingContext(packingContext);
2186  }
2187 
2197  template <typename PACKING_CONTEXT>
2198  static size_t bitSizeOf(const typename ArrayTraits::OwnerType&, PACKING_CONTEXT& packingContext,
2199  size_t bitPosition, const ElementType& element)
2200  {
2201  return element.bitSizeOf(packingContext, bitPosition);
2202  }
2203 
2213  template <typename PACKING_CONTEXT>
2214  static size_t initializeOffsets(const typename ArrayTraits::OwnerType&, PACKING_CONTEXT& packingContext,
2215  size_t bitPosition, ElementType& element)
2216  {
2217  return element.initializeOffsets(packingContext, bitPosition);
2218  }
2219 
2230  template <typename RAW_ARRAY, typename PACKING_CONTEXT>
2231  static void read(typename ArrayTraits::OwnerType& owner, RAW_ARRAY& rawArray,
2232  PACKING_CONTEXT& packingContext, BitStreamReader& in, size_t index)
2233  {
2234  ELEMENT_FACTORY::create(owner, rawArray, packingContext, in, index);
2235  }
2236 
2244  template <typename PACKING_CONTEXT>
2245  static void write(const typename ArrayTraits::OwnerType&, PACKING_CONTEXT& packingContext,
2246  BitStreamWriter& out, const ElementType& element)
2247  {
2248  element.write(packingContext, out);
2249  }
2250 };
2251 
2252 } // namespace zserio
2253 
2254 #endif // ZSERIO_ARRAY_TRAITS_H_INC
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:200
static size_t bitSizeOf()
Definition: ArrayTraits.h:145
static size_t bitSizeOf(ElementType)
Definition: ArrayTraits.h:155
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:206
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:189
static size_t initializeOffsets(size_t bitPosition, ElementType)
Definition: ArrayTraits.h:177
static size_t bitSizeOf(size_t, ElementType)
Definition: ArrayTraits.h:165
BasicBitBuffer< RebindAlloc< ALLOC, uint8_t > > readBitBuffer(const ALLOC &allocator=ALLOC())
string< ALLOC > readString(const ALLOC &alloc=ALLOC())
vector< uint8_t, ALLOC > readBytes(const ALLOC &alloc=ALLOC())
void writeFloat64(double data)
void writeVarInt64(int64_t data)
void writeVarInt16(int16_t data)
void writeString(StringView data)
void writeFloat32(float data)
void writeVarUInt64(uint64_t data)
void writeVarUInt16(uint16_t data)
void writeVarInt32(int32_t data)
void writeVarSize(uint32_t data)
void writeVarUInt32(uint32_t data)
void writeVarUInt(uint64_t data)
void writeVarInt(int64_t data)
void writeFloat16(float data)
void writeBytes(Span< const uint8_t > data)
void writeBitBuffer(const BasicBitBuffer< ALLOC > &bitBuffer)
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:282
static size_t initializeOffsets(size_t bitPosition, ElementType)
Definition: ArrayTraits.h:259
static size_t bitSizeOf(size_t, ElementType)
Definition: ArrayTraits.h:247
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:271
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:288
static size_t bitSizeOf(ElementType)
Definition: ArrayTraits.h:237
typename ELEMENT_FACTORY::OwnerType OwnerType
Definition: ArrayTraits.h:1743
static size_t bitSizeOf(const OwnerType &, size_t bitPosition, const ElementType &element)
Definition: ArrayTraits.h:1753
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1797
static void write(const OwnerType &, BitStreamWriter &out, const ElementType &element)
Definition: ArrayTraits.h:1791
static void read(OwnerType &owner, RAW_ARRAY &rawArray, BitStreamReader &in, size_t index)
Definition: ArrayTraits.h:1780
typename ElementType::allocator_type allocator_type
Definition: ArrayTraits.h:1740
static size_t initializeOffsets(OwnerType &, size_t bitPosition, ElementType &element)
Definition: ArrayTraits.h:1766
static void write(const OwnerType &owner, DeltaContext &deltaContext, BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:1994
static size_t initializeOffsets(const OwnerType &owner, DeltaContext &deltaContext, size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:1962
static void initContext(const OwnerType &owner, DeltaContext &deltaContext, ElementType element)
Definition: ArrayTraits.h:1929
static ElementType read(const OwnerType &owner, DeltaContext &deltaContext, BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1979
static size_t bitSizeOf(const OwnerType &owner, DeltaContext &deltaContext, size_t, ElementType element)
Definition: ArrayTraits.h:1945
static void initContext(DeltaContext &deltaContext, const ElementType &element)
Definition: ArrayTraits.h:2096
static size_t initializeOffsets(DeltaContext &deltaContext, size_t bitPosition, const ElementType &element)
Definition: ArrayTraits.h:2124
static ElementType read(DeltaContext &deltaContext, BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:2137
static size_t bitSizeOf(DeltaContext &deltaContext, size_t bitPosition, const ElementType &element)
Definition: ArrayTraits.h:2110
static void write(DeltaContext &deltaContext, BitStreamWriter &out, const ElementType &element)
Definition: ArrayTraits.h:2149
static void write(DeltaContext &deltaContext, BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:2072
static void initContext(DeltaContext &deltaContext, ElementType element)
Definition: ArrayTraits.h:2020
static ElementType read(DeltaContext &deltaContext, BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:2060
static size_t bitSizeOf(DeltaContext &deltaContext, size_t, ElementType element)
Definition: ArrayTraits.h:2033
static size_t initializeOffsets(DeltaContext &deltaContext, size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:2047
static size_t bitSizeOf(const typename ArrayTraits::OwnerType &, PACKING_CONTEXT &packingContext, size_t bitPosition, const ElementType &element)
Definition: ArrayTraits.h:2198
static size_t initializeOffsets(const typename ArrayTraits::OwnerType &, PACKING_CONTEXT &packingContext, size_t bitPosition, ElementType &element)
Definition: ArrayTraits.h:2214
static void write(const typename ArrayTraits::OwnerType &, PACKING_CONTEXT &packingContext, BitStreamWriter &out, const ElementType &element)
Definition: ArrayTraits.h:2245
static void read(typename ArrayTraits::OwnerType &owner, RAW_ARRAY &rawArray, PACKING_CONTEXT &packingContext, BitStreamReader &in, size_t index)
Definition: ArrayTraits.h:2231
static void initContext(const typename ArrayTraits::OwnerType &, PACKING_CONTEXT &packingContext, const ElementType &element)
Definition: ArrayTraits.h:2182
static ElementType read(DeltaContext &deltaContext, BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1882
static void initContext(DeltaContext &deltaContext, ElementType element)
Definition: ArrayTraits.h:1836
typename ARRAY_TRAITS::ElementType ElementType
Definition: ArrayTraits.h:1826
static size_t bitSizeOf(DeltaContext &deltaContext, size_t, ElementType element)
Definition: ArrayTraits.h:1851
static void write(DeltaContext &deltaContext, BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:1896
static size_t initializeOffsets(DeltaContext &deltaContext, size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:1867
uint8_t numBits(uint64_t numValues)
size_t bitSizeOfString(StringView stringValue)
size_t bitSizeOfVarInt32(int32_t value)
void write(BitStreamWriter &out, T value)
size_t bitSizeOfVarUInt32(uint32_t value)
size_t bitSizeOfVarInt64(int64_t value)
std::basic_string< char, std::char_traits< char >, RebindAlloc< ALLOC, char > > string
Definition: String.h:17
std::vector< T, RebindAlloc< ALLOC, T > > vector
Definition: Vector.h:17
size_t initializeOffsets(size_t bitPosition, T value)
size_t bitSizeOfVarSize(uint32_t value)
size_t bitSizeOfVarUInt64(uint64_t value)
size_t bitSizeOfVarInt16(int16_t value)
void initPackingContext(PACKING_CONTEXT &context, T value)
size_t bitSizeOfBitBuffer(const BasicBitBuffer< ALLOC > &bitBuffer)
size_t bitSizeOfVarUInt(uint64_t value)
size_t bitSizeOfVarInt(int64_t value)
size_t bitSizeOfBytes(Span< const uint8_t > bytesValue)
size_t bitSizeOf(T value)
size_t bitSizeOfVarUInt16(uint16_t value)
static size_t initializeOffsets(size_t bitPosition, const ElementType &element)
Definition: ArrayTraits.h:1571
typename ElementType::allocator_type allocator_type
Definition: ArrayTraits.h:1549
static void write(BitStreamWriter &out, const ElementType &element)
Definition: ArrayTraits.h:1594
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1600
static size_t bitSizeOf(size_t, const ElementType &element)
Definition: ArrayTraits.h:1558
static void read(RAW_ARRAY &rawArray, BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1583
static void write(BitStreamWriter &out, const ElementType &element)
Definition: ArrayTraits.h:1462
zserio::vector< uint8_t, ALLOC< uint8_t > > ElementType
Definition: ArrayTraits.h:1414
static size_t bitSizeOf(size_t, const ElementType &element)
Definition: ArrayTraits.h:1426
static void read(RAW_ARRAY &rawArray, BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1451
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1468
typename ElementType::allocator_type allocator_type
Definition: ArrayTraits.h:1417
static size_t initializeOffsets(size_t bitPosition, const ElementType &element)
Definition: ArrayTraits.h:1439
typename ElementType::allocator_type allocator_type
Definition: ArrayTraits.h:1483
static size_t initializeOffsets(size_t bitPosition, const ElementType &element)
Definition: ArrayTraits.h:1505
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1534
static void write(BitStreamWriter &out, const ElementType &element)
Definition: ArrayTraits.h:1528
zserio::string< ALLOC< char > > ElementType
Definition: ArrayTraits.h:1480
static size_t bitSizeOf(size_t, const ElementType &element)
Definition: ArrayTraits.h:1492
static void read(RAW_ARRAY &rawArray, BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1517
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:1696
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1726
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:1683
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:1719
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1708
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:1375
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:1398
static size_t bitSizeOf(size_t, ElementType)
Definition: ArrayTraits.h:1362
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1387
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1404
static size_t bitSizeOf()
Definition: ArrayTraits.h:1352
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:1634
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1646
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:1657
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:1621
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1664
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:1171
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1183
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:1194
static size_t bitSizeOf(size_t, ElementType)
Definition: ArrayTraits.h:1158
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1200
static size_t bitSizeOf()
Definition: ArrayTraits.h:1148
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1251
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:1262
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1268
static size_t bitSizeOf()
Definition: ArrayTraits.h:1216
static size_t bitSizeOf(size_t, ElementType)
Definition: ArrayTraits.h:1226
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:1239
static size_t bitSizeOf()
Definition: ArrayTraits.h:1284
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:1330
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1319
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1336
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:1307
static size_t bitSizeOf(size_t, ElementType)
Definition: ArrayTraits.h:1294
static size_t bitSizeOf(size_t, ElementType)
Definition: ArrayTraits.h:420
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:461
static size_t bitSizeOf()
Definition: ArrayTraits.h:400
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:444
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:455
static size_t initializeOffsets(size_t bitPosition, ElementType)
Definition: ArrayTraits.h:432
static size_t bitSizeOf(ElementType)
Definition: ArrayTraits.h:410
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:970
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:981
static size_t bitSizeOf(ElementType element)
Definition: ArrayTraits.h:933
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:958
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:945
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:1054
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1043
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:1018
static size_t bitSizeOf(ElementType element)
Definition: ArrayTraits.h:1006
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:1031
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:537
static size_t bitSizeOf(ElementType element)
Definition: ArrayTraits.h:489
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:514
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:526
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:501
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:599
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:574
static size_t bitSizeOf(ElementType element)
Definition: ArrayTraits.h:562
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:610
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:587
static size_t bitSizeOf(ElementType element)
Definition: ArrayTraits.h:635
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:672
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:647
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:683
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:660
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:733
static size_t bitSizeOf(ElementType element)
Definition: ArrayTraits.h:708
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:745
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:756
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:720
static size_t bitSizeOf(ElementType element)
Definition: ArrayTraits.h:781
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:806
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:818
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:829
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:793
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:866
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:891
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:879
static size_t bitSizeOf(ElementType element)
Definition: ArrayTraits.h:854
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:902
static ElementType read(BitStreamReader &in, size_t=0)
Definition: ArrayTraits.h:1115
static constexpr bool IS_BITSIZEOF_CONSTANT
Definition: ArrayTraits.h:1132
static void write(BitStreamWriter &out, ElementType element)
Definition: ArrayTraits.h:1126
static size_t bitSizeOf(ElementType element)
Definition: ArrayTraits.h:1078
static size_t bitSizeOf(size_t, ElementType element)
Definition: ArrayTraits.h:1090
static size_t initializeOffsets(size_t bitPosition, ElementType element)
Definition: ArrayTraits.h:1103