Zserio C++17 runtime library
0.5.0
Built for Zserio 2.17.0
|
#include <ZserioTreeCreator.h>
Public Member Functions | |
BasicZserioTreeCreator (const IBasicTypeInfo< ALLOC > &typeInfo, const ALLOC &allocator=ALLOC()) | |
void | beginRoot () |
IBasicReflectableDataPtr< ALLOC > | endRoot () |
void | beginArray (const BasicString< RebindAlloc< ALLOC, char >> &name) |
void | endArray () |
void | beginCompound (const BasicString< RebindAlloc< ALLOC, char >> &name) |
void | endCompound () |
template<typename T > | |
void | setValue (const BasicString< RebindAlloc< ALLOC, char >> &name, T &&value) |
void | setValue (const BasicString< RebindAlloc< ALLOC, char >> &name, std::nullptr_t nullValue) |
const IBasicTypeInfo< ALLOC > & | getFieldType (const BasicString< RebindAlloc< ALLOC, char >> &name) const |
void | beginCompoundElement () |
void | endCompoundElement () |
template<typename T > | |
void | addValueElement (T &&value) |
const IBasicTypeInfo< ALLOC > & | getElementType () const |
Allows to build zserio object tree defined by the given type info.
Definition at line 423 of file ZserioTreeCreator.h.
|
explicit |
Constructor.
typeInfo | Type info defining the tree. |
Definition at line 568 of file ZserioTreeCreator.h.
void zserio::BasicZserioTreeCreator< ALLOC >::addValueElement | ( | T && | value | ) |
Adds the value to the array.
value | Value to add. |
CppRuntimeException | When the creator is not in an array of simple values. |
Definition at line 796 of file ZserioTreeCreator.h.
void zserio::BasicZserioTreeCreator< ALLOC >::beginArray | ( | const BasicString< RebindAlloc< ALLOC, char >> & | name | ) |
Creates an array field within the current compound.
name | Name of the array field. |
CppRuntimeException | When the field doesn't exist or when the creator is not in a compound. |
Definition at line 603 of file ZserioTreeCreator.h.
void zserio::BasicZserioTreeCreator< ALLOC >::beginCompound | ( | const BasicString< RebindAlloc< ALLOC, char >> & | name | ) |
Creates a compound field within the current compound.
name | Name of the compound field. |
CppRuntimeException | When the field doesn't exist or when the creator is not in a compound. |
Definition at line 645 of file ZserioTreeCreator.h.
void zserio::BasicZserioTreeCreator< ALLOC >::beginCompoundElement |
Creates compound array element within the current array.
CppRuntimeException | When the creator is not in an array of compounds. |
Definition at line 754 of file ZserioTreeCreator.h.
void zserio::BasicZserioTreeCreator< ALLOC >::beginRoot |
Creates the top level compound element and move to state of building its children.
Definition at line 577 of file ZserioTreeCreator.h.
void zserio::BasicZserioTreeCreator< ALLOC >::endArray |
Finishes the array field.
CppRuntimeException | When the creator is not in an array field. |
Definition at line 632 of file ZserioTreeCreator.h.
void zserio::BasicZserioTreeCreator< ALLOC >::endCompound |
Finishes the compound.
CppRuntimeException | When the creator is not in a compound. |
Definition at line 680 of file ZserioTreeCreator.h.
void zserio::BasicZserioTreeCreator< ALLOC >::endCompoundElement |
Finishes the compound element.
CppRuntimeException | When the creator is not in a compound element. |
Definition at line 776 of file ZserioTreeCreator.h.
IBasicReflectableDataPtr< ALLOC > zserio::BasicZserioTreeCreator< ALLOC >::endRoot |
Finishes building and returns the created tree.
CppRuntimeException | When the creator is not in state of building the root object. |
Definition at line 589 of file ZserioTreeCreator.h.
const IBasicTypeInfo< ALLOC > & zserio::BasicZserioTreeCreator< ALLOC >::getElementType |
Gets type info of the expected array element.
CppRuntimeException | When the creator is not in an array. |
Definition at line 808 of file ZserioTreeCreator.h.
const IBasicTypeInfo< ALLOC > & zserio::BasicZserioTreeCreator< ALLOC >::getFieldType | ( | const BasicString< RebindAlloc< ALLOC, char >> & | name | ) | const |
Gets type info of the expected field.
name | Field name. |
CppRuntimeException | When the creator is not in a compound. |
Definition at line 742 of file ZserioTreeCreator.h.
void zserio::BasicZserioTreeCreator< ALLOC >::setValue | ( | const BasicString< RebindAlloc< ALLOC, char >> & | name, |
std::nullptr_t | nullValue | ||
) |
Overload for setting of a null value.
Note that this does nothing in C++ since non-optional fields are always present (default initialized).
name | Name of the field. |
nullValue | Null value. |
CppRuntimeException | When the field doesn't exist or when the creator is not in a compound. |
Definition at line 719 of file ZserioTreeCreator.h.
void zserio::BasicZserioTreeCreator< ALLOC >::setValue | ( | const BasicString< RebindAlloc< ALLOC, char >> & | name, |
T && | value | ||
) |
Sets field value within the current compound.
name | Name of the field. |
value | Value to set. |
CppRuntimeException | When the field doesn't exist or when the creator is not in a compound. |
Definition at line 700 of file ZserioTreeCreator.h.