Dev Essential  1.6.3
Loading...
Searching...
No Matches
leaf_value_access.h
Go to the documentation of this file.
1
15
16#ifndef DDL_LEAF_VALUE_ACCESS_CLASS_HEADER
17#define DDL_LEAF_VALUE_ACCESS_CLASS_HEADER
18
25
26#include <cstring>
27#include <stdexcept>
28
29namespace ddl {
30namespace codec {
31
44private:
45 template <bool ThrowError>
46 using throw_error = std::integral_constant<bool, ThrowError>;
47
48public:
52 LeafCodecIndex() = delete;
59 {
60 convertToLeafLayout</*throw_error=*/true>(codec_index, _leaf_layout, rep);
61 }
62
66 const LeafLayout& getLayout() const noexcept
67 {
68 return _leaf_layout;
69 }
70
82 template <bool ThrowError>
83 static bool convertToLeafLayout(const CodecIndex& codec_index,
84 LeafLayout& leaf_layout,
86 {
87 if (!checkLeafLayout<ThrowError>(codec_index, rep)) {
88 return false;
89 }
90 return convertToLeafLayout(codec_index, leaf_layout, rep, throw_error<ThrowError>{});
91 }
92
93private:
95 static bool convertToLeafLayout(const CodecIndex& codec_index,
96 LeafLayout& leaf_layout,
98 throw_error<false>) noexcept
99 {
100 const auto& layout = codec_index.getLayout();
101 leaf_layout.element_type = static_cast<LeafElementType>(layout.type_info->getType());
103 leaf_layout.data_flags = static_cast<uint8_t>(LeafDataRepresentation::deserialized);
104 leaf_layout.byte_pos = static_cast<uint32_t>(layout.deserialized.bit_offset / 8);
105 if (layout.deserialized.type_bit_size > (std::numeric_limits<uint8_t>::max)()) {
106 return false;
107 }
108 // no bitpos in deserialized representation
109 leaf_layout.bit_size = static_cast<uint8_t>(layout.deserialized.type_bit_size);
110 }
111 else {
112 leaf_layout.data_flags |=
113 (layout.byte_order == dd::ByteOrder::e_be) ?
114 static_cast<uint8_t>(LeafDataRepresentation::serialized_be) :
115 static_cast<uint8_t>(LeafDataRepresentation::serialized_le);
116 leaf_layout.bit_pos = layout.serialized.bit_offset % 8;
117 leaf_layout.byte_pos = static_cast<uint32_t>(layout.serialized.bit_offset / 8);
118 if (layout.serialized.type_bit_size_used > (std::numeric_limits<uint8_t>::max)()) {
119 return false;
120 }
121 leaf_layout.bit_size = static_cast<uint8_t>(layout.serialized.type_bit_size_used);
122 if (layout.serialized.type_bit_size_used == layout.deserialized.type_bit_size &&
123 leaf_layout.bit_pos == 0 &&
124 layout.byte_order == dd::ByteOrderDefault::getPlatformDefault()) {
125 // this means: the same type is used in serialized and deserialized without byteswap
126 // the simple fast memcopy operation can be used
127 // switch back to deserialzed option, but keep bytepos!
128 leaf_layout.data_flags = static_cast<uint8_t>(LeafDataRepresentation::deserialized);
129 }
130 }
131 return true;
132 }
133
135 static bool convertToLeafLayout(const CodecIndex& codec_index,
136 LeafLayout& leaf_layout,
138 throw_error<true>)
139 {
140 if (!convertToLeafLayout(codec_index, leaf_layout, rep, throw_error<false>{})) {
141 throw std::runtime_error(
142 "element size exceeds maximal bit size for small leaf layout of" +
143 std::to_string((std::numeric_limits<uint8_t>::max)()));
144 }
145 return true;
146 }
147
149 template <typename T>
150 static bool checkTypeSize(const CodecIndex& codec_index,
152 bool exact_check_on_serialized,
153 throw_error<false>) noexcept
154 {
155 const auto size_to_check = (rep == ddl::DataRepresentation::serialized) ?
156 (codec_index.getLayout().serialized.type_bit_size / 8) :
157 (codec_index.getLayout().deserialized.type_bit_size / 8);
158 if (rep == ddl::DataRepresentation::serialized && !exact_check_on_serialized) {
159 if (sizeof(T) < size_to_check) {
160 return false;
161 }
162 }
163 return (sizeof(T) == size_to_check);
164 }
165
167 template <typename T>
168 static bool checkTypeSize(const CodecIndex& codec_index,
170 bool exact_check,
171 throw_error<true>)
172 {
173 if (!checkTypeSize<T>(codec_index, rep, exact_check, throw_error<false>{})) {
174 throw std::runtime_error(
175 "Standard datatype is only supported if bit size is not customized. Found "
176 "element type with different size to standard!");
177 }
178 return true;
179 }
180
182 template <bool ThrowError>
183 static bool checkLeafLayout(const CodecIndex& codec_index, ddl::DataRepresentation rep)
184 {
185 switch (codec_index.getType()) {
186 case ElementType::cet_empty: // fall thru
188 if (ThrowError) {
189 throw std::runtime_error("Small leaf layouts can only be used for leaf elements!");
190 }
191 return false;
192 break;
193 }
195 return checkTypeSize<bool>(codec_index, rep, false, throw_error<ThrowError>{});
196 break;
197 }
200 return checkTypeSize<int8_t>(codec_index, rep, false, throw_error<ThrowError>{});
201 break;
202 }
205 return checkTypeSize<int16_t>(codec_index, rep, false, throw_error<ThrowError>{});
206 break;
207 }
210 return checkTypeSize<int32_t>(codec_index, rep, false, throw_error<ThrowError>{});
211 break;
212 }
214 return checkTypeSize<int32_t>(codec_index, rep, true, throw_error<ThrowError>{});
215 break;
216 }
219 return checkTypeSize<int64_t>(codec_index, rep, false, throw_error<ThrowError>{});
220 break;
221 }
223 return checkTypeSize<int64_t>(codec_index, rep, true, throw_error<ThrowError>{});
224 break;
225 }
227 if (ThrowError) {
228 throw std::runtime_error(
229 "user supported types are not supported in small leaf layout");
230 }
231 else {
232 return false;
233 }
234 }
235 }
236 return true;
237 }
239 LeafLayout _leaf_layout;
240};
241
242#if defined(__GNUC__) && (__GNUC__ == 5) && defined(__QNX__)
243#pragma GCC diagnostic ignored \
244 "-Wattributes" // standard type attributes are ignored when used in templates
245#endif // defined(__GNUC__) && (__GNUC__ == 5) && defined(__QNX__)
246
247namespace detail {
248
249template <typename ValueType>
251 : public std::is_arithmetic<a_util::underlying_type_or_type_t<ValueType>> {};
252
253template <typename ElementValueTypeFrom, typename TargetValueTypeTo>
255 : public std::integral_constant<
256 bool,
257 (!std::is_enum<TargetValueTypeTo>::value &&
258 a_util::is_explicitly_convertible_to_v<ElementValueTypeFrom, TargetValueTypeTo>) ||
259 (std::is_enum<TargetValueTypeTo>::value &&
260 !std::is_floating_point<ElementValueTypeFrom>::value)> {};
261
262template <typename ValueType>
264 : public std::integral_constant<
265 bool,
266 a_util::is_explicitly_convertible_to_v<bool, ValueType> ||
267 a_util::is_explicitly_convertible_to_v<int8_t, ValueType> ||
268 a_util::is_explicitly_convertible_to_v<uint8_t, ValueType> ||
269 a_util::is_explicitly_convertible_to_v<int16_t, ValueType> ||
270 a_util::is_explicitly_convertible_to_v<uint16_t, ValueType> ||
271 a_util::is_explicitly_convertible_to_v<int32_t, ValueType> ||
272 a_util::is_explicitly_convertible_to_v<uint32_t, ValueType> ||
273 a_util::is_explicitly_convertible_to_v<int64_t, ValueType> ||
274 a_util::is_explicitly_convertible_to_v<uint64_t, ValueType> ||
275 a_util::is_explicitly_convertible_to_v<float, ValueType> ||
276 a_util::is_explicitly_convertible_to_v<double, ValueType>> {};
277
285template <typename ElementValueType,
286 typename TargetValueType,
287 bool conversion_allowed =
296 static TargetValueType convert(const ElementValueType& element_value)
297 {
298 return static_cast<TargetValueType>(element_value);
299 }
300};
301
308template <typename ElementValueType, typename TargetValueType>
309struct TargetValueConverter<ElementValueType, TargetValueType, false> {
316 static TargetValueType convert(const ElementValueType&)
317 {
319 "The used type must at least convertible from one fundamental type (bool, "
320 "any int, float, double) explicitly!");
321 throw std::runtime_error("unsupported type conversion requested");
322 }
323};
324
325template <typename ElementValueTypeTo, typename SourceValueTypeFrom>
327 : public std::integral_constant<
328 bool,
329 (!std::is_enum<SourceValueTypeFrom>::value &&
330 a_util::is_explicitly_convertible_to_v<SourceValueTypeFrom, ElementValueTypeTo>) ||
331 (std::is_enum<SourceValueTypeFrom>::value &&
332 !std::is_floating_point<ElementValueTypeTo>::value)> {};
333
334template <typename ValueType>
336 : public std::integral_constant<
337 bool,
338 a_util::is_explicitly_convertible_to_v<ValueType, bool> ||
339 a_util::is_explicitly_convertible_to_v<ValueType, int8_t> ||
340 a_util::is_explicitly_convertible_to_v<ValueType, uint8_t> ||
341 a_util::is_explicitly_convertible_to_v<ValueType, int16_t> ||
342 a_util::is_explicitly_convertible_to_v<ValueType, uint16_t> ||
343 a_util::is_explicitly_convertible_to_v<ValueType, int32_t> ||
344 a_util::is_explicitly_convertible_to_v<ValueType, uint32_t> ||
345 a_util::is_explicitly_convertible_to_v<ValueType, int64_t> ||
346 a_util::is_explicitly_convertible_to_v<ValueType, uint64_t> ||
347 a_util::is_explicitly_convertible_to_v<ValueType, float> ||
348 a_util::is_explicitly_convertible_to_v<ValueType, double>> {};
349
357template <typename ElementValueType,
358 typename SourceValueType,
359 bool conversion_allowed =
370 static bool convert(ElementValueType& element_value, const SourceValueType& value)
371 {
372 element_value = static_cast<ElementValueType>(value);
373 return true;
374 }
375};
376
383template <typename ElementValueType, typename SourceValueType>
384struct SourceValueConverter<ElementValueType, SourceValueType, false> {
392 static bool convert(ElementValueType&, const SourceValueType&)
393 {
395 "The used type must at least convertible to one fundamental type (bool, any "
396 "int, float, double) explicitly");
397 return false;
398 }
399};
400
413template <typename ElementValueType, typename TargetValueType>
414TargetValueType readBytes(const void* data, const size_t& data_size, uint32_t byte_pos)
415{
416 ElementValueType value;
417 if (byte_pos + sizeof(ElementValueType) > data_size) {
418 throw std::runtime_error("copy action exceeds buffersize");
419 }
420 std::memcpy(&value, static_cast<const uint8_t*>(data) + byte_pos, sizeof(ElementValueType));
422}
423
436template <typename ElementValueType, typename SourceValueType>
437void writeBytes(void* data,
438 const size_t& data_size,
439 uint32_t byte_pos,
440 const SourceValueType& source_value)
441{
442 if (byte_pos + sizeof(ElementValueType) > data_size) {
443 throw std::runtime_error("copy action exceeds buffersize");
444 }
445 else {
446 ElementValueType value;
448 std::memcpy(static_cast<uint8_t*>(data) + byte_pos, &value, sizeof(ElementValueType));
449 }
450 else {
451 throw std::runtime_error("unsupported type conversion requested");
452 }
453 }
454}
455
469template <typename ElementValueType, typename TargetValueType>
470TargetValueType readBits(const void* data,
471 size_t data_size,
472 size_t bit_offset,
473 size_t bit_size,
474 a_util::memory::Endianess byte_order)
475{
476 ElementValueType value{};
477 a_util::memory::BitSerializer bit_reader(const_cast<void*>(data), data_size);
478 auto res = bit_reader.read<ElementValueType>(bit_offset, bit_size, &value, byte_order);
479 if (res) {
481 }
482 throw std::runtime_error(a_util::result::toString(res));
483}
484
498template <typename ElementValueType, typename SourceValueType>
499void writeBits(void* data,
500 size_t data_size,
501 size_t bit_offset,
502 size_t bit_size,
503 a_util::memory::Endianess byte_order,
504 const SourceValueType& source_value)
505{
506 ElementValueType value{};
508 a_util::memory::BitSerializer bit_reader(data, data_size);
509 const auto res =
510 bit_reader.write<ElementValueType>(bit_offset, bit_size, value, byte_order);
511 if (!res) {
512 throw std::runtime_error(a_util::result::toString(res));
513 }
514 }
515 else {
516 throw std::runtime_error("unsupported type conversion requested");
517 }
518}
519
531template <typename ValueType>
532ValueType readDeserializedBytes(const void* data, const size_t& data_size, const LeafLayout& layout)
533{
534 switch (layout.element_type) {
536 return readBytes<bool, ValueType>(data, data_size, layout.byte_pos);
537 }
539 return readBytes<uint8_t, ValueType>(data, data_size, layout.byte_pos);
540 }
542 return readBytes<int8_t, ValueType>(data, data_size, layout.byte_pos);
543 }
545 return readBytes<uint16_t, ValueType>(data, data_size, layout.byte_pos);
546 }
548 return readBytes<int16_t, ValueType>(data, data_size, layout.byte_pos);
549 }
551 return readBytes<uint32_t, ValueType>(data, data_size, layout.byte_pos);
552 }
554 return readBytes<int32_t, ValueType>(data, data_size, layout.byte_pos);
555 }
557 return readBytes<uint64_t, ValueType>(data, data_size, layout.byte_pos);
558 }
560 return readBytes<int64_t, ValueType>(data, data_size, layout.byte_pos);
561 }
563 return readBytes<float, ValueType>(data, data_size, layout.byte_pos);
564 }
566 return readBytes<double, ValueType>(data, data_size, layout.byte_pos);
567 }
568 default: // all others are not supported
569 {
570 break;
571 }
572 }
573 throw std::runtime_error("invalid type");
574}
575
586template <typename ValueType>
587ValueType readSerializedBits(const void* data, const size_t& data_size, const LeafLayout& layout)
588{
589 const size_t bit_pos = layout.byte_pos * 8 + layout.bit_pos;
590 const size_t bit_size = layout.bit_size;
591 const a_util::memory::Endianess byte_order =
592 ((layout.data_flags & static_cast<uint8_t>(LeafDataRepresentation::serialized_be)) ==
593 static_cast<uint8_t>(LeafDataRepresentation::serialized_be)) ?
594 a_util::memory::bit_big_endian :
595 a_util::memory::bit_little_endian;
596 switch (layout.element_type) {
598 return readBits<bool, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
599 }
601 return readBits<uint8_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
602 }
604 return readBits<int8_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
605 }
607 return readBits<uint16_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
608 }
610 return readBits<int16_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
611 }
613 return readBits<uint32_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
614 }
616 return readBits<int32_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
617 }
619 return readBits<uint64_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
620 }
622 return readBits<int64_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
623 }
625 return readBits<float, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
626 }
628 return readBits<double, ValueType>(data, data_size, bit_pos, bit_size, byte_order);
629 }
630 default: // all others are not supported
631 {
632 break;
633 }
634 }
635 throw std::runtime_error("invalid type");
636}
637
648template <typename ValueType>
650 const size_t& data_size,
651 const LeafLayout& layout,
652 const ValueType& value)
653{
654 switch (layout.element_type) {
656 return writeBytes<bool, ValueType>(data, data_size, layout.byte_pos, value);
657 }
659 return writeBytes<uint8_t, ValueType>(data, data_size, layout.byte_pos, value);
660 }
662 return writeBytes<int8_t, ValueType>(data, data_size, layout.byte_pos, value);
663 }
665 return writeBytes<uint16_t, ValueType>(data, data_size, layout.byte_pos, value);
666 }
668 return writeBytes<int16_t, ValueType>(data, data_size, layout.byte_pos, value);
669 }
671 return writeBytes<uint32_t, ValueType>(data, data_size, layout.byte_pos, value);
672 }
674 return writeBytes<int32_t, ValueType>(data, data_size, layout.byte_pos, value);
675 }
677 return writeBytes<uint64_t, ValueType>(data, data_size, layout.byte_pos, value);
678 }
680 return writeBytes<int64_t, ValueType>(data, data_size, layout.byte_pos, value);
681 }
683 return writeBytes<float, ValueType>(data, data_size, layout.byte_pos, value);
684 }
686 return writeBytes<double, ValueType>(data, data_size, layout.byte_pos, value);
687 }
688 default: // all others are not supported
689 {
690 break;
691 }
692 }
693 throw std::runtime_error("invalid type");
694}
695
707template <typename ValueType>
708void writeSerializedBits(void* data,
709 const size_t& data_size,
710 const LeafLayout& layout,
711 const ValueType& value)
712{
713 const size_t bit_pos = layout.byte_pos * 8 + layout.bit_pos;
714 const size_t bit_size = layout.bit_size;
715 const a_util::memory::Endianess byte_order =
716 ((layout.data_flags & static_cast<uint8_t>(LeafDataRepresentation::serialized_be)) ==
717 static_cast<uint8_t>(LeafDataRepresentation::serialized_be)) ?
718 a_util::memory::bit_big_endian :
719 a_util::memory::bit_little_endian;
720 switch (layout.element_type) {
722 return writeBits<bool, ValueType>(data, data_size, bit_pos, bit_size, byte_order, value);
723 }
725 return writeBits<uint8_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order, value);
726 }
728 return writeBits<int8_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order, value);
729 }
732 data, data_size, bit_pos, bit_size, byte_order, value);
733 }
735 return writeBits<int16_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order, value);
736 }
739 data, data_size, bit_pos, bit_size, byte_order, value);
740 }
742 return writeBits<int32_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order, value);
743 }
746 data, data_size, bit_pos, bit_size, byte_order, value);
747 }
749 return writeBits<int64_t, ValueType>(data, data_size, bit_pos, bit_size, byte_order, value);
750 }
752 return writeBits<float, ValueType>(data, data_size, bit_pos, bit_size, byte_order, value);
753 }
755 return writeBits<double, ValueType>(data, data_size, bit_pos, bit_size, byte_order, value);
756 }
757 default: // all others are not supported
758 {
759 break;
760 }
761 }
762 throw std::runtime_error("invalid type");
763}
764
765} // namespace detail
766
767#if defined(__GNUC__) && (__GNUC__ == 5) && defined(__QNX__)
768#pragma GCC diagnostic warning \
769 "-Wattributes" // standard type attributes are ignored when used in templates
770#endif // defined(__GNUC__) && (__GNUC__ == 5) && defined(__QNX__)
771
779template <typename ValueType>
789 static ValueType getValue(const void* data,
790 const size_t data_size,
791 const LeafLayout& leaf_layout)
792 {
793 if ((leaf_layout.data_flags & static_cast<uint8_t>(LeafDataRepresentation::serialized)) ==
794 static_cast<uint8_t>(LeafDataRepresentation::serialized)) {
795 return detail::readSerializedBits<ValueType>(data, data_size, leaf_layout);
796 }
797 else {
798 return detail::readDeserializedBytes<ValueType>(data, data_size, leaf_layout);
799 }
800 }
801};
802
810template <typename ValueType>
820 static void setValue(void* data,
821 const size_t data_size,
822 const LeafLayout& leaf_layout,
823 const ValueType& value)
824 {
825 if ((leaf_layout.data_flags & static_cast<uint8_t>(LeafDataRepresentation::serialized)) ==
826 static_cast<uint8_t>(LeafDataRepresentation::serialized)) {
827 detail::writeSerializedBits<ValueType>(data, data_size, leaf_layout, value);
828 }
829 else {
830 detail::writeDeserializedBytes<ValueType>(data, data_size, leaf_layout, value);
831 }
832 }
833};
834} // namespace codec
835} // namespace ddl
836
837#ifdef DDL_NO_SUPPORT_FOR_CONSTEXPR_CONDITION
838#undef DDL_NO_SUPPORT_FOR_CONSTEXPR_CONDITION
839#endif
840
841#endif
Bit Serializer Class.
Definition bitserializer.h:607
a_util::result::Result read(size_t start_bit, size_t bit_length, T *value, Endianess endianess=get_platform_endianess())
Definition bitserializer.h:644
a_util::result::Result write(size_t start_bit, size_t bit_length, T value, Endianess endianess=get_platform_endianess())
Definition bitserializer.h:675
Definition codec_index.h:276
LeafCodecIndex(const CodecIndex &codec_index, ddl::DataRepresentation rep)
CTOR.
Definition leaf_value_access.h:58
LeafCodecIndex()=delete
no CTOR
const LeafLayout & getLayout() const noexcept
Get the leaf layout.
Definition leaf_value_access.h:66
static bool convertToLeafLayout(const CodecIndex &codec_index, LeafLayout &leaf_layout, ddl::DataRepresentation rep)
Retrieves a valid, small, 8-bytes LeafLayout from a CodecIndex.
Definition leaf_value_access.h:83
static ByteOrder getPlatformDefault()
Get the current Platform Byteorder.
void writeBits(void *data, size_t data_size, size_t bit_offset, size_t bit_size, a_util::memory::Endianess byte_order, const SourceValueType &source_value)
Write the bits of the element to the data area after conversion from source_value.
Definition leaf_value_access.h:499
TargetValueType readBits(const void *data, size_t data_size, size_t bit_offset, size_t bit_size, a_util::memory::Endianess byte_order)
Read the bits from a data area and converts this value to the TargetValueType.
Definition leaf_value_access.h:470
ValueType readDeserializedBytes(const void *data, const size_t &data_size, const LeafLayout &layout)
Retrieves a value from the given data area with the layout information of the layout.
Definition leaf_value_access.h:532
void writeBytes(void *data, const size_t &data_size, uint32_t byte_pos, const SourceValueType &source_value)
Writes the value of source_value to the data area after conversion to the elements ElementValueType.
Definition leaf_value_access.h:437
TargetValueType readBytes(const void *data, const size_t &data_size, uint32_t byte_pos)
Read the bytes from a data area and converts this value to the TargetValueType.
Definition leaf_value_access.h:414
void writeSerializedBits(void *data, const size_t &data_size, const LeafLayout &layout, const ValueType &value)
Writes a value to the given data area with the layout information of the layout.
Definition leaf_value_access.h:708
ValueType readSerializedBits(const void *data, const size_t &data_size, const LeafLayout &layout)
Retrieves a value from the given data area with the layout information of the layout.
Definition leaf_value_access.h:587
void writeDeserializedBytes(void *data, const size_t &data_size, const LeafLayout &layout, const ValueType &value)
Writes a value to the given data area with the layout information of the layout.
Definition leaf_value_access.h:649
Endianess
Enum describing the endianess.
Definition bitserializer.h:31
std::string toString(const Result &result, ResultFormatFlags formatting_flags=DisableNone, const char *format=nullptr)
Namespace for the new faster CodecFactory/Decoder/Codec implementation.
Definition codec.h:22
LeafElementType
Definition leaf_layout.h:51
@ let_uint64
LeafElementType type is std::uint64_t.
Definition leaf_layout.h:66
@ let_uint8
LeafElementType type is std::uint8_t.
Definition leaf_layout.h:54
@ let_double
LeafElementType type is double.
Definition leaf_layout.h:69
@ let_int8
LeafElementType type is std::int8_t.
Definition leaf_layout.h:53
@ let_int64
LeafElementType type is std::int64_t.
Definition leaf_layout.h:64
@ let_float
LeafElementType type is float.
Definition leaf_layout.h:68
@ let_int32
LeafElementType type is std::int32_t.
Definition leaf_layout.h:60
@ let_uint32
LeafElementType type is std::uint32_t.
Definition leaf_layout.h:62
@ let_bool
LeafElementType type is bool.
Definition leaf_layout.h:52
@ let_uint16
LeafElementType type is std::uint16_t.
Definition leaf_layout.h:58
@ let_int16
LeafElementType type is std::int16_t.
Definition leaf_layout.h:56
@ serialized_le
first bit is set second bit is not set for serialized data representation in little endianess of the ...
Definition leaf_layout.h:45
@ deserialized
first bit is zero for deserialized data representation of the LeafCodecIndex::data_flags
Definition leaf_layout.h:30
@ serialized_be
first and second bit is set for serialized data representation in big endianess of the LeafCodecIndex...
Definition leaf_layout.h:40
@ serialized
first bit is set for serialized data representation of the LeafCodecIndex::data_flags
Definition leaf_layout.h:35
@ cet_float
Variant type is float.
Definition codec_type_info.h:41
@ cet_int16
Variant type is std::int16_t.
Definition codec_type_info.h:35
@ cet_int8
Variant type is std::int8_t.
Definition codec_type_info.h:33
@ cet_uint64
Variant type is std::uint64_t.
Definition codec_type_info.h:40
@ cet_uint8
Variant type is std::uint8_t.
Definition codec_type_info.h:34
@ cet_uint32
Variant type is std::uint32_t.
Definition codec_type_info.h:38
@ cet_sub_codec
type marks a subcodec/substructure with children
Definition codec_type_info.h:43
@ cet_bool
Variant type is bool.
Definition codec_type_info.h:32
@ cet_uint16
Variant type is std::uint16_t.
Definition codec_type_info.h:36
@ cet_int32
Variant type is std::int32_t.
Definition codec_type_info.h:37
@ cet_int64
Variant type is std::int64_t.
Definition codec_type_info.h:39
@ cet_empty
Variant type is empty.
Definition codec_type_info.h:31
@ cet_user_type
type marks a user defined type
Definition codec_type_info.h:44
@ cet_double
Variant type is double.
Definition codec_type_info.h:42
definition of the ddl namespace
Definition codec.h:21
DataRepresentation
Definition data_representation.h:25
@ serialized
serialized data, i.e network, on disks, can msgs, ...
Definition data_representation.h:26
@ deserialized
deserialized data, c-structs, arrays, ...
Definition data_representation.h:27
small leaf layout information to access codec data very fast.
Definition leaf_layout.h:76
uint8_t bit_size
type bit size of an element for serialized or deserialized
Definition leaf_layout.h:92
uint32_t byte_pos
byte position of the element for serialized or deserialized
Definition leaf_layout.h:85
LeafElementType element_type
type of the value. accept all valid leaf types, except user defined types
Definition leaf_layout.h:90
uint8_t bit_pos
bit position of the element for serialized only
Definition leaf_layout.h:88
uint8_t data_flags
flags of the described layout
Definition leaf_layout.h:94
Definition leaf_value_access.h:780
static ValueType getValue(const void *data, const size_t data_size, const LeafLayout &leaf_layout)
Definition leaf_value_access.h:789
Definition leaf_value_access.h:811
static void setValue(void *data, const size_t data_size, const LeafLayout &leaf_layout, const ValueType &value)
Definition leaf_value_access.h:820
static bool convert(ElementValueType &, const SourceValueType &)
Should convert a value of SourceValueType to a element_value of type ElementValueType,...
Definition leaf_value_access.h:392
Converter to convert from a value of SourceValueType to a value of ElementValueType.
Definition leaf_value_access.h:361
static bool convert(ElementValueType &element_value, const SourceValueType &value)
Converts a value of SourceValueType to a element_value of type ElementValueType.
Definition leaf_value_access.h:370
Definition leaf_value_access.h:332
Definition leaf_value_access.h:260
Definition leaf_value_access.h:251
static TargetValueType convert(const ElementValueType &)
Should convert a value of ElementValueType to a value of type ElementValueType, but this specialized ...
Definition leaf_value_access.h:316
Converter to convert a value of ElementValueType to a value of TargetValueType.
Definition leaf_value_access.h:289
static TargetValueType convert(const ElementValueType &element_value)
Converts a element_value to as value of type TargetValueType.
Definition leaf_value_access.h:296