Variant Class Referenceabstract

The Variant class. More...

#include <RobotAPI/libraries/aron/core/type/variant/Variant.h>

+ Inheritance diagram for Variant:

Public Types

using PointerType = VariantPtr
 

Public Member Functions

virtual size_t childrenSize () const =0
 
virtual std::vector< VariantPtrgetChildren () const =0
 get all child elements More...
 
type::Descriptor getDescriptor () const
 
virtual std::string getFullName () const =0
 get the full name of this specific type More...
 
virtual type::Maybe getMaybe () const =0
 get the maybe type More...
 
Path getPath () const
 
virtual std::string getShortName () const =0
 get a short name of this specific type 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
 
virtual void setMaybe (const type::Maybe m)=0
 set the maybetype of this type More...
 
virtual type::dto::GenericTypePtr toAronDTO () const =0
 convert this variant to a dto object. More...
 
 Variant (const type::Descriptor &descriptor, const Path &path=Path())
 
virtual ~Variant ()=default
 

Static Public Member Functions

static VariantPtr FromAronDTO (const type::dto::GenericType &, const Path &=Path())
 create a variant object from an dto object More...
 

Protected Attributes

const type::Descriptor descriptor
 
const Path path
 

Detailed Description

The Variant class.

This is the parent class of all type variant objects. It provides basic methods to get the children of a type, to get the descriptor, etc. Usually, you get a VariantPtr as input to your code. You can use the descriptor to find out, which specific type is behind a variant. It is type safe. For casting, every variant implementation provides the DynamicCast method, which casts a pointer to the static used type.

This implementation wraps around the underlying ice object (armarx::aron::type::dto::XXX). All data is stored in the ice handle. However, for simplicity, container types also contain pointers to their children variants

Each ice type object has a special member 'maybeType' which holds an enum containing the information of if this type is a pointer, an optional or something else.

Definition at line 59 of file Variant.h.

Member Typedef Documentation

◆ PointerType

Definition at line 62 of file Variant.h.

Constructor & Destructor Documentation

◆ Variant()

Variant ( const type::Descriptor descriptor,
const Path path = Path() 
)
inline

Definition at line 66 of file Variant.h.

◆ ~Variant()

virtual ~Variant ( )
virtualdefault

Member Function Documentation

◆ childrenSize()

◆ FromAronDTO()

VariantPtr FromAronDTO ( const type::dto::GenericType &  a,
const Path path = Path() 
)
static

create a variant object from an dto object

Definition at line 39 of file Variant.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChildren()

◆ getDescriptor()

type::Descriptor getDescriptor ( ) const
inline

Definition at line 93 of file Variant.h.

+ Here is the caller graph for this function:

◆ getFullName()

virtual std::string getFullName ( ) const
pure virtual

get the full name of this specific type

Implemented in Object, Pair, Tuple, Matrix, Dict, NDArray, List, IntEnum, PointCloud, Image, Quaternion, Bool, Double, Float, Int, Long, String, and AnyObject.

◆ getMaybe()

virtual type::Maybe getMaybe ( ) const
pure virtual

get the maybe type

Implemented in SpecializedVariantBase< AronTypeT, DerivedT >.

◆ getPath()

Path getPath ( ) const
inline

Definition at line 99 of file Variant.h.

+ Here is the caller graph for this function:

◆ getShortName()

virtual std::string getShortName ( ) const
pure virtual

get a short name of this specific type

Implemented in Object, Pair, Tuple, Matrix, Dict, NDArray, List, IntEnum, PointCloud, Image, Quaternion, Bool, Double, Float, Int, Long, String, and AnyObject.

◆ navigateAbsolute()

◆ navigateRelative()

◆ operator==() [1/2]

◆ operator==() [2/2]

bool operator== ( const VariantPtr other) const
inline

Definition at line 77 of file Variant.h.

◆ pathToString()

std::string pathToString ( ) const
inline

Definition at line 105 of file Variant.h.

+ Here is the call graph for this function:

◆ setMaybe()

◆ toAronDTO()

virtual type::dto::GenericTypePtr toAronDTO ( ) const
pure virtual

convert this variant to a dto object.

In most cases you have to use the specific conversion methods of each type implementation (e.g. to toIntDTO() to get an aron::type::dto::Int object)

Implemented in SpecializedVariantBase< AronTypeT, DerivedT >.

Member Data Documentation

◆ descriptor

const type::Descriptor descriptor
protected

Definition at line 138 of file Variant.h.

◆ path

const Path path
protected

Definition at line 139 of file Variant.h.


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