|
|
#include <RobotAPI/libraries/aron/core/data/variant/Variant.h>
Inheritance diagram for Variant:Public Types | |
| using | PointerType = VariantPtr |
Public Member Functions | |
| virtual size_t | childrenSize () const =0 |
| get the children size of a data variant | |
| virtual VariantPtr | cloneAsVariant () const =0 |
| get a pointer to a copy of this variant | |
| 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 | |
| virtual std::vector< VariantPtr > | getChildren () const =0 |
| get the children of a data variant | |
| data::Descriptor | getDescriptor () const |
| getter for the descriptor enum | |
| virtual std::string | getFullName () const =0 |
| get the full str representation of this variant | |
| Path | getPath () const |
| get the path | |
| virtual std::string | getShortName () const =0 |
| get a short str representation of this variant | |
| virtual VariantPtr | navigateAbsolute (const Path &path) const =0 |
| naviate absolute | |
| virtual VariantPtr | navigateRelative (const Path &path) const =0 |
| navigate relative | |
| virtual bool | operator== (const Variant &other) const =0 |
| bool | operator== (const VariantPtr &other) const |
| std::string | pathToString () const |
| get the path as string | |
| 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 | |
| virtual data::dto::GenericDataPtr | toAronDTO () const =0 |
| convert the variant to the ice representation | |
| 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 | |
| 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 | |
| static std::vector< data::dto::GenericDataPtr > | ToAronDTO (const std::vector< VariantPtr > &) |
| return a list of dto objects from a list of variant objects | |
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 |
Here is the caller graph for this function:
|
inline |
|
virtualdefault |
|
pure virtual |
get the children size of a data variant
Implemented in ComplexVariant< AronDataT, DerivedT >, ComplexVariant< data::dto::NDArray, NDArray >, PrimitiveVariant< AronDataT, ValueT, DerivedT >, PrimitiveVariant< data::dto::AronBool, bool, Bool >, PrimitiveVariant< data::dto::AronDouble, double, Double >, PrimitiveVariant< data::dto::AronFloat, float, Float >, PrimitiveVariant< data::dto::AronInt, int, Int >, PrimitiveVariant< data::dto::AronLong, long, Long >, PrimitiveVariant< data::dto::AronString, std::string, String >, Dict, and List.
|
pure virtual |
get a pointer to a copy of this variant
Implemented in SpecializedVariantBase< AronDataT, DerivedT >, SpecializedVariantBase< data::dto::AronBool, Bool >, SpecializedVariantBase< data::dto::AronDouble, Double >, SpecializedVariantBase< data::dto::AronFloat, Float >, SpecializedVariantBase< data::dto::AronInt, Int >, SpecializedVariantBase< data::dto::AronLong, Long >, SpecializedVariantBase< data::dto::AronString, String >, SpecializedVariantBase< data::dto::Dict, Dict >, SpecializedVariantBase< data::dto::List, List >, and SpecializedVariantBase< data::dto::NDArray, NDArray >.
|
pure virtual |
Implemented in SpecializedVariantBase< AronDataT, DerivedT >, SpecializedVariantBase< data::dto::AronBool, Bool >, SpecializedVariantBase< data::dto::AronDouble, Double >, SpecializedVariantBase< data::dto::AronFloat, Float >, SpecializedVariantBase< data::dto::AronInt, Int >, SpecializedVariantBase< data::dto::AronLong, Long >, SpecializedVariantBase< data::dto::AronString, String >, SpecializedVariantBase< data::dto::Dict, Dict >, SpecializedVariantBase< data::dto::List, List >, and SpecializedVariantBase< data::dto::NDArray, NDArray >.
|
static |
create a variant from a dto object
Definition at line 39 of file Variant.cpp.
Here is the caller graph for this function:
|
static |
create a list of variants from a list of dto objects
Definition at line 45 of file Variant.cpp.
Here is the call graph for this function:
|
pure virtual |
|
pure virtual |
get the children of a data variant
Implemented in ComplexVariant< AronDataT, DerivedT >, ComplexVariant< data::dto::NDArray, NDArray >, PrimitiveVariant< AronDataT, ValueT, DerivedT >, PrimitiveVariant< data::dto::AronBool, bool, Bool >, PrimitiveVariant< data::dto::AronDouble, double, Double >, PrimitiveVariant< data::dto::AronFloat, float, Float >, PrimitiveVariant< data::dto::AronInt, int, Int >, PrimitiveVariant< data::dto::AronLong, long, Long >, PrimitiveVariant< data::dto::AronString, std::string, String >, Dict, and List.
|
inline |
|
pure virtual |
|
inline |
|
pure virtual |
|
pure virtual |
naviate absolute
Implemented in ComplexVariant< AronDataT, DerivedT >, ComplexVariant< data::dto::NDArray, NDArray >, PrimitiveVariant< AronDataT, ValueT, DerivedT >, PrimitiveVariant< data::dto::AronBool, bool, Bool >, PrimitiveVariant< data::dto::AronDouble, double, Double >, PrimitiveVariant< data::dto::AronFloat, float, Float >, PrimitiveVariant< data::dto::AronInt, int, Int >, PrimitiveVariant< data::dto::AronLong, long, Long >, PrimitiveVariant< data::dto::AronString, std::string, String >, Dict, and List.
Here is the caller graph for this function:
|
pure virtual |
navigate relative
Implemented in SpecializedVariantBase< AronDataT, DerivedT >, SpecializedVariantBase< data::dto::AronBool, Bool >, SpecializedVariantBase< data::dto::AronDouble, Double >, SpecializedVariantBase< data::dto::AronFloat, Float >, SpecializedVariantBase< data::dto::AronInt, Int >, SpecializedVariantBase< data::dto::AronLong, Long >, SpecializedVariantBase< data::dto::AronString, String >, SpecializedVariantBase< data::dto::Dict, Dict >, SpecializedVariantBase< data::dto::List, List >, and SpecializedVariantBase< data::dto::NDArray, NDArray >.
|
pure virtual |
Implemented in SpecializedVariantBase< AronDataT, DerivedT >, SpecializedVariantBase< data::dto::AronBool, Bool >, SpecializedVariantBase< data::dto::AronDouble, Double >, SpecializedVariantBase< data::dto::AronFloat, Float >, SpecializedVariantBase< data::dto::AronInt, Int >, SpecializedVariantBase< data::dto::AronLong, Long >, SpecializedVariantBase< data::dto::AronString, String >, SpecializedVariantBase< data::dto::Dict, Dict >, SpecializedVariantBase< data::dto::List, List >, and SpecializedVariantBase< data::dto::NDArray, NDArray >.
Here is the call graph for this function:
|
inline |
|
inline |
|
pure virtual |
|
static |
return a list of dto objects from a list of variant objects
Definition at line 56 of file Variant.cpp.
|
pure virtual |
convert the variant to the ice representation
Implemented in SpecializedVariantBase< AronDataT, DerivedT >, SpecializedVariantBase< data::dto::AronBool, Bool >, SpecializedVariantBase< data::dto::AronDouble, Double >, SpecializedVariantBase< data::dto::AronFloat, Float >, SpecializedVariantBase< data::dto::AronInt, Int >, SpecializedVariantBase< data::dto::AronLong, Long >, SpecializedVariantBase< data::dto::AronString, String >, SpecializedVariantBase< data::dto::Dict, Dict >, SpecializedVariantBase< data::dto::List, List >, and SpecializedVariantBase< data::dto::NDArray, NDArray >.
|
protected |