1 #ifndef ZSERIO_INTROSPECTABLE_VIEW_H_INC
2 #define ZSERIO_INTROSPECTABLE_VIEW_H_INC
20 template <
typename T,
typename ALLOC>
21 class IntrospectableViewBase :
public IntrospectableDataBase<IBasicIntrospectableView<ALLOC>, ALLOC>
24 using Base = IntrospectableDataBase<IBasicIntrospectableView<ALLOC>, ALLOC>;
36 IntrospectableViewBase(
const IBasicTypeInfo<ALLOC>&
typeInfo, T value) :
52 ~IntrospectableViewBase()
override =
default;
58 IntrospectableViewBase(
const IntrospectableViewBase&) =
delete;
59 IntrospectableViewBase& operator=(
const IntrospectableViewBase&) =
delete;
61 IntrospectableViewBase(
const IntrospectableViewBase&&) =
delete;
62 IntrospectableViewBase& operator=(
const IntrospectableViewBase&&) =
delete;
67 BasicAny<ALLOC>
getAnyValue(
const ALLOC& allocator)
const override
69 return BasicAny<ALLOC>(m_value, allocator);
74 return getFromObject(*
this, path, 0);
79 throw CppRuntimeException(
"Type '")
80 << IntrospectableViewBase<T, ALLOC>::getTypeInfo().getSchemaName()
81 <<
"' has no parameters to get!";
86 throw CppRuntimeException(
"Type '")
87 << IntrospectableViewBase<T, ALLOC>::getTypeInfo().getSchemaName()
88 <<
"' has no functions to call!";
91 BasicBitBuffer<ALLOC>
serialize(
const ALLOC&)
const override
93 throw CppRuntimeException(
"Type '")
94 << IntrospectableViewBase<T, ALLOC>::getTypeInfo().getSchemaName()
95 <<
"' is not a compound type!";
98 BasicBitBuffer<ALLOC>
serialize()
const override
104 ConstPtr getFieldFromObject(
const IBasicIntrospectableView<ALLOC>&
object, std::string_view name)
const;
105 ConstPtr getParameterFromObject(
const IBasicIntrospectableView<ALLOC>&
object, std::string_view name)
const;
106 ConstPtr callFunctionInObject(
const IBasicIntrospectableView<ALLOC>&
object, std::string_view name)
const;
108 const IBasicIntrospectableView<ALLOC>&
object, std::string_view path,
size_t pos)
const;
118 template <
typename T,
typename ALLOC>
119 class IntegralIntrospectableViewBase :
public IntrospectableViewBase<T, ALLOC>
122 static_assert(std::is_integral_v<typename T::ValueType>,
"T must be a signed integral type!");
124 using Base = IntrospectableViewBase<T, ALLOC>;
127 IntegralIntrospectableViewBase(
const IBasicTypeInfo<ALLOC>&
typeInfo, T value) :
133 return static_cast<double>(Base::getValue());
136 BasicString<RebindAlloc<ALLOC, char>>
toString(
const ALLOC& allocator)
const override
138 return zserio::toString<ALLOC>(Base::getValue(), allocator);
147 template <
typename T,
typename ALLOC>
148 class SignedIntrospectableViewBase :
public IntegralIntrospectableViewBase<T, ALLOC>
151 static_assert(std::is_signed_v<typename T::ValueType>,
"T must be a signed integral type!");
153 using Base = IntegralIntrospectableViewBase<T, ALLOC>;
158 int64_t
toInt()
const override
160 return Base::getValue();
169 template <
typename T,
typename ALLOC>
170 class UnsignedIntrospectableViewBase :
public IntegralIntrospectableViewBase<T, ALLOC>
173 static_assert(std::is_unsigned<typename T::ValueType>::value,
"T must be an unsigned integral type!");
175 using Base = IntegralIntrospectableViewBase<T, ALLOC>;
180 uint64_t
toUInt()
const override
182 return Base::getValue();
189 template <
typename ALLOC>
190 class BoolIntrospectableView :
public UnsignedIntrospectableViewBase<Bool, ALLOC>
193 using Base = UnsignedIntrospectableViewBase<Bool, ALLOC>;
196 explicit BoolIntrospectableView(
Bool value) :
202 return Base::getValue();
209 template <
typename T,
typename ALLOC>
210 class Int8IntrospectableView :
public SignedIntrospectableViewBase<T, ALLOC>
213 using Base = SignedIntrospectableViewBase<T, ALLOC>;
215 static_assert(std::is_same_v<int8_t, typename T::ValueType>,
"T must be based on int8_t!");
218 explicit Int8IntrospectableView(T value) :
222 int8_t
getInt8()
const override
224 return Base::getValue();
231 template <
typename T,
typename ALLOC>
232 class Int16IntrospectableView :
public SignedIntrospectableViewBase<T, ALLOC>
235 using Base = SignedIntrospectableViewBase<T, ALLOC>;
237 static_assert(std::is_same_v<int16_t, typename T::ValueType>,
"T must be based on int16_t!");
240 explicit Int16IntrospectableView(T value) :
246 return Base::getValue();
253 template <
typename T,
typename ALLOC>
254 class Int32IntrospectableView :
public SignedIntrospectableViewBase<T, ALLOC>
257 using Base = SignedIntrospectableViewBase<T, ALLOC>;
259 static_assert(std::is_same_v<int32_t, typename T::ValueType>,
"T must be based on int32_t!");
262 explicit Int32IntrospectableView(T value) :
268 return Base::getValue();
275 template <
typename T,
typename ALLOC>
276 class Int64IntrospectableView :
public SignedIntrospectableViewBase<T, ALLOC>
279 using Base = SignedIntrospectableViewBase<T, ALLOC>;
281 static_assert(std::is_same_v<int64_t, typename T::ValueType>,
"T must be based on int64_t!");
284 explicit Int64IntrospectableView(T value) :
290 return Base::getValue();
297 template <
typename T,
typename ALLOC>
298 class UInt8IntrospectableView :
public UnsignedIntrospectableViewBase<T, ALLOC>
301 using Base = UnsignedIntrospectableViewBase<T, ALLOC>;
303 static_assert(std::is_same_v<uint8_t, typename T::ValueType>,
"T must be based on uint8_t!");
306 explicit UInt8IntrospectableView(T value) :
312 return Base::getValue();
319 template <
typename T,
typename ALLOC>
320 class UInt16IntrospectableView :
public UnsignedIntrospectableViewBase<T, ALLOC>
323 using Base = UnsignedIntrospectableViewBase<T, ALLOC>;
325 static_assert(std::is_same_v<uint16_t, typename T::ValueType>,
"T must be based on uint16_t!");
328 explicit UInt16IntrospectableView(T value) :
334 return Base::getValue();
341 template <
typename T,
typename ALLOC>
342 class UInt32IntrospectableView :
public UnsignedIntrospectableViewBase<T, ALLOC>
345 using Base = UnsignedIntrospectableViewBase<T, ALLOC>;
347 static_assert(std::is_same_v<uint32_t, typename T::ValueType>,
"T must be based on uint32_t!");
350 explicit UInt32IntrospectableView(T value) :
356 return Base::getValue();
363 template <
typename T,
typename ALLOC>
364 class UInt64IntrospectableView :
public UnsignedIntrospectableViewBase<T, ALLOC>
367 using Base = UnsignedIntrospectableViewBase<T, ALLOC>;
369 static_assert(std::is_same_v<uint64_t, typename T::ValueType>,
"T must be based on uint64_t!");
372 explicit UInt64IntrospectableView(T value) :
378 return Base::getValue();
385 template <
typename T,
typename ALLOC>
386 class DynInt8IntrospectableView :
public SignedIntrospectableViewBase<View<T>, ALLOC>
389 using Base = SignedIntrospectableViewBase<View<T>, ALLOC>;
391 static_assert(std::is_same_v<int8_t, typename T::ValueType>,
"T must be based on int8_t!");
394 explicit DynInt8IntrospectableView(View<T> value) :
398 int8_t
getInt8()
const override
400 return Base::getValue();
407 template <
typename T,
typename ALLOC>
408 class DynInt16IntrospectableView :
public SignedIntrospectableViewBase<View<T>, ALLOC>
411 using Base = SignedIntrospectableViewBase<View<T>, ALLOC>;
413 static_assert(std::is_same_v<int16_t, typename T::ValueType>,
"T must be based on int16_t!");
416 explicit DynInt16IntrospectableView(View<T> value) :
422 return Base::getValue();
429 template <
typename T,
typename ALLOC>
430 class DynInt32IntrospectableView :
public SignedIntrospectableViewBase<View<T>, ALLOC>
433 using Base = SignedIntrospectableViewBase<View<T>, ALLOC>;
435 static_assert(std::is_same_v<int32_t, typename T::ValueType>,
"T must be based on int32_t!");
438 explicit DynInt32IntrospectableView(View<T> value) :
444 return Base::getValue();
451 template <
typename T,
typename ALLOC>
452 class DynInt64IntrospectableView :
public SignedIntrospectableViewBase<View<T>, ALLOC>
455 using Base = SignedIntrospectableViewBase<View<T>, ALLOC>;
457 static_assert(std::is_same_v<int64_t, typename T::ValueType>,
"T must be based on int64_t!");
460 explicit DynInt64IntrospectableView(View<T> value) :
466 return Base::getValue();
473 template <
typename T,
typename ALLOC>
474 class DynUInt8IntrospectableView :
public UnsignedIntrospectableViewBase<View<T>, ALLOC>
477 using Base = UnsignedIntrospectableViewBase<View<T>, ALLOC>;
479 static_assert(std::is_same_v<uint8_t, typename T::ValueType>,
"T must be based on uint8_t!");
482 explicit DynUInt8IntrospectableView(View<T> value) :
488 return Base::getValue();
495 template <
typename T,
typename ALLOC>
496 class DynUInt16IntrospectableView :
public UnsignedIntrospectableViewBase<View<T>, ALLOC>
499 using Base = UnsignedIntrospectableViewBase<View<T>, ALLOC>;
501 static_assert(std::is_same_v<uint16_t, typename T::ValueType>,
"T must be based on uint16_t!");
504 explicit DynUInt16IntrospectableView(View<T> value) :
510 return Base::getValue();
517 template <
typename T,
typename ALLOC>
518 class DynUInt32IntrospectableView :
public UnsignedIntrospectableViewBase<View<T>, ALLOC>
521 using Base = UnsignedIntrospectableViewBase<View<T>, ALLOC>;
523 static_assert(std::is_same_v<uint32_t, typename T::ValueType>,
"T must be based on uint32_t!");
526 explicit DynUInt32IntrospectableView(View<T> value) :
532 return Base::getValue();
539 template <
typename T,
typename ALLOC>
540 class DynUInt64IntrospectableView :
public UnsignedIntrospectableViewBase<View<T>, ALLOC>
543 using Base = UnsignedIntrospectableViewBase<View<T>, ALLOC>;
545 static_assert(std::is_same_v<uint64_t, typename T::ValueType>,
"T must be based on uint64_t!");
548 explicit DynUInt64IntrospectableView(View<T> value) :
554 return Base::getValue();
561 template <
typename T,
typename ALLOC>
562 class FloatingPointIntrospectableViewBase :
public IntrospectableViewBase<T, ALLOC>
565 static_assert(std::is_floating_point_v<typename T::ValueType>,
"T must be a floating point type!");
567 using Base = IntrospectableViewBase<T, ALLOC>;
573 return static_cast<double>(Base::getValue());
580 template <
typename T,
typename ALLOC>
581 class FloatIntrospectableView :
public FloatingPointIntrospectableViewBase<T, ALLOC>
584 using Base = FloatingPointIntrospectableViewBase<T, ALLOC>;
587 explicit FloatIntrospectableView(T value) :
593 return Base::getValue();
600 template <
typename ALLOC>
601 class DoubleIntrospectableView :
public FloatingPointIntrospectableViewBase<Float64, ALLOC>
604 using Base = FloatingPointIntrospectableViewBase<Float64, ALLOC>;
607 explicit DoubleIntrospectableView(
Float64 value) :
613 return Base::getValue();
620 template <
typename ALLOC>
621 class BytesIntrospectableView :
public IntrospectableViewBase<BytesView, ALLOC>
624 using Base = IntrospectableViewBase<BytesView, ALLOC>;
627 explicit BytesIntrospectableView(
BytesView value) :
633 return Base::getValue();
640 template <
typename ALLOC>
641 class StringIntrospectableView :
public IntrospectableViewBase<std::string_view, ALLOC>
644 using Base = IntrospectableViewBase<std::string_view, ALLOC>;
647 explicit StringIntrospectableView(std::string_view value) :
653 return Base::getValue();
656 BasicString<RebindAlloc<ALLOC, char>>
toString(
const ALLOC& allocator)
const override
665 template <
typename ALLOC>
666 class BitBufferIntrospectableView :
public IntrospectableViewBase<BasicBitBufferView<ALLOC>, ALLOC>
669 using Base = IntrospectableViewBase<BasicBitBufferView<ALLOC>, ALLOC>;
672 explicit BitBufferIntrospectableView(BasicBitBufferView<ALLOC> value) :
673 Base(
typeInfo<BasicBitBuffer<ALLOC>>(), value)
676 const BasicBitBuffer<ALLOC>&
getBitBuffer()
const override
678 return Base::getValue();
684 template <
typename ALLOC = std::allocator<u
int8_t>>
687 return std::allocate_shared<detail::BoolIntrospectableView<ALLOC>>(allocator, value);
690 template <BitSize BIT_SIZE,
bool IS_SIGNED,
typename ALLOC = std::allocator<u
int8_t>>
692 detail::FixedIntWrapper<BIT_SIZE, IS_SIGNED> value,
const ALLOC& allocator = ALLOC())
694 using Type = detail::FixedIntWrapper<BIT_SIZE, IS_SIGNED>;
695 using ValueType =
typename Type::ValueType;
697 if constexpr (IS_SIGNED)
699 if constexpr (
sizeof(ValueType) > 4)
701 return std::allocate_shared<detail::Int64IntrospectableView<Type, ALLOC>>(allocator, value);
703 else if constexpr (
sizeof(ValueType) > 2)
705 return std::allocate_shared<detail::Int32IntrospectableView<Type, ALLOC>>(allocator, value);
707 else if constexpr (
sizeof(ValueType) > 1)
709 return std::allocate_shared<detail::Int16IntrospectableView<Type, ALLOC>>(allocator, value);
713 return std::allocate_shared<detail::Int8IntrospectableView<Type, ALLOC>>(allocator, value);
718 if constexpr (
sizeof(ValueType) > 4)
720 return std::allocate_shared<detail::UInt64IntrospectableView<Type, ALLOC>>(allocator, value);
722 else if constexpr (
sizeof(ValueType) > 2)
724 return std::allocate_shared<detail::UInt32IntrospectableView<Type, ALLOC>>(allocator, value);
726 else if constexpr (
sizeof(ValueType) > 1)
728 return std::allocate_shared<detail::UInt16IntrospectableView<Type, ALLOC>>(allocator, value);
732 return std::allocate_shared<detail::UInt8IntrospectableView<Type, ALLOC>>(allocator, value);
737 template <
typename T,
typename ALLOC = std::allocator<u
int8_t>>
739 const View<detail::DynIntWrapper<T>>& value,
const ALLOC& allocator = ALLOC())
741 using Type = detail::DynIntWrapper<T>;
743 if constexpr (std::is_signed_v<T>)
745 if constexpr (
sizeof(T) > 4)
747 return std::allocate_shared<detail::DynInt64IntrospectableView<Type, ALLOC>>(allocator, value);
749 else if constexpr (
sizeof(T) > 2)
751 return std::allocate_shared<detail::DynInt32IntrospectableView<Type, ALLOC>>(allocator, value);
753 else if constexpr (
sizeof(T) > 1)
755 return std::allocate_shared<detail::DynInt16IntrospectableView<Type, ALLOC>>(allocator, value);
759 return std::allocate_shared<detail::DynInt8IntrospectableView<Type, ALLOC>>(allocator, value);
764 if constexpr (
sizeof(T) > 4)
766 return std::allocate_shared<detail::DynUInt64IntrospectableView<Type, ALLOC>>(allocator, value);
768 else if constexpr (
sizeof(T) > 2)
770 return std::allocate_shared<detail::DynUInt32IntrospectableView<Type, ALLOC>>(allocator, value);
772 else if constexpr (
sizeof(T) > 1)
774 return std::allocate_shared<detail::DynUInt16IntrospectableView<Type, ALLOC>>(allocator, value);
778 return std::allocate_shared<detail::DynUInt8IntrospectableView<Type, ALLOC>>(allocator, value);
783 template <
typename ALLOC = std::allocator<u
int8_t>>
786 return std::allocate_shared<detail::Int16IntrospectableView<VarInt16, ALLOC>>(allocator, value);
789 template <
typename ALLOC = std::allocator<u
int8_t>>
792 return std::allocate_shared<detail::Int32IntrospectableView<VarInt32, ALLOC>>(allocator, value);
795 template <
typename ALLOC = std::allocator<u
int8_t>>
798 return std::allocate_shared<detail::Int64IntrospectableView<VarInt64, ALLOC>>(allocator, value);
801 template <
typename ALLOC = std::allocator<u
int8_t>>
802 IBasicIntrospectableViewConstPtr<ALLOC>
introspectable(
VarInt value,
const ALLOC& allocator = ALLOC())
804 return std::allocate_shared<detail::Int64IntrospectableView<VarInt, ALLOC>>(allocator, value);
807 template <
typename ALLOC = std::allocator<u
int8_t>>
810 return std::allocate_shared<detail::UInt16IntrospectableView<VarUInt16, ALLOC>>(allocator, value);
813 template <
typename ALLOC = std::allocator<u
int8_t>>
816 return std::allocate_shared<detail::UInt32IntrospectableView<VarUInt32, ALLOC>>(allocator, value);
819 template <
typename ALLOC = std::allocator<u
int8_t>>
822 return std::allocate_shared<detail::UInt64IntrospectableView<VarUInt64, ALLOC>>(allocator, value);
825 template <
typename ALLOC = std::allocator<u
int8_t>>
826 IBasicIntrospectableViewConstPtr<ALLOC>
introspectable(
VarUInt value,
const ALLOC& allocator = ALLOC())
828 return std::allocate_shared<detail::UInt64IntrospectableView<VarUInt, ALLOC>>(allocator, value);
831 template <
typename ALLOC = std::allocator<u
int8_t>>
832 IBasicIntrospectableViewConstPtr<ALLOC>
introspectable(
VarSize value,
const ALLOC& allocator = ALLOC())
834 return std::allocate_shared<detail::UInt32IntrospectableView<VarSize, ALLOC>>(allocator, value);
837 template <
typename ALLOC = std::allocator<u
int8_t>>
840 return std::allocate_shared<detail::FloatIntrospectableView<Float16, ALLOC>>(allocator, value);
843 template <
typename ALLOC = std::allocator<u
int8_t>>
844 IBasicIntrospectableViewConstPtr<ALLOC>
introspectable(
Float32 value,
const ALLOC& allocator = ALLOC())
846 return std::allocate_shared<detail::FloatIntrospectableView<Float32, ALLOC>>(allocator, value);
849 template <
typename ALLOC = std::allocator<u
int8_t>>
850 IBasicIntrospectableViewConstPtr<ALLOC>
introspectable(
Float64 value,
const ALLOC& allocator = ALLOC())
852 return std::allocate_shared<detail::DoubleIntrospectableView<ALLOC>>(allocator, value);
855 template <
typename ALLOC = std::allocator<u
int8_t>>
858 return std::allocate_shared<detail::BytesIntrospectableView<ALLOC>>(allocator, value);
861 template <
typename ALLOC = std::allocator<u
int8_t>>
864 return std::allocate_shared<detail::StringIntrospectableView<ALLOC>>(allocator, value);
867 template <
typename ALLOC = std::allocator<u
int8_t>>
871 return std::allocate_shared<detail::BitBufferIntrospectableView<ALLOC>>(allocator, value);
880 template <
typename ARRAY_VIEW,
typename ALLOC>
881 class IntrospectableViewArray :
public IntrospectableViewBase<ARRAY_VIEW, ALLOC>,
public AllocatorHolder<ALLOC>
884 using Base = IntrospectableViewBase<ARRAY_VIEW, ALLOC>;
887 using Base::getTypeInfo;
890 explicit IntrospectableViewArray(
const ARRAY_VIEW& value,
const ALLOC& allocator = {}) :
891 Base(typeInfo<typename ARRAY_VIEW::ValueType, ALLOC>(), value),
892 AllocatorHolder<ALLOC>(allocator)
900 IBasicIntrospectableViewConstPtr<ALLOC>
getField(std::string_view)
const override
905 std::string_view
getChoice()
const override
910 size_t size()
const override
912 return Base::getValue().size();
915 IBasicIntrospectableViewConstPtr<ALLOC>
at(
size_t index)
const override
920 IBasicIntrospectableViewConstPtr<ALLOC>
operator[](
size_t index)
const override
922 return this->
at(index);
925 BasicAny<ALLOC>
getAnyValue(
const ALLOC& allocator)
const override
927 return BasicAny<ALLOC>(Base::getValue(), allocator);
935 int8_t
getInt8()
const override
995 const BasicBitBuffer<ALLOC>&
getBitBuffer()
const override
1000 int64_t
toInt()
const override
1005 uint64_t
toUInt()
const override
1015 BasicString<RebindAlloc<ALLOC, char>>
toString(
const ALLOC&)
const override
1020 IBasicIntrospectableViewConstPtr<ALLOC>
getParameter(std::string_view)
const override
1025 IBasicIntrospectableViewConstPtr<ALLOC>
callFunction(std::string_view)
const override
1030 BasicBitBuffer<ALLOC>
serialize(
const ALLOC&)
const override
1036 template <
typename T,
typename ALLOC>
1037 class CompoundIntrospectableViewBase
1038 :
public IntrospectableViewBase<View<T>, ALLOC>,
1039 public AllocatorHolder<ALLOC>
1042 using Base = IntrospectableViewBase<View<T>, ALLOC>;
1045 CompoundIntrospectableViewBase(
const View<T>& view,
const ALLOC& allocator) :
1050 BasicBitBuffer<ALLOC>
serialize(
const ALLOC& allocator)
const override
1056 template <
typename T,
typename ALLOC>
1057 IBasicIntrospectableViewConstPtr<ALLOC> IntrospectableViewBase<T, ALLOC>::getFieldFromObject(
1058 const IBasicIntrospectableView<ALLOC>&
object, std::string_view name)
const
1060 const auto&
typeInfo =
object.getTypeInfo();
1065 std::find_if(fields.begin(), fields.end(), [name](
const BasicFieldInfo<ALLOC>& fieldInfo) {
1066 return fieldInfo.schemaName == name;
1068 if (fieldsIt != fields.end())
1070 return object.getField(name);
1077 template <
typename T,
typename ALLOC>
1078 IBasicIntrospectableViewConstPtr<ALLOC> IntrospectableViewBase<T, ALLOC>::getParameterFromObject(
1079 const IBasicIntrospectableView<ALLOC>&
object, std::string_view name)
const
1081 const auto&
typeInfo =
object.getTypeInfo();
1085 auto parametersIt = std::find_if(
1086 parameters.begin(), parameters.end(), [name](
const BasicParameterInfo<ALLOC>& parameterInfo) {
1087 return parameterInfo.schemaName == name;
1089 if (parametersIt != parameters.end())
1091 return object.getParameter(name);
1098 template <
typename T,
typename ALLOC>
1099 IBasicIntrospectableViewConstPtr<ALLOC> IntrospectableViewBase<T, ALLOC>::callFunctionInObject(
1100 const IBasicIntrospectableView<ALLOC>&
object, std::string_view name)
const
1102 const auto&
typeInfo =
object.getTypeInfo();
1106 auto functionsIt = std::find_if(
1107 functions.begin(), functions.end(), [name](
const BasicFunctionInfo<ALLOC>& functionInfo) {
1108 return functionInfo.schemaName == name;
1110 if (functionsIt != functions.end())
1112 return object.callFunction(name);
1119 template <
typename T,
typename ALLOC>
1120 IBasicIntrospectableViewConstPtr<ALLOC> IntrospectableViewBase<T, ALLOC>::getFromObject(
1121 const IBasicIntrospectableView<ALLOC>&
object, std::string_view path,
size_t pos)
const
1125 const size_t dotPos = path.find(
'.', pos);
1126 const bool isLast = dotPos == std::string_view::npos;
1127 const std::string_view name =
1128 path.substr(pos, dotPos == std::string_view::npos ? std::string_view::npos : dotPos - pos);
1130 auto field = getFieldFromObject(
object, name);
1133 return isLast ? std::move(field) : getFromObject(*field, path, dotPos + 1);
1136 auto parameter = getParameterFromObject(
object, name);
1139 return isLast ? std::move(parameter) : getFromObject(*parameter, path, dotPos + 1);
1142 auto functionResult = callFunctionInObject(
object, name);
1145 return isLast ? std::move(functionResult) : getFromObject(*functionResult, path, dotPos + 1);
1148 catch (
const CppRuntimeException&)
1156 template <
typename T,
typename TRAITS,
typename ALLOC = std::allocator<u
int8_t>>
1160 return std::allocate_shared<detail::IntrospectableViewArray<ArrayView<T, TRAITS>, ALLOC>>(allocator, value);
allocator_type get_allocator() const
virtual ConstPtr getParameter(std::string_view name) const =0
virtual ConstPtr callFunction(std::string_view name) const =0
typename IIntrospectableData< IBasicIntrospectableView< ALLOC >, ALLOC >::ConstPtr ConstPtr
virtual Span< const BasicFieldInfo< ALLOC > > getFields() const =0
virtual Span< const BasicParameterInfo< ALLOC > > getParameters() const =0
virtual Span< const BasicFunctionInfo< ALLOC > > getFunctions() const =0
virtual SchemaType getSchemaType() const =0
virtual std::string_view getSchemaName() const =0
virtual std::string_view getStringView() const=0
virtual int32_t getInt32() const=0
virtual uint8_t getUInt8() const=0
virtual float getFloat() const=0
virtual int8_t getInt8() const=0
virtual bool isArray() const=0
virtual double getDouble() const=0
virtual size_t size() const=0
virtual const IBasicTypeInfo< std::allocator< uint8_t > > & getTypeInfo() const=0
virtual BytesView getBytes() const=0
virtual int64_t toInt() const=0
virtual uint64_t toUInt() const=0
virtual uint32_t getUInt32() const=0
virtual ConstPtr find(std::string_view path) const=0
virtual int64_t getInt64() const=0
virtual ConstPtr operator[](size_t index) const=0
virtual uint64_t getUInt64() const=0
virtual int16_t getInt16() const=0
virtual ConstPtr at(size_t index) const=0
virtual uint16_t getUInt16() const=0
virtual bool getBool() const=0
virtual BasicAny< std::allocator< uint8_t > > getAnyValue(const std::allocator< uint8_t > &allocator) const=0
virtual const BasicBitBuffer< std::allocator< uint8_t > > & getBitBuffer() const=0
virtual std::string_view getChoice() const=0
virtual ConstPtr getField(std::string_view name) const=0
virtual double toDouble() const=0
Span< const uint8_t > BytesView
IBasicIntrospectableViewConstPtr< ALLOC > introspectable(const View< T > &view, const ALLOC &allocator=ALLOC())
IBasicIntrospectableViewConstPtr< ALLOC > introspectableArray(ArrayView< T, TRAITS > value, const ALLOC &allocator=ALLOC())
detail::VarIntWrapper< uint64_t, detail::VarIntType::VAR > VarUInt
std::basic_string< char, std::char_traits< char >, ALLOC > BasicString
detail::FloatWrapper< float, detail::FloatType::FLOAT16 > Float16
std::vector< uint8_t, ALLOC > BasicBytes
detail::FloatWrapper< float, detail::FloatType::FLOAT32 > Float32
detail::VarIntWrapper< int32_t, detail::VarIntType::VAR32 > VarInt32
BasicBitBuffer< ALLOC > serialize(const T &data, const ALLOC &allocator, ARGS &&... arguments)
typename std::allocator_traits< ALLOC >::template rebind_alloc< T > RebindAlloc
detail::VarIntWrapper< uint16_t, detail::VarIntType::VAR16 > VarUInt16
detail::VarIntWrapper< uint64_t, detail::VarIntType::VAR64 > VarUInt64
const IBasicTypeInfo< ALLOC > & typeInfo()
BasicString< RebindAlloc< ALLOC, char > > toString(T value, const ALLOC &allocator=ALLOC())
typename IBasicIntrospectableView< ALLOC >::ConstPtr IBasicIntrospectableViewConstPtr
detail::VarIntWrapper< int16_t, detail::VarIntType::VAR16 > VarInt16
detail::FloatWrapper< double, detail::FloatType::FLOAT64 > Float64
detail::VarIntWrapper< uint32_t, detail::VarIntType::VAR32 > VarUInt32
std::reference_wrapper< const BasicBitBuffer< ALLOC > > BasicBitBufferView
detail::VarIntWrapper< int64_t, detail::VarIntType::VAR > VarInt
detail::VarIntWrapper< int64_t, detail::VarIntType::VAR64 > VarInt64
detail::VarIntWrapper< uint32_t, detail::VarIntType::VARSIZE > VarSize
static bool isCompound(SchemaType schemaType)