Zserio C++ runtime library  1.0.2
Built for Zserio 2.14.1
zserio::IBasicReflectable< ALLOC > Class Template Referenceabstract

#include <IReflectable.h>

Public Types

using Ptr = std::shared_ptr< IBasicReflectable >
 
using ConstPtr = std::shared_ptr< const IBasicReflectable >
 

Public Member Functions

virtual ~IBasicReflectable ()=default
 
virtual const IBasicTypeInfo< ALLOC > & getTypeInfo () const =0
 
virtual bool isArray () const =0
 
virtual void initializeChildren ()=0
 
virtual void initialize (const vector< AnyHolder< ALLOC >, ALLOC > &typeArguments)=0
 
virtual size_t initializeOffsets (size_t bitPosition)=0
 
virtual size_t initializeOffsets ()=0
 
virtual size_t bitSizeOf (size_t bitPosition) const =0
 
virtual size_t bitSizeOf () const =0
 
virtual void write (BitStreamWriter &writer) const =0
 
virtual void setField (StringView name, const AnyHolder< ALLOC > &value)=0
 
virtual Ptr createField (StringView name)=0
 
virtual StringView getChoice () const =0
 
virtual size_t size () const =0
 
virtual void resize (size_t size)=0
 
virtual void setAt (const AnyHolder< ALLOC > &value, size_t index)=0
 
virtual void append (const AnyHolder< ALLOC > &value)=0
 
virtual bool getBool () const =0
 
virtual int8_t getInt8 () const =0
 
virtual int16_t getInt16 () const =0
 
virtual int32_t getInt32 () const =0
 
virtual int64_t getInt64 () const =0
 
virtual uint8_t getUInt8 () const =0
 
virtual uint16_t getUInt16 () const =0
 
virtual uint32_t getUInt32 () const =0
 
virtual uint64_t getUInt64 () const =0
 
virtual float getFloat () const =0
 
virtual double getDouble () const =0
 
virtual Span< const uint8_t > getBytes () const =0
 
virtual StringView getStringView () const =0
 
virtual const BasicBitBuffer< ALLOC > & getBitBuffer () const =0
 
virtual int64_t toInt () const =0
 
virtual uint64_t toUInt () const =0
 
virtual double toDouble () const =0
 
virtual ConstPtr getField (StringView name) const =0
 
virtual Ptr getField (StringView name)=0
 
virtual ConstPtr getParameter (StringView name) const =0
 
virtual Ptr getParameter (StringView name)=0
 
virtual ConstPtr callFunction (StringView name) const =0
 
virtual Ptr callFunction (StringView name)=0
 
virtual ConstPtr find (StringView path) const =0
 
virtual Ptr find (StringView path)=0
 
virtual ConstPtr operator[] (StringView path) const =0
 
virtual Ptr operator[] (StringView path)=0
 
virtual ConstPtr at (size_t index) const =0
 
virtual Ptr at (size_t index)=0
 
virtual ConstPtr operator[] (size_t index) const =0
 
virtual Ptr operator[] (size_t index)=0
 
virtual AnyHolder< ALLOC > getAnyValue (const ALLOC &allocator) const =0
 
virtual AnyHolder< ALLOC > getAnyValue (const ALLOC &allocator)=0
 
virtual AnyHolder< ALLOC > getAnyValue () const =0
 
virtual AnyHolder< ALLOC > getAnyValue ()=0
 
virtual string< ALLOC > toString (const ALLOC &allocator) const =0
 
virtual string< ALLOC > toString () const =0
 

Detailed Description

template<typename ALLOC = std::allocator<uint8_t>>
class zserio::IBasicReflectable< ALLOC >

Interface for reflectable view to instances of zserio objects.

Note
Users are responsible to maintain life-time of reflected objects which must exist as long as the views are used.
The object in this context may be also an instance of a built-in type.

Definition at line 31 of file IReflectable.h.

Member Typedef Documentation

◆ ConstPtr

template<typename ALLOC = std::allocator<uint8_t>>
using zserio::IBasicReflectable< ALLOC >::ConstPtr = std::shared_ptr<const IBasicReflectable>

Shared pointer to the constant reflectable interface.

Definition at line 38 of file IReflectable.h.

◆ Ptr

template<typename ALLOC = std::allocator<uint8_t>>
using zserio::IBasicReflectable< ALLOC >::Ptr = std::shared_ptr<IBasicReflectable>

Shared pointer to the reflectable interface.

Definition at line 35 of file IReflectable.h.

Constructor & Destructor Documentation

◆ ~IBasicReflectable()

template<typename ALLOC = std::allocator<uint8_t>>
virtual zserio::IBasicReflectable< ALLOC >::~IBasicReflectable ( )
virtualdefault

Destructor.

Member Function Documentation

◆ append()

◆ at() [1/2]

◆ at() [2/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual Ptr zserio::IBasicReflectable< ALLOC >::at ( size_t  index)
pure virtual

◆ bitSizeOf() [1/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual size_t zserio::IBasicReflectable< ALLOC >::bitSizeOf ( ) const
pure virtual

Gets the number of bits needed for serialization of the reflected object.

The bit stream position to be used for calculation is defaulted to zero.

Note
Works for all reflectable types except arrays!
Exceptions
CppRuntimeExceptionWhen the reflected object is an array.
Returns
The size of the serialized reflected object in bits.

Implemented in zserio::ReflectableOwner< T, ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ bitSizeOf() [2/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual size_t zserio::IBasicReflectable< ALLOC >::bitSizeOf ( size_t  bitPosition) const
pure virtual

Gets the number of bits needed for serialization of the reflected object.

Note
Works for all reflectable types except arrays!
Parameters
bitPositionThe bit stream position to be used for calculation.
Exceptions
CppRuntimeExceptionWhen the reflected object is an array.
Returns
The size of the serialized reflected object in bits.

Implemented in zserio::BitBufferReflectable< ALLOC >, zserio::StringReflectable< ALLOC >, zserio::BytesReflectable< ALLOC >, zserio::Float64Reflectable< ALLOC >, zserio::Float32Reflectable< ALLOC >, zserio::Float16Reflectable< ALLOC >, zserio::VarSizeReflectable< ALLOC >, zserio::VarUIntReflectable< ALLOC >, zserio::VarUInt64Reflectable< ALLOC >, zserio::VarUInt32Reflectable< ALLOC >, zserio::VarUInt16Reflectable< ALLOC >, zserio::VarIntReflectable< ALLOC >, zserio::VarInt64Reflectable< ALLOC >, zserio::VarInt32Reflectable< ALLOC >, zserio::VarInt16Reflectable< ALLOC >, zserio::DynamicUnsignedBitFieldReflectable< ALLOC, uint64_t >, zserio::DynamicUnsignedBitFieldReflectable< ALLOC, uint32_t >, zserio::DynamicUnsignedBitFieldReflectable< ALLOC, uint16_t >, zserio::DynamicUnsignedBitFieldReflectable< ALLOC, uint8_t >, zserio::DynamicSignedBitFieldReflectable< ALLOC, int64_t >, zserio::DynamicSignedBitFieldReflectable< ALLOC, int32_t >, zserio::DynamicSignedBitFieldReflectable< ALLOC, int16_t >, zserio::DynamicSignedBitFieldReflectable< ALLOC, int8_t >, zserio::FixedUnsignedBitFieldReflectable< ALLOC, uint64_t >, zserio::FixedUnsignedBitFieldReflectable< ALLOC, uint32_t >, zserio::FixedUnsignedBitFieldReflectable< ALLOC, uint16_t >, zserio::FixedUnsignedBitFieldReflectable< ALLOC, uint8_t >, zserio::FixedSignedBitFieldReflectable< ALLOC, int64_t >, zserio::FixedSignedBitFieldReflectable< ALLOC, int32_t >, zserio::FixedSignedBitFieldReflectable< ALLOC, int16_t >, zserio::FixedSignedBitFieldReflectable< ALLOC, int8_t >, zserio::UInt64Reflectable< ALLOC >, zserio::UInt32Reflectable< ALLOC >, zserio::UInt16Reflectable< ALLOC >, zserio::UInt8Reflectable< ALLOC >, zserio::Int64Reflectable< ALLOC >, zserio::Int32Reflectable< ALLOC >, zserio::Int16Reflectable< ALLOC >, zserio::Int8Reflectable< ALLOC >, zserio::BoolReflectable< ALLOC >, zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ callFunction() [1/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual ConstPtr zserio::IBasicReflectable< ALLOC >::callFunction ( StringView  name) const
pure virtual

Calls function with the given name on the reflected zserio object and gets reflectable view to its result.

Note
Can be called only when the reflected object is a zserio compound type.
Parameters
nameFunction schema name.
Returns
Reflectable view to the value returns from the called function.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound type or when the function with the given name doesn't exist or the the function call itself throws.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ callFunction() [2/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual Ptr zserio::IBasicReflectable< ALLOC >::callFunction ( StringView  name)
pure virtual

Calls function with the given name on the reflected zserio object and gets reflectable view to its result.

Note
Can be called only when the reflected object is a zserio compound type.
Parameters
nameFunction schema name.
Returns
Reflectable view to the value returns from the called function.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound type or when the function with the given name doesn't exist or the the function call itself throws.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::ReflectableConstAllocatorHolderBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ createField()

template<typename ALLOC = std::allocator<uint8_t>>
virtual Ptr zserio::IBasicReflectable< ALLOC >::createField ( StringView  name)
pure virtual

Creates a default constructed field within current object and returns reflectable pointer to it.

Note
When the field already exists, it's reset with the new default constructed value.
Parameters
nameName of the optional field to create.
Returns
Reflectable to just created object.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound type or when the field with the given name doesn't exists.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ find() [1/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual ConstPtr zserio::IBasicReflectable< ALLOC >::find ( StringView  path) const
pure virtual

Universal accessor to zserio entities within the zserio sub-tree represented by the reflected object.

Supports dot notation corresponding to the tree defined in zserio language. Can access fields or parameters or call functions within the zserio sub-tree.

Examples:

  • 'fieldA.param' - Gets reflectable view to parameter 'param' within the parameterized field 'fieldA'.
  • 'child.getValue' - Gets reflectable view to result of the function called on field ̈́'child'.
  • 'child.nonexisting.field' - Gets nullptr since the path doesn't represent a valid entity.
Parameters
pathDot notation corresponding to the zserio tree.
Returns
Reflectable view to the result of the given path. Returns nullptr when the path doesn't exist or when the requested operation throws CppRuntimeException.

Implemented in zserio::ReflectableOwner< T, ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ find() [2/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual Ptr zserio::IBasicReflectable< ALLOC >::find ( StringView  path)
pure virtual

Universal accessor to zserio entities within the zserio sub-tree represented by the reflected object.

Supports dot notation corresponding to the tree defined in zserio language. Can access fields or parameters or call functions within the zserio sub-tree.

Examples:

  • 'fieldA.param' - Gets reflectable view to parameter 'param' within the parameterized field 'fieldA'.
  • 'child.getValue' - Gets reflectable view to result of the function called on field ̈́'child'.
  • 'child.nonexisting.field' - Gets nullptr since the path doesn't represent a valid entity.
Parameters
pathDot notation corresponding to the zserio tree.
Returns
Reflectable view to the result of the given path. Returns nullptr when the path doesn't exist or when the requested operation throws CppRuntimeException.

Implemented in zserio::ReflectableOwner< T, ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getAnyValue() [1/4]

template<typename ALLOC = std::allocator<uint8_t>>
virtual AnyHolder<ALLOC> zserio::IBasicReflectable< ALLOC >::getAnyValue ( ) const
pure virtual

Gets any value within the reflected object.

For builtin types, enums and bitmasks the value is "returned by value" - i.e. it's copied into the any holder, but note that for bytes the any holder contains Span, for string the any holder contains an appropriate StringView and for compounds, bit buffers and arrays the value is "returned by reference" - i.e. the any holder contains std::reference_wrapper<T> with the reference to the compound type or the raw array type.

Note
For bit buffers only const reference is available.
Overloads without parameter use default constructed allocator.
Parameters
allocatorAllocator to use for the value allocation.
Returns
Any value.

Implemented in zserio::ReflectableOwner< T, ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getAnyValue() [2/4]

template<typename ALLOC = std::allocator<uint8_t>>
virtual AnyHolder<ALLOC> zserio::IBasicReflectable< ALLOC >::getAnyValue ( )
pure virtual

Gets any value within the reflected object.

For builtin types, enums and bitmasks the value is "returned by value" - i.e. it's copied into the any holder, but note that for bytes the any holder contains Span, for string the any holder contains an appropriate StringView and for compounds, bit buffers and arrays the value is "returned by reference" - i.e. the any holder contains std::reference_wrapper<T> with the reference to the compound type or the raw array type.

Note
For bit buffers only const reference is available.
Overloads without parameter use default constructed allocator.
Parameters
allocatorAllocator to use for the value allocation.
Returns
Any value.

Implemented in zserio::ReflectableOwner< T, ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getAnyValue() [3/4]

template<typename ALLOC = std::allocator<uint8_t>>
virtual AnyHolder<ALLOC> zserio::IBasicReflectable< ALLOC >::getAnyValue ( const ALLOC &  allocator) const
pure virtual

Gets any value within the reflected object.

For builtin types, enums and bitmasks the value is "returned by value" - i.e. it's copied into the any holder, but note that for bytes the any holder contains Span, for string the any holder contains an appropriate StringView and for compounds, bit buffers and arrays the value is "returned by reference" - i.e. the any holder contains std::reference_wrapper<T> with the reference to the compound type or the raw array type.

Note
For bit buffers only const reference is available.
Overloads without parameter use default constructed allocator.
Parameters
allocatorAllocator to use for the value allocation.
Returns
Any value.

Implemented in zserio::EnumReflectableArray< ALLOC, RAW_ARRAY >, zserio::EnumReflectableConstArray< ALLOC, RAW_ARRAY >, zserio::BitmaskReflectableArray< ALLOC, RAW_ARRAY >, zserio::BitmaskReflectableConstArray< ALLOC, RAW_ARRAY >, zserio::CompoundReflectableArray< ALLOC, RAW_ARRAY >, zserio::CompoundReflectableConstArray< ALLOC, RAW_ARRAY >, zserio::DynamicBitFieldReflectableArray< ALLOC, RAW_ARRAY, ELEMENT_REFLECTABLE >, zserio::DynamicBitFieldReflectableConstArray< ALLOC, RAW_ARRAY, ELEMENT_REFLECTABLE >, zserio::FixedBitFieldReflectableArray< ALLOC, RAW_ARRAY, ELEMENT_REFLECTABLE >, zserio::FixedBitFieldReflectableConstArray< ALLOC, RAW_ARRAY, ELEMENT_REFLECTABLE >, zserio::BuiltinReflectableArray< ALLOC, RAW_ARRAY, ELEMENT_REFLECTABLE >, zserio::BuiltinReflectableConstArray< ALLOC, RAW_ARRAY, ELEMENT_REFLECTABLE >, zserio::BuiltinReflectableBase< ALLOC, T, typename std::enable_if< std::is_arithmetic< T >::value||std::is_same< T, StringView >::value||is_span< T >::value >::type >, zserio::BuiltinReflectableBase< ALLOC, T, typename >, zserio::BuiltinReflectableBase< ALLOC, StringView >, zserio::BuiltinReflectableBase< ALLOC, Span< const uint8_t > >, zserio::BuiltinReflectableBase< ALLOC, BasicBitBuffer< ALLOC > >, and zserio::ReflectableBase< ALLOC >.

◆ getAnyValue() [4/4]

template<typename ALLOC = std::allocator<uint8_t>>
virtual AnyHolder<ALLOC> zserio::IBasicReflectable< ALLOC >::getAnyValue ( const ALLOC &  allocator)
pure virtual

Gets any value within the reflected object.

For builtin types, enums and bitmasks the value is "returned by value" - i.e. it's copied into the any holder, but note that for bytes the any holder contains Span, for string the any holder contains an appropriate StringView and for compounds, bit buffers and arrays the value is "returned by reference" - i.e. the any holder contains std::reference_wrapper<T> with the reference to the compound type or the raw array type.

Note
For bit buffers only const reference is available.
Overloads without parameter use default constructed allocator.
Parameters
allocatorAllocator to use for the value allocation.
Returns
Any value.

Implemented in zserio::EnumReflectableArray< ALLOC, RAW_ARRAY >, zserio::BitmaskReflectableArray< ALLOC, RAW_ARRAY >, zserio::CompoundReflectableArray< ALLOC, RAW_ARRAY >, zserio::DynamicBitFieldReflectableArray< ALLOC, RAW_ARRAY, ELEMENT_REFLECTABLE >, zserio::FixedBitFieldReflectableArray< ALLOC, RAW_ARRAY, ELEMENT_REFLECTABLE >, zserio::BuiltinReflectableArray< ALLOC, RAW_ARRAY, ELEMENT_REFLECTABLE >, zserio::ReflectableConstArrayBase< ALLOC >, zserio::ReflectableConstAllocatorHolderBase< ALLOC >, zserio::BuiltinReflectableBase< ALLOC, T, typename std::enable_if< std::is_arithmetic< T >::value||std::is_same< T, StringView >::value||is_span< T >::value >::type >, zserio::BuiltinReflectableBase< ALLOC, T, typename >, zserio::BuiltinReflectableBase< ALLOC, StringView >, zserio::BuiltinReflectableBase< ALLOC, Span< const uint8_t > >, zserio::BuiltinReflectableBase< ALLOC, BasicBitBuffer< ALLOC > >, and zserio::ReflectableBase< ALLOC >.

◆ getBitBuffer()

template<typename ALLOC = std::allocator<uint8_t>>
virtual const BasicBitBuffer<ALLOC>& zserio::IBasicReflectable< ALLOC >::getBitBuffer ( ) const
pure virtual

Gets reference to the reflected bit buffer.

Returns
Reference to the bit buffer.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a bit buffer (i.e. extern type).

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::BitBufferReflectable< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getBool()

template<typename ALLOC = std::allocator<uint8_t>>
virtual bool zserio::IBasicReflectable< ALLOC >::getBool ( ) const
pure virtual

Gets bool value of the bool reflectable.

Returns
Bool value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a bool type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::BoolReflectable< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getBytes()

template<typename ALLOC = std::allocator<uint8_t>>
virtual Span<const uint8_t> zserio::IBasicReflectable< ALLOC >::getBytes ( ) const
pure virtual

Gets byte value of the bytes reflectable.

Returns
Bytes value as a span.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a bytes type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::BytesReflectable< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getChoice()

template<typename ALLOC = std::allocator<uint8_t>>
virtual StringView zserio::IBasicReflectable< ALLOC >::getChoice ( ) const
pure virtual

Gets name of the field which is active in the reflected choice type.

Note
Applicable only on zserio unions and choices.
Returns
Name of the active field (i.e. currently selected choice).
Exceptions
CppRuntimeExceptionWhen the reflected object is not a choice type (or union).

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getDouble()

template<typename ALLOC = std::allocator<uint8_t>>
virtual double zserio::IBasicReflectable< ALLOC >::getDouble ( ) const
pure virtual

Gets double value of the double reflectable.

Returns
Double value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a double type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::Float64Reflectable< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getField() [1/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual ConstPtr zserio::IBasicReflectable< ALLOC >::getField ( StringView  name) const
pure virtual

Gets reflectable view to the field (i.e. member) with the given schema name.

Note
Can be called only when the reflected object is a zserio compound type.
Parameters
nameField schema name.
Returns
Reflectable view to the requested field.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound type or when the field with the given name doesn't exist or when the field getter itself throws.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getField() [2/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual Ptr zserio::IBasicReflectable< ALLOC >::getField ( StringView  name)
pure virtual

Gets reflectable view to the field (i.e. member) with the given schema name.

Note
Can be called only when the reflected object is a zserio compound type.
Parameters
nameField schema name.
Returns
Reflectable view to the requested field.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound type or when the field with the given name doesn't exist or when the field getter itself throws.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::ReflectableConstAllocatorHolderBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getFloat()

template<typename ALLOC = std::allocator<uint8_t>>
virtual float zserio::IBasicReflectable< ALLOC >::getFloat ( ) const
pure virtual

Gets float value of the float reflectable.

Returns
Float value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a float type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::Float32Reflectable< ALLOC >, zserio::Float16Reflectable< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getInt16()

template<typename ALLOC = std::allocator<uint8_t>>
virtual int16_t zserio::IBasicReflectable< ALLOC >::getInt16 ( ) const
pure virtual

Gets 16-bit signed integral value of the int16_t reflectable.

Returns
16-bit signed integral value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a int16_t type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::Int16ReflectableBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getInt32()

template<typename ALLOC = std::allocator<uint8_t>>
virtual int32_t zserio::IBasicReflectable< ALLOC >::getInt32 ( ) const
pure virtual

Gets 32-bit signed integral value of the int32_t reflectable.

Returns
32-bit signed integral value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a int32_t type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::Int32ReflectableBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getInt64()

template<typename ALLOC = std::allocator<uint8_t>>
virtual int64_t zserio::IBasicReflectable< ALLOC >::getInt64 ( ) const
pure virtual

Gets 64-bit signed integral value of the int64_t reflectable.

Returns
64-bit signed integral value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a int64_t type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::Int64ReflectableBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getInt8()

template<typename ALLOC = std::allocator<uint8_t>>
virtual int8_t zserio::IBasicReflectable< ALLOC >::getInt8 ( ) const
pure virtual

Gets 8-bit signed integral value of the int8_t reflectable.

Returns
8-bit signed integral value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a int8_t type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::Int8ReflectableBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getParameter() [1/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual ConstPtr zserio::IBasicReflectable< ALLOC >::getParameter ( StringView  name) const
pure virtual

Gets reflectable view to the parameter (i.e. member) with the given schema name.

Note
Can be called only when the reflected object is a zserio compound type.
Parameters
nameParameter schema name.
Returns
Reflectable view to the requested parameter.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound type or when the parameter with the given name doesn't exist or when the parameter getter itself throws.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getParameter() [2/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual Ptr zserio::IBasicReflectable< ALLOC >::getParameter ( StringView  name)
pure virtual

Gets reflectable view to the parameter (i.e. member) with the given schema name.

Note
Can be called only when the reflected object is a zserio compound type.
Parameters
nameParameter schema name.
Returns
Reflectable view to the requested parameter.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound type or when the parameter with the given name doesn't exist or when the parameter getter itself throws.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::ReflectableConstAllocatorHolderBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getStringView()

template<typename ALLOC = std::allocator<uint8_t>>
virtual StringView zserio::IBasicReflectable< ALLOC >::getStringView ( ) const
pure virtual

Gets reference to the string value of the string reflectable.

Returns
Reference to the string value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a string type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::StringReflectable< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getTypeInfo()

template<typename ALLOC = std::allocator<uint8_t>>
virtual const IBasicTypeInfo<ALLOC>& zserio::IBasicReflectable< ALLOC >::getTypeInfo ( ) const
pure virtual

Gets type info for the current zserio object.

Returns
Reference to the static instance of type info.

Implemented in zserio::ReflectableOwner< T, ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getUInt16()

template<typename ALLOC = std::allocator<uint8_t>>
virtual uint16_t zserio::IBasicReflectable< ALLOC >::getUInt16 ( ) const
pure virtual

Gets 16-bit unsigned integral value of the uint16_t reflectable.

Returns
16-bit unsigned integral value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a uint16_t type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::UInt16ReflectableBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getUInt32()

template<typename ALLOC = std::allocator<uint8_t>>
virtual uint32_t zserio::IBasicReflectable< ALLOC >::getUInt32 ( ) const
pure virtual

Gets 32-bit unsigned integral value of the uint32_t reflectable.

Returns
32-bit unsigned integral value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a uint32_t type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::UInt32ReflectableBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getUInt64()

template<typename ALLOC = std::allocator<uint8_t>>
virtual uint64_t zserio::IBasicReflectable< ALLOC >::getUInt64 ( ) const
pure virtual

Gets 64-bit unsigned integral value of the uint64_t reflectable.

Returns
64-bit unsigned integral value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a uint64_t type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::UInt64ReflectableBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ getUInt8()

template<typename ALLOC = std::allocator<uint8_t>>
virtual uint8_t zserio::IBasicReflectable< ALLOC >::getUInt8 ( ) const
pure virtual

Gets 8-bit unsigned integral value of the uint8_t reflectable.

Returns
8-bit unsigned integral value.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a uint8_t type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::UInt8ReflectableBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ initialize()

template<typename ALLOC = std::allocator<uint8_t>>
virtual void zserio::IBasicReflectable< ALLOC >::initialize ( const vector< AnyHolder< ALLOC >, ALLOC > &  typeArguments)
pure virtual

Initializes the reflected parameterized compound object. Calls initialize method on the generated C++ object. Note that the arguments must exactly match. In case that the argument is a compound type, which is normally passed as a reference, it must be wrapped in a reference wrapper.

Exceptions
CppRuntimeExceptionWhen the reflected object is not parameterized or when the arguments do not match.

Implemented in zserio::ReflectableArrayBase< ALLOC >, zserio::ReflectableConstAllocatorHolderBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ initializeChildren()

template<typename ALLOC = std::allocator<uint8_t>>
virtual void zserio::IBasicReflectable< ALLOC >::initializeChildren ( )
pure virtual

Initializes children of the reflected compound. Calls initializeChildren method on the generated C++ object, which recursively initializes the whole object tree. When nothing within the object tree is parameterized, does nothing.

Note
This method is designed to be called on the top level object (i.e. root).
Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound type.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::ReflectableConstAllocatorHolderBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ initializeOffsets() [1/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual size_t zserio::IBasicReflectable< ALLOC >::initializeOffsets ( )
pure virtual

Initializes indexed offsets of the reflected compound object.

The bit stream position to be used for calculation is defaulted to zero.

Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound.
Returns
Updated bit position which points to the first bit after the compound.

Implemented in zserio::ReflectableOwner< T, ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ initializeOffsets() [2/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual size_t zserio::IBasicReflectable< ALLOC >::initializeOffsets ( size_t  bitPosition)
pure virtual

Initializes indexed offsets of the reflected compound object.

Parameters
bitPositionThe bit stream position to be used for calculation.
Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound.
Returns
Updated bit position which points to the first bit after the compound.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::ReflectableConstAllocatorHolderBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ isArray()

template<typename ALLOC = std::allocator<uint8_t>>
virtual bool zserio::IBasicReflectable< ALLOC >::isArray ( ) const
pure virtual

Gets whether the reflected object is an array.

Returns
True when the object is an array, false otherwise.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ operator[]() [1/4]

template<typename ALLOC = std::allocator<uint8_t>>
virtual ConstPtr zserio::IBasicReflectable< ALLOC >::operator[] ( size_t  index) const
pure virtual

Gets reflectable view to an array element.

Note
Can be called only when the reflected object is an array.
Returns
Reflectable view to an array element on the given index.
Exceptions
CppRuntimeExceptionWhen the reflected object is not an array or when the given index is out of bounds of the underlying array.

Overloaded method provided for convenience.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ operator[]() [2/4]

template<typename ALLOC = std::allocator<uint8_t>>
virtual Ptr zserio::IBasicReflectable< ALLOC >::operator[] ( size_t  index)
pure virtual

Gets reflectable view to an array element.

Note
Can be called only when the reflected object is an array.
Returns
Reflectable view to an array element on the given index.
Exceptions
CppRuntimeExceptionWhen the reflected object is not an array or when the given index is out of bounds of the underlying array.

Overloaded method provided for convenience.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableConstArrayBase< ALLOC >, zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ operator[]() [3/4]

template<typename ALLOC = std::allocator<uint8_t>>
virtual ConstPtr zserio::IBasicReflectable< ALLOC >::operator[] ( StringView  path) const
pure virtual

Universal accessor to zserio entities within the zserio sub-tree represented by the reflected object.

Supports dot notation corresponding to the tree defined in zserio language. Can access fields or parameters or call functions within the zserio sub-tree.

Examples:

  • 'fieldA.param' - Gets reflectable view to parameter 'param' within the parameterized field 'fieldA'.
  • 'child.getValue' - Gets reflectable view to result of the function called on field ̈́'child'.
  • 'child.nonexisting.field' - Gets nullptr since the path doesn't represent a valid entity.
Parameters
pathDot notation corresponding to the zserio tree.
Returns
Reflectable view to the result of the given path. Returns nullptr when the path doesn't exist or when the requested operation throws CppRuntimeException.

Overloaded method provided for convenience.

Implemented in zserio::ReflectableOwner< T, ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ operator[]() [4/4]

template<typename ALLOC = std::allocator<uint8_t>>
virtual Ptr zserio::IBasicReflectable< ALLOC >::operator[] ( StringView  path)
pure virtual

Universal accessor to zserio entities within the zserio sub-tree represented by the reflected object.

Supports dot notation corresponding to the tree defined in zserio language. Can access fields or parameters or call functions within the zserio sub-tree.

Examples:

  • 'fieldA.param' - Gets reflectable view to parameter 'param' within the parameterized field 'fieldA'.
  • 'child.getValue' - Gets reflectable view to result of the function called on field ̈́'child'.
  • 'child.nonexisting.field' - Gets nullptr since the path doesn't represent a valid entity.
Parameters
pathDot notation corresponding to the zserio tree.
Returns
Reflectable view to the result of the given path. Returns nullptr when the path doesn't exist or when the requested operation throws CppRuntimeException.

Overloaded method provided for convenience.

Implemented in zserio::ReflectableOwner< T, ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ resize()

◆ setAt()

template<typename ALLOC = std::allocator<uint8_t>>
virtual void zserio::IBasicReflectable< ALLOC >::setAt ( const AnyHolder< ALLOC > &  value,
size_t  index 
)
pure virtual

◆ setField()

template<typename ALLOC = std::allocator<uint8_t>>
virtual void zserio::IBasicReflectable< ALLOC >::setField ( StringView  name,
const AnyHolder< ALLOC > &  value 
)
pure virtual

Sets the field (i.e. member) with the given schema name.

Note
For optional fields, the value can be also nullptr of type std::nullptr_t which allows to reset an optional field.
Parameters
nameField schema name.
valueValue to set. The type must exactly match the type of the zserio field mapped to C++!
Exceptions
CppRuntimeExceptionWhen the reflected object is not a compound type or when the field with the given name doesn't exist or when the provided value is of a wrong type or when the field setter itself throws.

Implemented in zserio::ReflectableArrayBase< ALLOC >, zserio::ReflectableConstAllocatorHolderBase< ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ size()

◆ toDouble()

template<typename ALLOC = std::allocator<uint8_t>>
virtual double zserio::IBasicReflectable< ALLOC >::toDouble ( ) const
pure virtual

◆ toInt()

template<typename ALLOC = std::allocator<uint8_t>>
virtual int64_t zserio::IBasicReflectable< ALLOC >::toInt ( ) const
pure virtual

Converts any signed integral value to 64-bit signed integer.

Works also for enum types defined with signed underlying type.

Returns
64-bit signed integral value.
Exceptions
CppRuntimeExceptionWhen the reflected object cannot be converted to a signed integral value.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::SignedReflectableBase< ALLOC, T >, zserio::SignedReflectableBase< ALLOC, int8_t >, zserio::SignedReflectableBase< ALLOC, int32_t >, zserio::SignedReflectableBase< ALLOC, int64_t >, zserio::SignedReflectableBase< ALLOC, int16_t >, and zserio::ReflectableBase< ALLOC >.

◆ toString() [1/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual string<ALLOC> zserio::IBasicReflectable< ALLOC >::toString ( ) const
pure virtual

Converts an reflected object to string.

Works for all integral types including bool, bitmask and enum types and for string types.

Note
Floating point types are not currently supported!
The conversion to string can be implemented for more types in future versions.
Overload without parameter use default constructed allocator.
Parameters
allocatorAllocator to use for the string allocation.
Returns
String value representing the reflected object.

Implemented in zserio::ReflectableOwner< T, ALLOC >, and zserio::ReflectableBase< ALLOC >.

◆ toString() [2/2]

template<typename ALLOC = std::allocator<uint8_t>>
virtual string<ALLOC> zserio::IBasicReflectable< ALLOC >::toString ( const ALLOC &  allocator) const
pure virtual

Converts an reflected object to string.

Works for all integral types including bool, bitmask and enum types and for string types.

Note
Floating point types are not currently supported!
The conversion to string can be implemented for more types in future versions.
Overload without parameter use default constructed allocator.
Parameters
allocatorAllocator to use for the string allocation.
Returns
String value representing the reflected object.

Implemented in zserio::ReflectableArrayBase< ALLOC >, zserio::StringReflectable< ALLOC >, zserio::IntegralReflectableBase< ALLOC, T >, and zserio::ReflectableBase< ALLOC >.

◆ toUInt()

template<typename ALLOC = std::allocator<uint8_t>>
virtual uint64_t zserio::IBasicReflectable< ALLOC >::toUInt ( ) const
pure virtual

Converts any unsigned integral value to 64-bit unsigned integer.

Works also for bitmask and enum typed defined with unsigned underlying type.

Returns
64-bit unsigned integral value.
Exceptions
CppRuntimeExceptionWhen the reflected object cannot be converted to an unsigned integral value.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::UnsignedReflectableBase< ALLOC, T >, zserio::UnsignedReflectableBase< ALLOC, bool >, zserio::UnsignedReflectableBase< ALLOC, uint64_t >, zserio::UnsignedReflectableBase< ALLOC, uint8_t >, zserio::UnsignedReflectableBase< ALLOC, uint32_t >, zserio::UnsignedReflectableBase< ALLOC, uint16_t >, and zserio::ReflectableBase< ALLOC >.

◆ write()

template<typename ALLOC = std::allocator<uint8_t>>
virtual void zserio::IBasicReflectable< ALLOC >::write ( BitStreamWriter writer) const
pure virtual

Writes the reflected object to a bit stream using the given bit stream writer.

Note
Works for all reflectable types except arrays!
Parameters
writerBit stream writer to use.
Exceptions
CppRuntimeExceptionWhen the reflected object is an array.

Implemented in zserio::ReflectableOwner< T, ALLOC >, zserio::ReflectableArrayBase< ALLOC >, zserio::BitBufferReflectable< ALLOC >, zserio::StringReflectable< ALLOC >, zserio::BytesReflectable< ALLOC >, zserio::Float64Reflectable< ALLOC >, zserio::Float32Reflectable< ALLOC >, zserio::Float16Reflectable< ALLOC >, zserio::VarSizeReflectable< ALLOC >, zserio::VarUIntReflectable< ALLOC >, zserio::VarUInt64Reflectable< ALLOC >, zserio::VarUInt32Reflectable< ALLOC >, zserio::VarUInt16Reflectable< ALLOC >, zserio::VarIntReflectable< ALLOC >, zserio::VarInt64Reflectable< ALLOC >, zserio::VarInt32Reflectable< ALLOC >, zserio::VarInt16Reflectable< ALLOC >, zserio::DynamicUnsignedBitFieldReflectable< ALLOC, uint64_t >, zserio::DynamicUnsignedBitFieldReflectable< ALLOC, uint32_t >, zserio::DynamicUnsignedBitFieldReflectable< ALLOC, uint16_t >, zserio::DynamicUnsignedBitFieldReflectable< ALLOC, uint8_t >, zserio::DynamicSignedBitFieldReflectable< ALLOC, int64_t >, zserio::DynamicSignedBitFieldReflectable< ALLOC, int32_t >, zserio::DynamicSignedBitFieldReflectable< ALLOC, int16_t >, zserio::DynamicSignedBitFieldReflectable< ALLOC, int8_t >, zserio::FixedUnsignedBitFieldReflectable< ALLOC, uint64_t >, zserio::FixedUnsignedBitFieldReflectable< ALLOC, uint32_t >, zserio::FixedUnsignedBitFieldReflectable< ALLOC, uint16_t >, zserio::FixedUnsignedBitFieldReflectable< ALLOC, uint8_t >, zserio::FixedSignedBitFieldReflectable< ALLOC, int64_t >, zserio::FixedSignedBitFieldReflectable< ALLOC, int32_t >, zserio::FixedSignedBitFieldReflectable< ALLOC, int16_t >, zserio::FixedSignedBitFieldReflectable< ALLOC, int8_t >, zserio::UInt64Reflectable< ALLOC >, zserio::UInt32Reflectable< ALLOC >, zserio::UInt16Reflectable< ALLOC >, zserio::UInt8Reflectable< ALLOC >, zserio::Int64Reflectable< ALLOC >, zserio::Int32Reflectable< ALLOC >, zserio::Int16Reflectable< ALLOC >, zserio::Int8Reflectable< ALLOC >, zserio::BoolReflectable< ALLOC >, and zserio::ReflectableBase< ALLOC >.


The documentation for this class was generated from the following file: