|
#include <RobotAPI/libraries/aron/core/data/variant/Variant.h>
Public Types | |
using | PointerType = VariantPtr |
Public Member Functions | |
virtual size_t | childrenSize () const =0 |
get the children size of a data variant More... | |
virtual VariantPtr | cloneAsVariant () const =0 |
get a pointer to a copy of this variant More... | |
virtual VariantPtr | cloneAsVariant (const Path &newPath) const =0 |
virtual bool | fullfillsType (const type::VariantPtr &) const =0 |
checks, if the current data variant fullfills the given type More... | |
virtual std::vector< VariantPtr > | getChildren () const =0 |
get the children of a data variant More... | |
data::Descriptor | getDescriptor () const |
getter for the descriptor enum More... | |
virtual std::string | getFullName () const =0 |
get the full str representation of this variant More... | |
Path | getPath () const |
get the path More... | |
virtual std::string | getShortName () const =0 |
get a short str representation of this variant More... | |
virtual VariantPtr | navigateAbsolute (const Path &path) const =0 |
naviate absolute More... | |
virtual VariantPtr | navigateRelative (const Path &path) const =0 |
navigate relative More... | |
virtual bool | operator== (const Variant &other) const =0 |
bool | operator== (const VariantPtr &other) const |
std::string | pathToString () const |
get the path as string More... | |
virtual type::VariantPtr | recalculateType () const =0 |
recalculate the type of a data variant. Please not tha the mapping ist NOT bijective, so the calculated type may be wrong More... | |
virtual data::dto::GenericDataPtr | toAronDTO () const =0 |
convert the variant to the ice representation More... | |
Variant ()=delete | |
Variant (const data::Descriptor &descriptor, const Path &path) | |
virtual | ~Variant ()=default |
Static Public Member Functions | |
static VariantPtr | FromAronDTO (const data::dto::GenericDataPtr &, const Path &=Path()) |
create a variant from a dto object More... | |
static std::vector< VariantPtr > | FromAronDTO (const std::vector< data::dto::GenericDataPtr > &, const Path &=Path()) |
create a list of variants from a list of dto objects More... | |
static std::vector< data::dto::GenericDataPtr > | ToAronDTO (const std::vector< VariantPtr > &) |
return a list of dto objects from a list of variant objects More... | |
Protected Attributes | |
const data::Descriptor | descriptor |
const Path | path |
The Variant class.
It represents a data object (a variant containing data). Every data variant inherits from this class. It provdes basic methods for cast/conversion and holds a descriptor, specifying the data type.
If you have a unknown variant and you want to run a specific method based on the type, we suggest to use the visitor pattern (
Note that a data variant differs from a type variant. A data variant contains data (e.g. if you have a list the data object contains the list elements) while a type object holds the static type information (e.g. the accepted type of the list). The elements of a list variant without type information may have different types (e.g. element [0] is an int variant whil element [1] is a string variant)
Also note, that while a type variant should always be defined (will not be NULL!), a data object can be NULL. This happens, if a maybe type (e.g. optional) is not set. The underlying ice representation will have a nullptr instead.
using PointerType = VariantPtr |
|
delete |
|
inline |
|
virtualdefault |
|
pure virtual |
get the children size of a data variant
Implemented in PrimitiveVariant< AronDataT, ValueT, DerivedT >, Dict, List, and ComplexVariant< AronDataT, DerivedT >.
|
pure virtual |
get a pointer to a copy of this variant
Implemented in SpecializedVariantBase< AronDataT, DerivedT >.
|
pure virtual |
Implemented in SpecializedVariantBase< AronDataT, DerivedT >, SpecializedVariantBase< data::dto::AronString, String >, SpecializedVariantBase< data::dto::Dict, Dict >, SpecializedVariantBase< data::dto::List, List >, SpecializedVariantBase< data::dto::AronBool, Bool >, SpecializedVariantBase< data::dto::AronDouble, Double >, SpecializedVariantBase< data::dto::NDArray, NDArray >, SpecializedVariantBase< data::dto::AronFloat, Float >, SpecializedVariantBase< data::dto::AronLong, Long >, and SpecializedVariantBase< data::dto::AronInt, Int >.
|
static |
create a variant from a dto object
Definition at line 39 of file Variant.cpp.
|
static |
create a list of variants from a list of dto objects
Definition at line 44 of file Variant.cpp.
|
pure virtual |
|
pure virtual |
get the children of a data variant
Implemented in PrimitiveVariant< AronDataT, ValueT, DerivedT >, Dict, List, and ComplexVariant< AronDataT, DerivedT >.
|
inline |
|
pure virtual |
|
inline |
|
pure virtual |
|
pure virtual |
naviate absolute
Implemented in Dict, List, PrimitiveVariant< AronDataT, ValueT, DerivedT >, PrimitiveVariant< data::dto::AronDouble, double, Double >, PrimitiveVariant< data::dto::AronString, std::string, String >, PrimitiveVariant< data::dto::AronLong, long, Long >, PrimitiveVariant< data::dto::AronFloat, float, Float >, PrimitiveVariant< data::dto::AronBool, bool, Bool >, PrimitiveVariant< data::dto::AronInt, int, Int >, ComplexVariant< AronDataT, DerivedT >, and ComplexVariant< data::dto::NDArray, NDArray >.
|
pure virtual |
navigate relative
Implemented in SpecializedVariantBase< AronDataT, DerivedT >, SpecializedVariantBase< data::dto::AronString, String >, SpecializedVariantBase< data::dto::Dict, Dict >, SpecializedVariantBase< data::dto::List, List >, SpecializedVariantBase< data::dto::AronBool, Bool >, SpecializedVariantBase< data::dto::AronDouble, Double >, SpecializedVariantBase< data::dto::NDArray, NDArray >, SpecializedVariantBase< data::dto::AronFloat, Float >, SpecializedVariantBase< data::dto::AronLong, Long >, and SpecializedVariantBase< data::dto::AronInt, Int >.
|
pure virtual |
Implemented in SpecializedVariantBase< AronDataT, DerivedT >, SpecializedVariantBase< data::dto::AronString, String >, SpecializedVariantBase< data::dto::Dict, Dict >, SpecializedVariantBase< data::dto::List, List >, SpecializedVariantBase< data::dto::AronBool, Bool >, SpecializedVariantBase< data::dto::AronDouble, Double >, SpecializedVariantBase< data::dto::NDArray, NDArray >, SpecializedVariantBase< data::dto::AronFloat, Float >, SpecializedVariantBase< data::dto::AronLong, Long >, and SpecializedVariantBase< data::dto::AronInt, Int >.
|
inline |
|
inline |
|
pure virtual |
|
pure virtual |
convert the variant to the ice representation
Implemented in SpecializedVariantBase< AronDataT, DerivedT >.
|
static |
return a list of dto objects from a list of variant objects
Definition at line 54 of file Variant.cpp.
|
protected |