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

#include <ZserioTreeCreator.h>

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

Public Member Functions

 BasicZserioTreeCreator (const IBasicTypeInfo< ALLOC > &typeInfo, const ALLOC &allocator=ALLOC())
 
void beginRoot ()
 
IBasicReflectablePtr< ALLOC > endRoot ()
 
void beginArray (const string< ALLOC > &name)
 
void endArray ()
 
void beginCompound (const string< ALLOC > &name)
 
void endCompound ()
 
template<typename T >
void setValue (const string< ALLOC > &name, T &&value)
 
void setValue (const string< ALLOC > &name, std::nullptr_t nullValue)
 
const IBasicTypeInfo< ALLOC > & getFieldType (const string< ALLOC > &name) const
 
void beginCompoundElement ()
 
void endCompoundElement ()
 
template<typename T >
void addValueElement (T &&value)
 
const IBasicTypeInfo< ALLOC > & getElementType () const
 

Detailed Description

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

Allows to build zserio object tree defined by the given type info.

Definition at line 422 of file ZserioTreeCreator.h.

Constructor & Destructor Documentation

◆ BasicZserioTreeCreator()

template<typename ALLOC >
zserio::BasicZserioTreeCreator< ALLOC >::BasicZserioTreeCreator ( const IBasicTypeInfo< ALLOC > &  typeInfo,
const ALLOC &  allocator = ALLOC() 
)
explicit

Constructor.

Parameters
typeInfoType info defining the tree.

Definition at line 564 of file ZserioTreeCreator.h.

Member Function Documentation

◆ addValueElement()

template<typename ALLOC >
template<typename T >
void zserio::BasicZserioTreeCreator< ALLOC >::addValueElement ( T &&  value)

Adds the value to the array.

Parameters
valueValue to add.
Exceptions
CppRuntimeExceptionWhen the creator is not in an array of simple values.

Definition at line 790 of file ZserioTreeCreator.h.

◆ beginArray()

template<typename ALLOC >
void zserio::BasicZserioTreeCreator< ALLOC >::beginArray ( const string< ALLOC > &  name)

Creates an array field within the current compound.

Parameters
nameName of the array field.
Exceptions
CppRuntimeExceptionWhen the field doesn't exist or when the creator is not in a compound.

Definition at line 599 of file ZserioTreeCreator.h.

◆ beginCompound()

template<typename ALLOC >
void zserio::BasicZserioTreeCreator< ALLOC >::beginCompound ( const string< ALLOC > &  name)

Creates a compound field within the current compound.

Parameters
nameName of the compound field.
Exceptions
CppRuntimeExceptionWhen the field doesn't exist or when the creator is not in a compound.

Definition at line 641 of file ZserioTreeCreator.h.

◆ beginCompoundElement()

template<typename ALLOC >
void zserio::BasicZserioTreeCreator< ALLOC >::beginCompoundElement

Creates compound array element within the current array.

Exceptions
CppRuntimeExceptionWhen the creator is not in an array of compounds.

Definition at line 748 of file ZserioTreeCreator.h.

◆ beginRoot()

template<typename ALLOC >
void zserio::BasicZserioTreeCreator< ALLOC >::beginRoot

Creates the top level compound element and move to state of building its children.

Definition at line 573 of file ZserioTreeCreator.h.

◆ endArray()

template<typename ALLOC >
void zserio::BasicZserioTreeCreator< ALLOC >::endArray

Finishes the array field.

Exceptions
CppRuntimeExceptionWhen the creator is not in an array field.

Definition at line 628 of file ZserioTreeCreator.h.

◆ endCompound()

template<typename ALLOC >
void zserio::BasicZserioTreeCreator< ALLOC >::endCompound

Finishes the compound.

Exceptions
CppRuntimeExceptionWhen the creator is not in a compound.

Definition at line 676 of file ZserioTreeCreator.h.

◆ endCompoundElement()

template<typename ALLOC >
void zserio::BasicZserioTreeCreator< ALLOC >::endCompoundElement

Finishes the compound element.

Exceptions
CppRuntimeExceptionWhen the creator is not in a compound element.

Definition at line 770 of file ZserioTreeCreator.h.

◆ endRoot()

template<typename ALLOC >
IBasicReflectablePtr< ALLOC > zserio::BasicZserioTreeCreator< ALLOC >::endRoot

Finishes building and returns the created tree.

Returns
Zserio object tree.
Exceptions
CppRuntimeExceptionWhen the creator is not in state of building the root object.

Definition at line 585 of file ZserioTreeCreator.h.

◆ getElementType()

template<typename ALLOC >
const IBasicTypeInfo< ALLOC > & zserio::BasicZserioTreeCreator< ALLOC >::getElementType

Gets type info of the expected array element.

Returns
Type info of the expected array element.
Exceptions
CppRuntimeExceptionWhen the creator is not in an array.

Definition at line 802 of file ZserioTreeCreator.h.

◆ getFieldType()

template<typename ALLOC >
const IBasicTypeInfo< ALLOC > & zserio::BasicZserioTreeCreator< ALLOC >::getFieldType ( const string< ALLOC > &  name) const

Gets type info of the expected field.

Parameters
nameField name.
Returns
Type info of the expected field.
Exceptions
CppRuntimeExceptionWhen the creator is not in a compound.

Definition at line 737 of file ZserioTreeCreator.h.

◆ setValue() [1/2]

template<typename ALLOC >
void zserio::BasicZserioTreeCreator< ALLOC >::setValue ( const string< ALLOC > &  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).

Parameters
nameName of the field.
nullValueNull value.
Exceptions
CppRuntimeExceptionWhen the field doesn't exist or when the creator is not in a compound.

Definition at line 715 of file ZserioTreeCreator.h.

◆ setValue() [2/2]

template<typename ALLOC >
template<typename T >
void zserio::BasicZserioTreeCreator< ALLOC >::setValue ( const string< ALLOC > &  name,
T &&  value 
)

Sets field value within the current compound.

Parameters
nameName of the field.
valueValue to set.
Exceptions
CppRuntimeExceptionWhen the field doesn't exist or when the creator is not in a compound.

Definition at line 696 of file ZserioTreeCreator.h.


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