Zserio C++ runtime library  1.2.0
Built for Zserio 2.16.0
zserio::ReflectableBase< ALLOC > Class Template Referenceabstract

#include <Reflectable.h>

Inheritance diagram for zserio::ReflectableBase< ALLOC >:
Collaboration diagram for zserio::ReflectableBase< ALLOC >:

Public Member Functions

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

Additional Inherited Members

- Public Types inherited from zserio::IBasicReflectable< ALLOC >
using Ptr = std::shared_ptr< IBasicReflectable >
 
using ConstPtr = std::shared_ptr< const IBasicReflectable >
 

Detailed Description

template<typename ALLOC>
class zserio::ReflectableBase< ALLOC >

Base class for all reflectable implementations.

Implements the find() feature and overrides all generic methods except of write() and bitSizeOf() with default throw behavior.

Definition at line 27 of file Reflectable.h.

Constructor & Destructor Documentation

◆ ReflectableBase() [1/3]

template<typename ALLOC >
zserio::ReflectableBase< ALLOC >::ReflectableBase ( const IBasicTypeInfo< ALLOC > &  typeInfo)
explicit

Constructor.

Parameters
typeInfoType info of the reflected object.

Definition at line 4049 of file Reflectable.h.

◆ ~ReflectableBase()

template<typename ALLOC >
zserio::ReflectableBase< ALLOC >::~ReflectableBase ( )
overridepure virtualdefault

Destructor.

◆ ReflectableBase() [2/3]

template<typename ALLOC >
zserio::ReflectableBase< ALLOC >::ReflectableBase ( const ReflectableBase< ALLOC > &  )
delete

Copying and moving is disallowed!

◆ ReflectableBase() [3/3]

template<typename ALLOC >
zserio::ReflectableBase< ALLOC >::ReflectableBase ( const ReflectableBase< ALLOC > &&  )
delete

Copying and moving is disallowed!

Member Function Documentation

◆ append()

◆ at() [1/2]

◆ at() [2/2]

template<typename ALLOC >
IBasicReflectablePtr< ALLOC > zserio::ReflectableBase< ALLOC >::at ( size_t  index)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented 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 >, and zserio::ReflectableConstArrayBase< ALLOC >.

Definition at line 4207 of file Reflectable.h.

◆ bitSizeOf() [1/2]

template<typename ALLOC >
size_t zserio::ReflectableBase< ALLOC >::bitSizeOf
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4099 of file Reflectable.h.

◆ bitSizeOf() [2/2]

template<typename ALLOC >
size_t zserio::ReflectableBase< ALLOC >::bitSizeOf ( size_t  bitPosition) const
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented 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 >, and zserio::ReflectableArrayBase< ALLOC >.

Definition at line 4093 of file Reflectable.h.

◆ callFunction() [1/2]

template<typename ALLOC >
IBasicReflectableConstPtr< ALLOC > zserio::ReflectableBase< ALLOC >::callFunction ( StringView  name) const
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >.

Definition at line 4147 of file Reflectable.h.

◆ callFunction() [2/2]

template<typename ALLOC >
IBasicReflectablePtr< ALLOC > zserio::ReflectableBase< ALLOC >::callFunction ( StringView  name)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableConstAllocatorHolderBase< ALLOC >.

Definition at line 4153 of file Reflectable.h.

◆ createField()

template<typename ALLOC >
IBasicReflectablePtr< ALLOC > zserio::ReflectableBase< ALLOC >::createField ( StringView  name)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >.

Definition at line 4123 of file Reflectable.h.

◆ find() [1/2]

template<typename ALLOC >
IBasicReflectableConstPtr< ALLOC > zserio::ReflectableBase< ALLOC >::find ( StringView  path) const
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4165 of file Reflectable.h.

◆ find() [2/2]

template<typename ALLOC >
IBasicReflectablePtr< ALLOC > zserio::ReflectableBase< ALLOC >::find ( StringView  path)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4171 of file Reflectable.h.

◆ getAnyValue() [1/4]

template<typename ALLOC >
AnyHolder< ALLOC > zserio::ReflectableBase< ALLOC >::getAnyValue
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4249 of file Reflectable.h.

◆ getAnyValue() [2/4]

template<typename ALLOC >
AnyHolder< ALLOC > zserio::ReflectableBase< ALLOC >::getAnyValue
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4255 of file Reflectable.h.

◆ getAnyValue() [3/4]

template<typename ALLOC >
AnyHolder< ALLOC > zserio::ReflectableBase< ALLOC >::getAnyValue ( const ALLOC &  allocator) const
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented 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 > >, and zserio::BuiltinReflectableBase< ALLOC, BasicBitBuffer< ALLOC > >.

Definition at line 4237 of file Reflectable.h.

◆ getAnyValue() [4/4]

template<typename ALLOC >
AnyHolder< ALLOC > zserio::ReflectableBase< ALLOC >::getAnyValue ( const ALLOC &  allocator)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented 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 > >, and zserio::BuiltinReflectableBase< ALLOC, BasicBitBuffer< ALLOC > >.

Definition at line 4243 of file Reflectable.h.

◆ getBitBuffer()

template<typename ALLOC >
const BasicBitBuffer< ALLOC > & zserio::ReflectableBase< ALLOC >::getBitBuffer
overridevirtual

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).

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::BitBufferReflectable< ALLOC >.

Definition at line 4339 of file Reflectable.h.

◆ getBool()

template<typename ALLOC >
bool zserio::ReflectableBase< ALLOC >::getBool
overridevirtual

Gets bool value of the bool reflectable.

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

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::BoolReflectable< ALLOC >.

Definition at line 4261 of file Reflectable.h.

◆ getBytes()

template<typename ALLOC >
Span< const uint8_t > zserio::ReflectableBase< ALLOC >::getBytes
overridevirtual

Gets byte value of the bytes reflectable.

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

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::BytesReflectable< ALLOC >.

Definition at line 4327 of file Reflectable.h.

◆ getChoice()

template<typename ALLOC >
StringView zserio::ReflectableBase< ALLOC >::getChoice
overridevirtual

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).

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >.

Definition at line 4159 of file Reflectable.h.

◆ getDouble()

template<typename ALLOC >
double zserio::ReflectableBase< ALLOC >::getDouble
overridevirtual

Gets double value of the double reflectable.

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

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::Float64Reflectable< ALLOC >.

Definition at line 4321 of file Reflectable.h.

◆ getField() [1/2]

template<typename ALLOC >
IBasicReflectableConstPtr< ALLOC > zserio::ReflectableBase< ALLOC >::getField ( StringView  name) const
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >.

Definition at line 4111 of file Reflectable.h.

◆ getField() [2/2]

template<typename ALLOC >
IBasicReflectablePtr< ALLOC > zserio::ReflectableBase< ALLOC >::getField ( StringView  name)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableConstAllocatorHolderBase< ALLOC >.

Definition at line 4117 of file Reflectable.h.

◆ getFloat()

template<typename ALLOC >
float zserio::ReflectableBase< ALLOC >::getFloat
overridevirtual

Gets float value of the float reflectable.

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

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, zserio::Float32Reflectable< ALLOC >, and zserio::Float16Reflectable< ALLOC >.

Definition at line 4315 of file Reflectable.h.

◆ getInt16()

template<typename ALLOC >
int16_t zserio::ReflectableBase< ALLOC >::getInt16
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::Int16ReflectableBase< ALLOC >.

Definition at line 4273 of file Reflectable.h.

◆ getInt32()

template<typename ALLOC >
int32_t zserio::ReflectableBase< ALLOC >::getInt32
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::Int32ReflectableBase< ALLOC >.

Definition at line 4279 of file Reflectable.h.

◆ getInt64()

template<typename ALLOC >
int64_t zserio::ReflectableBase< ALLOC >::getInt64
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::Int64ReflectableBase< ALLOC >.

Definition at line 4285 of file Reflectable.h.

◆ getInt8()

template<typename ALLOC >
int8_t zserio::ReflectableBase< ALLOC >::getInt8
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::Int8ReflectableBase< ALLOC >.

Definition at line 4267 of file Reflectable.h.

◆ getParameter() [1/2]

template<typename ALLOC >
IBasicReflectableConstPtr< ALLOC > zserio::ReflectableBase< ALLOC >::getParameter ( StringView  name) const
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >.

Definition at line 4135 of file Reflectable.h.

◆ getParameter() [2/2]

template<typename ALLOC >
IBasicReflectablePtr< ALLOC > zserio::ReflectableBase< ALLOC >::getParameter ( StringView  name)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableConstAllocatorHolderBase< ALLOC >.

Definition at line 4141 of file Reflectable.h.

◆ getStringView()

template<typename ALLOC >
StringView zserio::ReflectableBase< ALLOC >::getStringView
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::StringReflectable< ALLOC >.

Definition at line 4333 of file Reflectable.h.

◆ getTypeInfo()

template<typename ALLOC >
const IBasicTypeInfo< ALLOC > & zserio::ReflectableBase< ALLOC >::getTypeInfo
overridevirtual

Gets type info for the current zserio object.

Returns
Reference to the static instance of type info.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4057 of file Reflectable.h.

◆ getUInt16()

template<typename ALLOC >
uint16_t zserio::ReflectableBase< ALLOC >::getUInt16
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::UInt16ReflectableBase< ALLOC >.

Definition at line 4297 of file Reflectable.h.

◆ getUInt32()

template<typename ALLOC >
uint32_t zserio::ReflectableBase< ALLOC >::getUInt32
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::UInt32ReflectableBase< ALLOC >.

Definition at line 4303 of file Reflectable.h.

◆ getUInt64()

template<typename ALLOC >
uint64_t zserio::ReflectableBase< ALLOC >::getUInt64
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::UInt64ReflectableBase< ALLOC >.

Definition at line 4309 of file Reflectable.h.

◆ getUInt8()

template<typename ALLOC >
uint8_t zserio::ReflectableBase< ALLOC >::getUInt8
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::UInt8ReflectableBase< ALLOC >.

Definition at line 4291 of file Reflectable.h.

◆ initialize()

template<typename ALLOC >
void zserio::ReflectableBase< ALLOC >::initialize ( const vector< AnyHolder< ALLOC >, ALLOC > &  typeArguments)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableConstAllocatorHolderBase< ALLOC >.

Definition at line 4075 of file Reflectable.h.

◆ initializeChildren()

template<typename ALLOC >
void zserio::ReflectableBase< ALLOC >::initializeChildren
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableConstAllocatorHolderBase< ALLOC >.

Definition at line 4069 of file Reflectable.h.

◆ initializeOffsets() [1/2]

template<typename ALLOC >
size_t zserio::ReflectableBase< ALLOC >::initializeOffsets
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4087 of file Reflectable.h.

◆ initializeOffsets() [2/2]

template<typename ALLOC >
size_t zserio::ReflectableBase< ALLOC >::initializeOffsets ( size_t  bitPosition)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableConstAllocatorHolderBase< ALLOC >.

Definition at line 4081 of file Reflectable.h.

◆ isArray()

template<typename ALLOC >
bool zserio::ReflectableBase< ALLOC >::isArray
overridevirtual

Gets whether the reflected object is an array.

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

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >.

Definition at line 4063 of file Reflectable.h.

◆ operator=() [1/2]

template<typename ALLOC >
ReflectableBase& zserio::ReflectableBase< ALLOC >::operator= ( const ReflectableBase< ALLOC > &&  )
delete

Copying and moving is disallowed!

◆ operator=() [2/2]

template<typename ALLOC >
ReflectableBase& zserio::ReflectableBase< ALLOC >::operator= ( const ReflectableBase< ALLOC > &  )
delete

Copying and moving is disallowed!

◆ operator[]() [1/4]

template<typename ALLOC >
IBasicReflectableConstPtr< ALLOC > zserio::ReflectableBase< ALLOC >::operator[] ( size_t  index) const
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >.

Definition at line 4213 of file Reflectable.h.

◆ operator[]() [2/4]

template<typename ALLOC >
IBasicReflectablePtr< ALLOC > zserio::ReflectableBase< ALLOC >::operator[] ( size_t  index)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableConstArrayBase< ALLOC >, and zserio::ReflectableArrayBase< ALLOC >.

Definition at line 4219 of file Reflectable.h.

◆ operator[]() [3/4]

template<typename ALLOC >
IBasicReflectableConstPtr< ALLOC > zserio::ReflectableBase< ALLOC >::operator[] ( StringView  path) const
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4177 of file Reflectable.h.

◆ operator[]() [4/4]

template<typename ALLOC >
IBasicReflectablePtr< ALLOC > zserio::ReflectableBase< ALLOC >::operator[] ( StringView  path)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4183 of file Reflectable.h.

◆ parsingInfo()

template<typename ALLOC >
const ParsingInfo & zserio::ReflectableBase< ALLOC >::parsingInfo
overridevirtual

Returns the parsing information after reading of the reflectable object.

This feature is experimental and can be removed without any warning!

Note
Note that the returned parsing information is valid only directly after read! If the Zserio object has been changed after reading, the result is undefined!
The parsing information is available only for code generated using -withParsingInfo option.
Returns
The parsing information of the reflectable object.
Exceptions
CppRuntimeExceptionIf the object was compiled without the parsing info feature enabled.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4379 of file Reflectable.h.

◆ resize()

◆ setAt()

template<typename ALLOC >
void zserio::ReflectableBase< ALLOC >::setAt ( const AnyHolder< ALLOC > &  value,
size_t  index 
)
overridevirtual

◆ setField()

template<typename ALLOC >
void zserio::ReflectableBase< ALLOC >::setField ( StringView  name,
const AnyHolder< ALLOC > &  value 
)
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, and zserio::ReflectableConstAllocatorHolderBase< ALLOC >.

Definition at line 4129 of file Reflectable.h.

◆ size()

◆ toDouble()

template<typename ALLOC >
double zserio::ReflectableBase< ALLOC >::toDouble
overridevirtual

Converts any numeric value to double.

Works also for bitmask and enum types.

Returns
Double value.
Exceptions
CppRuntimeExceptionWhen the reflected object cannot be converted to double.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in zserio::ReflectableArrayBase< ALLOC >, zserio::FloatingPointReflectableBase< ALLOC, T >, zserio::FloatingPointReflectableBase< ALLOC, float >, zserio::FloatingPointReflectableBase< ALLOC, double >, and zserio::IntegralReflectableBase< ALLOC, T >.

Definition at line 4359 of file Reflectable.h.

◆ toInt()

template<typename ALLOC >
int64_t zserio::ReflectableBase< ALLOC >::toInt
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

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

Definition at line 4345 of file Reflectable.h.

◆ toString() [1/2]

template<typename ALLOC >
string< ALLOC > zserio::ReflectableBase< ALLOC >::toString
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Definition at line 4373 of file Reflectable.h.

◆ toString() [2/2]

template<typename ALLOC >
string< ALLOC > zserio::ReflectableBase< ALLOC >::toString ( const ALLOC &  allocator) const
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

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

Definition at line 4366 of file Reflectable.h.

◆ toUInt()

template<typename ALLOC >
uint64_t zserio::ReflectableBase< ALLOC >::toUInt
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in 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 >, and zserio::UnsignedReflectableBase< ALLOC, uint16_t >.

Definition at line 4352 of file Reflectable.h.

◆ write()

template<typename ALLOC >
void zserio::ReflectableBase< ALLOC >::write ( BitStreamWriter writer) const
overridevirtual

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.

Implements zserio::IBasicReflectable< ALLOC >.

Reimplemented in 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 >, and zserio::BoolReflectable< ALLOC >.

Definition at line 4105 of file Reflectable.h.


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