|
The Variant class is described here: Variants. More...
#include <ArmarXCore/observers/variant/Variant.h>
Public Member Functions | |
virtual VariantPtr | clone () const |
Returns a copy of the Variant. More... | |
template<> | |
bool | get () const |
template<> | |
float | get () const |
template<> | |
double | get () const |
template<typename T > | |
std::enable_if_t< std::is_base_of_v< VariantDataClass, T >, IceInternal::Handle< T > > | get () const |
Template-based getter for the Variant's value. More... | |
template<typename T > | |
std::enable_if_t< std::is_base_of_v< VariantDataClass, typename T::element_type >, T > | get () const |
template<typename T > | |
std::enable_if_t<(std::is_standard_layout_v< T > &&std::is_trivial_v< T >)||std::is_same_v< std::string, T >, T > | get () const |
This getter is only called if a wrong template parameter is given (i.e: the type does not inherit from VariantDataClass). More... | |
template<> | |
std::int8_t | get () const |
template<> | |
std::int16_t | get () const |
template<> | |
std::int32_t | get () const |
template<> | |
std::int64_t | get () const |
template<> | |
std::uint8_t | get () const |
template<> | |
std::uint8_t | get () const |
template<> | |
std::uint16_t | get () const |
template<> | |
std::uint32_t | get () const |
template<> | |
std::uint64_t | get () const |
template<> | |
bool | get () const |
template<> | |
float | get () const |
template<> | |
double | get () const |
template<> | |
std::string | get () const |
bool | getBool (const Ice::Current &c=Ice::emptyCurrent) const override |
Return the Variant's value as bool. More... | |
template<class TVariantDataClass > | |
IceInternal::Handle< TVariantDataClass > | getClass () const |
Return the Variant's value as TVariantDataClass. More... | |
double | getDouble (const Ice::Current &c=Ice::emptyCurrent) const override |
Return the Variant's value as double. More... | |
float | getFloat (const Ice::Current &c=Ice::emptyCurrent) const override |
Return the Variant's value as float. More... | |
bool | getInitialized (const Ice::Current &c=Ice::emptyCurrent) const override |
Tells if the Variant is properly initialized. More... | |
int | getInt (const Ice::Current &c=Ice::emptyCurrent) const override |
Return the Variant's value as int. More... | |
long | getLong (const Ice::Current &c=Ice::emptyCurrent) const override |
Return the Variant's value as long. More... | |
virtual std::string | getOutputValueOnly () const |
Returns the formatted content of the Variant as a string. More... | |
std::string | getString (const Ice::Current &c=Ice::emptyCurrent) const override |
Return the Variant's value as string. More... | |
VariantTypeId | getType (const Ice::Current &c=Ice::emptyCurrent) const override |
Return the Variant's internal type. More... | |
std::string | getTypeName (const Ice::Current &c=Ice::emptyCurrent) const override |
Return the Variant's internal type. More... | |
Variant & | operator= (bool b) |
Variant & | operator= (const std::string &s) |
Variant & | operator= (const Variant &prototype) |
Variant & | operator= (const VariantDataClass &prototype) |
Variant & | operator= (const VariantDataClassPtr &prototype) |
Variant & | operator= (double d) |
Variant & | operator= (float f) |
Variant & | operator= (int n) |
Variant & | operator= (long n) |
template<> | |
void | set (const bool &value) |
template<> | |
void | set (const bool &value) |
template<> | |
void | set (const double &value) |
template<> | |
void | set (const double &value) |
template<> | |
void | set (const float &value) |
template<> | |
void | set (const float &value) |
template<> | |
void | set (const std::int16_t &value) |
template<> | |
void | set (const std::int32_t &value) |
template<> | |
void | set (const std::int64_t &value) |
template<> | |
void | set (const std::int8_t &value) |
template<> | |
void | set (const std::string &value) |
template<> | |
void | set (const std::uint16_t &value) |
template<> | |
void | set (const std::uint32_t &value) |
template<> | |
void | set (const std::uint64_t &value) |
template<> | |
void | set (const std::uint8_t &value) |
template<> | |
void | set (const std::uint8_t &value) |
template<typename T > | |
std::enable_if_t<!std::is_base_of_v< VariantDataClass, T > > | set (const T &value) |
Template-based setter for the Variant's value for non-VariantDataClass-instances. More... | |
template<typename T > | |
std::enable_if_t< std::is_base_of_v< VariantDataClass, T > > | set (const VariantDataClassPtr &variantDataClass) |
Template-based setter for the Variant's value for VariantDataClass-instances. More... | |
void | setBool (bool b, const Ice::Current &c=Ice::emptyCurrent) override |
Sets the Variant's value to b. More... | |
void | setClass (const VariantDataClass &variantDataClass) |
Sets the Variant's value to variantDataClass. More... | |
void | setClass (const VariantDataClassPtr &variantDataClass) |
Sets the Variant's value to variantDataClass. More... | |
void | setDouble (double d, const Ice::Current &c=Ice::emptyCurrent) override |
Sets the Variant's value to d. More... | |
void | setFloat (float f, const Ice::Current &c=Ice::emptyCurrent) override |
Sets the Variant's value to f. More... | |
void | setInt (int n, const Ice::Current &c=Ice::emptyCurrent) override |
Sets the Variant's value to n. More... | |
void | setLong (long n, const Ice::Current &c=Ice::emptyCurrent) override |
Sets the Variant's value to n. More... | |
void | setString (const std::string &s, const Ice::Current &c=Ice::emptyCurrent) override |
Sets the Variant's value to s. More... | |
void | setType (VariantTypeId typeId, const Ice::Current &c=Ice::emptyCurrent) override |
Sets the Variant's type to typeId. More... | |
bool | validate (const Ice::Current &c=Ice::emptyCurrent) const override |
Checks if the Variant is initialized and the stored value is valid with respect to the Variant's type. More... | |
Variant () | |
Variant (char const var[]) | |
Construct a Variant from a string. More... | |
template<> | |
Variant (const bool &var, void *) | |
template<> | |
Variant (const double &var, void *) | |
template<> | |
Variant (const float &var, void *) | |
template<class T > | |
Variant (const IceInternal::Handle< T > &var, typename std::enable_if_t< std::is_base_of_v< VariantDataClass, T >> *t=nullptr) | |
Construct a Variant from an IceHandle to a VariantDataClass instance. More... | |
template<> | |
Variant (const std::int16_t &var, void *) | |
template<> | |
Variant (const std::int32_t &var, void *) | |
template<> | |
Variant (const std::int64_t &var, void *) | |
template<> | |
Variant (const std::int8_t &var, void *) | |
template<> | |
Variant (const std::string &var, void *) | |
template<> | |
Variant (const std::uint16_t &var, void *) | |
template<> | |
Variant (const std::uint32_t &var, void *) | |
template<> | |
Variant (const std::uint64_t &var, void *) | |
template<> | |
Variant (const std::uint8_t &var, void *) | |
template<class T > | |
Variant (const T &var, typename std::enable_if_t< std::is_base_of_v< VariantDataClass, T >> *t=nullptr) | |
Construct a Variant from a reference to a VariantDataClass instance. More... | |
template<class T > | |
Variant (const T &var, typename std::enable_if_t<!(std::is_base_of_v< VariantDataClass, T >||std::is_pointer_v< T >)> *t=nullptr) | |
Construct a Variant from a non-VariantDataClass instance, e.g. More... | |
template<class T > | |
Variant (const T *var, typename std::enable_if_t< std::is_base_of_v< VariantDataClass, T >> *t=nullptr) | |
Construct a Variant from a pointer to a VariantDataClass instance. More... | |
Variant (const Variant &source) | |
Static Public Member Functions | |
static VariantTypeId | addTypeName (const std::string &typeName) |
Register a new type for the use in a Variant. More... | |
template<typename Type > | |
static std::string | GetType () |
Template-based getter for a type name. More... | |
static const std::map< VariantTypeId, std::string > & | getTypes () |
Returns the mapping of currently registered types. More... | |
static int | hashTypeName (const std::string &typeName) |
Compute and return a hash value for a given type name. More... | |
static std::string | typeToString (VariantTypeId typeId) |
Return the name of the registered type typeId. More... | |
Protected Member Functions | |
void | output (std::ostream &stream) const |
Outputs a formatted representation of the Variant to stream. More... | |
Protected Attributes | |
bool | initialized |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const Variant &rhs) |
std::ostream & | operator<< (std::ostream &stream, const VariantPtr &rhs) |
Variant | ( | ) |
|
inline |
|
inline |
Construct a Variant from a reference to a VariantDataClass instance.
The VariantDataClass is cloned!
T | The desired type of the Variant |
var | The initialization value as a T-instance |
t | For type checking only: Do not use. |
Definition at line 265 of file Variant.h.
|
inline |
Construct a Variant from an IceHandle to a VariantDataClass instance.
This is a float pointer copy.
T | The desired type of the Variant |
var | The initialization value as a handle to a T-instance |
t | For type checking only: Do not use. |
Definition at line 280 of file Variant.h.
|
inline |
Construct a Variant from a pointer to a VariantDataClass instance.
The VariantDataClass is cloned!
T | The desired type of the Variant |
var | The initialization value as a pointer to a T-instance |
t | For type checking only: Do not use. |
Definition at line 295 of file Variant.h.
Variant | ( | const std::int8_t & | var, |
void * | |||
) |
Definition at line 40 of file Variant.cpp.
Variant | ( | const std::int16_t & | var, |
void * | |||
) |
Definition at line 56 of file Variant.cpp.
Variant | ( | const std::int32_t & | var, |
void * | |||
) |
Definition at line 72 of file Variant.cpp.
Variant | ( | const std::int64_t & | var, |
void * | |||
) |
Definition at line 90 of file Variant.cpp.
Variant | ( | const std::uint8_t & | var, |
void * | |||
) |
Definition at line 106 of file Variant.cpp.
Variant | ( | const std::uint16_t & | var, |
void * | |||
) |
Definition at line 122 of file Variant.cpp.
Variant | ( | const std::uint32_t & | var, |
void * | |||
) |
Variant | ( | const std::uint64_t & | var, |
void * | |||
) |
Definition at line 176 of file Variant.cpp.
Variant | ( | const double & | var, |
void * | |||
) |
Definition at line 182 of file Variant.cpp.
Variant | ( | const bool & | var, |
void * | |||
) |
Definition at line 188 of file Variant.cpp.
Variant | ( | const std::string & | var, |
void * | |||
) |
Definition at line 194 of file Variant.cpp.
|
static |
Register a new type for the use in a Variant.
LocalException | if an already registered type has the same hash value as typeName. |
Definition at line 751 of file Variant.cpp.
|
virtual |
Returns a copy of the Variant.
Definition at line 255 of file Variant.cpp.
bool get | ( | ) | const |
float get | ( | ) | const |
double get | ( | ) | const |
|
inline |
Template-based getter for the Variant's value.
T | Type of the desired value, that inherits from VariantDataClass (e.g: Vector3, LinkedPose, ChannelRef). |
NotInitializedException | if the Variant has not been initialized yet |
InvalidTypeException | if T is not compatible with the Variant's internal type |
|
inline |
|
inline |
This getter is only called if a wrong template parameter is given (i.e: the type does not inherit from VariantDataClass).
InvalidTypeException |
std::int8_t get | ( | ) | const |
std::int16_t get | ( | ) | const |
std::int32_t get | ( | ) | const |
std::int64_t get | ( | ) | const |
std::uint8_t get | ( | ) | const |
std::uint8_t get | ( | ) | const |
std::uint16_t get | ( | ) | const |
std::uint32_t get | ( | ) | const |
std::uint64_t get | ( | ) | const |
bool get | ( | ) | const |
float get | ( | ) | const |
double get | ( | ) | const |
template std::string get< std::string > | ( | ) | const |
|
override |
Return the Variant's value as bool.
InvalidTypeException | if the Variant's type is not VariantType::Bool |
NotInitializedException | if the Variant is uninitialized |
Inherited from VariantBase Ice interface.
Definition at line 487 of file Variant.cpp.
|
inline |
Return the Variant's value as TVariantDataClass.
TVariantDataClass | The type for returning the data |
InvalidTypeException | if the Variant's type is not compatible to TVariantDataClass |
NotInitializedException | if the Variant is uninitialized |
Definition at line 472 of file Variant.h.
|
override |
Return the Variant's value as double.
InvalidTypeException | if the Variant's type is not VariantType::Double |
NotInitializedException | if the Variant is uninitialized |
Inherited from VariantBase Ice interface.
Definition at line 452 of file Variant.cpp.
|
override |
Return the Variant's value as float.
InvalidTypeException | if the Variant's type is not VariantType::Float |
NotInitializedException | if the Variant is uninitialized |
Inherited from VariantBase Ice interface.
Definition at line 434 of file Variant.cpp.
|
override |
Tells if the Variant is properly initialized.
Definition at line 591 of file Variant.cpp.
|
override |
Return the Variant's value as int.
InvalidTypeException | if the Variant's type is not VariantType::Int |
NotInitializedException | if the Variant is uninitialized |
Inherited from VariantBase Ice interface.
Definition at line 400 of file Variant.cpp.
|
override |
Return the Variant's value as long.
InvalidTypeException | if the Variant's type is not VariantType::Long |
NotInitializedException | if the Variant is uninitialized |
Inherited from VariantBase Ice interface.
Definition at line 417 of file Variant.cpp.
|
virtual |
Returns the formatted content of the Variant as a string.
Reimplemented in TimedVariant.
Definition at line 504 of file Variant.cpp.
|
override |
Return the Variant's value as string.
InvalidTypeException | if the Variant's type is not VariantType::String |
NotInitializedException | if the Variant is uninitialized |
Inherited from VariantBase Ice interface.
Definition at line 470 of file Variant.cpp.
|
inlinestatic |
|
override |
Return the Variant's internal type.
Definition at line 574 of file Variant.cpp.
|
override |
Return the Variant's internal type.
Definition at line 579 of file Variant.cpp.
|
static |
Returns the mapping of currently registered types.
Definition at line 746 of file Variant.cpp.
|
static |
Compute and return a hash value for a given type name.
Definition at line 699 of file Variant.cpp.
|
inline |
|
inline |
Variant & operator= | ( | const VariantDataClass & | prototype | ) |
Variant & operator= | ( | const VariantDataClassPtr & | prototype | ) |
|
inline |
|
inline |
|
inline |
|
protected |
Outputs a formatted representation of the Variant to stream.
Definition at line 669 of file Variant.cpp.
void set | ( | const bool & | value | ) |
template void set< bool > | ( | const bool & | value | ) |
void set | ( | const double & | value | ) |
template void set< double > | ( | const double & | value | ) |
void set | ( | const float & | value | ) |
template void set< std::int16_t > | ( | const std::int16_t & | value | ) |
template void set< std::int32_t > | ( | const std::int32_t & | value | ) |
template void set< std::int64_t > | ( | const std::int64_t & | value | ) |
template void set< std::int8_t > | ( | const std::int8_t & | value | ) |
template void set< std::string > | ( | const std::string & | value | ) |
template void set< std::uint16_t > | ( | const std::uint16_t & | value | ) |
template void set< std::uint32_t > | ( | const std::uint32_t & | value | ) |
template void set< std::uint64_t > | ( | const std::uint64_t & | value | ) |
void set | ( | const std::uint8_t & | value | ) |
template void set< std::uint8_t > | ( | const std::uint8_t & | value | ) |
Template-based setter for the Variant's value for non-VariantDataClass-instances.
Values not derived from VariantDataClass are not allowed, thus this method always throws an exception.
T | The desired type of the Variant |
InvalidTypeException |
Definition at line 524 of file Variant.h.
|
inline |
Template-based setter for the Variant's value for VariantDataClass-instances.
T | The desired type of the Variant |
InvalidTypeException | if a type other than T has already been set. |
Definition at line 507 of file Variant.h.
|
override |
Sets the Variant's value to b.
The Variant's type is fixed to VariantType::Bool.
InvalidTypeException | if a different type has already been set. |
Inherited from VariantBase Ice interface.
Definition at line 357 of file Variant.cpp.
void setClass | ( | const VariantDataClass & | variantDataClass | ) |
Sets the Variant's value to variantDataClass.
The Variant's type is fixed to the type of variantDataClass. The data class is cloned!
InvalidTypeException | if a different type has already been set. |
Inherited from VariantBase Ice interface.
Definition at line 385 of file Variant.cpp.
void setClass | ( | const VariantDataClassPtr & | variantDataClass | ) |
Sets the Variant's value to variantDataClass.
The Variant's type is fixed to the type of variantDataClass. Flat pointer copy!
InvalidTypeException | if a different type has already been set. |
Inherited from VariantBase Ice interface.
Definition at line 374 of file Variant.cpp.
|
override |
Sets the Variant's value to d.
The Variant's type is fixed to VariantType::Double.
InvalidTypeException | if a different type has already been set. |
Inherited from VariantBase Ice interface.
Definition at line 323 of file Variant.cpp.
|
override |
Sets the Variant's value to f.
The Variant's type is fixed to VariantType::Float.
InvalidTypeException | if a different type has already been set. |
Inherited from VariantBase Ice interface.
Definition at line 306 of file Variant.cpp.
|
override |
Sets the Variant's value to n.
The Variant's type is fixed to VariantType::Int.
InvalidTypeException | if a different type has already been set. |
Inherited from VariantBase Ice interface.
Definition at line 274 of file Variant.cpp.
|
override |
Sets the Variant's value to n.
The Variant's type is fixed to VariantType::Long.
InvalidTypeException | if a different type has already been set. |
Inherited from VariantBase Ice interface.
Definition at line 290 of file Variant.cpp.
|
override |
Sets the Variant's value to s.
The Variant's type is fixed to VariantType::String.
InvalidTypeException | if a different type has already been set. |
Inherited from VariantBase Ice interface.
Definition at line 340 of file Variant.cpp.
|
override |
Sets the Variant's type to typeId.
A Variant's type can not be changed after it has been set.
LocalException | if a different type has already been set. |
Inherited from VariantBase Ice interface.
Definition at line 264 of file Variant.cpp.
|
static |
Return the name of the registered type typeId.
UnknownTypeException | if typeId is not registered yet. |
Definition at line 732 of file Variant.cpp.
|
override |
Checks if the Variant is initialized and the stored value is valid with respect to the Variant's type.
Inherited from VariantBase Ice interface.
Definition at line 601 of file Variant.cpp.
|
friend |
|
friend |