#include <Variant.h>
Classes | |
class | Value |
Variant value (abstract base) More... | |
class | ValueT |
Variant value (templated abstract base) More... | |
Public Member Functions | |
ArrayVariant | asArray () const |
Retrieve this variant as array. | |
BuiltinVariant | asBuiltin () const |
Retrieve this variant as builtin. | |
CollectionVariant | asCollection () const |
Retrieve this variant as collection. | |
MessageVariant | asMessage () const |
Retrieve this variant as message. | |
void | clear () |
Clear the variant. | |
Serializer | createSerializer () const |
Create a serializer for this variant. | |
const DataType & | getType () const |
Retrieve the data type of this variant. | |
template<typename T > | |
type_traits::DataType< T > ::ValueType & | getValue () |
Retrieve the variant's value (non-const version) | |
template<typename T > | |
const type_traits::DataType< T > ::ValueType & | getValue () const |
Retrieve the variant's value (const version) | |
const std::type_info & | getValueTypeInfo () const |
Retrieve the value type information of this variant. | |
bool | hasType () const |
True, if the variant has a type. | |
bool | isArray () const |
True, if this variant represents an array. | |
bool | isBuiltin () const |
True, if this variant represents a built-in. | |
bool | isCollection () const |
True, if this variant represents a collection. | |
bool | isEmpty () const |
True, if the variant is empty, i.e., does not have a value assigned. | |
bool | isMessage () const |
True, if this variant represents a message. | |
template<typename T > | |
operator T () const | |
Conversion operator. | |
template<typename T > | |
bool | operator!= (const T &value) const |
True, if this variant's value does not equal another value. | |
template<typename T > | |
Variant & | operator= (const T &src) |
Assignment operator. | |
template<typename T > | |
bool | operator== (const T &value) const |
True, if this variant's value equals another value. | |
void | read (std::istream &stream) |
Read the variant from a stream. | |
template<typename T > | |
void | setValue (const T &value) |
Set the variant's value. | |
Variant () | |
Default constructor. | |
template<typename T > | |
Variant (const T &src) | |
Copy constructor. | |
void | write (std::ostream &stream) const |
Write the variant to a stream. | |
~Variant () | |
Destructor. | |
Protected Types | |
typedef boost::shared_ptr< Value > | ValuePtr |
Declaration of the variant value pointer type. | |
typedef boost::weak_ptr< Value > | ValueWPtr |
Declaration of the variant value weak pointer type. | |
Protected Member Functions | |
Variant (const DataType &type) | |
Constructor (overloaded version taking a data type) | |
Static Protected Member Functions | |
template<typename T > | |
static void | assign (Variant &dst, const T &src, typename boost::enable_if< boost::is_base_of< Variant, T > >::type *=0) |
Assign a variant (overloaded version taking a variant) | |
template<typename T > | |
static void | assign (Variant &dst, const T &src, typename boost::disable_if< boost::is_base_of< Variant, T > >::type *=0) |
Assign a variant (overloaded version taking a variant value) | |
template<typename T > | |
static bool | isEqual (const Variant &variant, const T &value, typename boost::enable_if< boost::is_base_of< Variant, T > >::type *=0) |
True, if a variant's value equals another value (overloaded version taking a variant) | |
template<typename T > | |
static bool | isEqual (const Variant &variant, const T &value, typename boost::disable_if< boost::is_base_of< Variant, T > >::type *=0) |
True, if a variant's value equals another value (overloaded version taking a variant value) | |
template<typename T > | |
static void | set (Variant &variant, const Pointer< typename type_traits::DataType< T >::ValueType > &value) |
Set a variant's value pointer. | |
template<typename T > | |
static void | setValue (Variant &dst, const T &value, typename boost::enable_if< boost::is_base_of< Variant, T > >::type *=0) |
Set a variant's value (overloaded version taking a variant) | |
template<typename T > | |
static void | setValue (Variant &dst, const T &value, typename boost::disable_if< boost::is_base_of< Variant, T > >::type *=0) |
Set a variant's value (overloaded version taking a variant value) | |
Protected Attributes | |
DataType | type |
The variant's data type. | |
ValuePtr | value |
The variant's data value. | |
Friends | |
class | MessageVariable |
typedef boost::shared_ptr<Value> variant_topic_tools::Variant::ValuePtr [protected] |
typedef boost::weak_ptr<Value> variant_topic_tools::Variant::ValueWPtr [protected] |
Default constructor.
Definition at line 32 of file Variant.cpp.
variant_topic_tools::Variant::Variant | ( | const T & | src | ) |
Copy constructor.
Destructor.
Definition at line 39 of file Variant.cpp.
variant_topic_tools::Variant::Variant | ( | const DataType & | type | ) | [protected] |
Constructor (overloaded version taking a data type)
Definition at line 35 of file Variant.cpp.
Retrieve this variant as array.
Definition at line 107 of file Variant.cpp.
Retrieve this variant as builtin.
Definition at line 111 of file Variant.cpp.
Retrieve this variant as collection.
Definition at line 115 of file Variant.cpp.
Retrieve this variant as message.
Definition at line 119 of file Variant.cpp.
static void variant_topic_tools::Variant::assign | ( | Variant & | dst, |
const T & | src, | ||
typename boost::enable_if< boost::is_base_of< Variant, T > >::type * | = 0 |
||
) | [static, protected] |
Assign a variant (overloaded version taking a variant)
static void variant_topic_tools::Variant::assign | ( | Variant & | dst, |
const T & | src, | ||
typename boost::disable_if< boost::is_base_of< Variant, T > >::type * | = 0 |
||
) | [static, protected] |
Assign a variant (overloaded version taking a variant value)
void variant_topic_tools::Variant::clear | ( | ) |
Clear the variant.
Reimplemented in variant_topic_tools::ArrayVariant.
Definition at line 123 of file Variant.cpp.
Create a serializer for this variant.
Definition at line 138 of file Variant.cpp.
const DataType & variant_topic_tools::Variant::getType | ( | ) | const |
Retrieve the data type of this variant.
Definition at line 52 of file Variant.cpp.
type_traits::DataType<T>::ValueType& variant_topic_tools::Variant::getValue | ( | ) |
Retrieve the variant's value (non-const version)
const type_traits::DataType<T>::ValueType& variant_topic_tools::Variant::getValue | ( | ) | const |
Retrieve the variant's value (const version)
const std::type_info & variant_topic_tools::Variant::getValueTypeInfo | ( | ) | const |
Retrieve the value type information of this variant.
Definition at line 56 of file Variant.cpp.
bool variant_topic_tools::Variant::hasType | ( | ) | const |
True, if the variant has a type.
Definition at line 63 of file Variant.cpp.
bool variant_topic_tools::Variant::isArray | ( | ) | const |
True, if this variant represents an array.
Definition at line 67 of file Variant.cpp.
bool variant_topic_tools::Variant::isBuiltin | ( | ) | const |
True, if this variant represents a built-in.
Definition at line 74 of file Variant.cpp.
bool variant_topic_tools::Variant::isCollection | ( | ) | const |
True, if this variant represents a collection.
Definition at line 81 of file Variant.cpp.
bool variant_topic_tools::Variant::isEmpty | ( | ) | const |
True, if the variant is empty, i.e., does not have a value assigned.
Reimplemented in variant_topic_tools::CollectionVariant.
Definition at line 95 of file Variant.cpp.
static bool variant_topic_tools::Variant::isEqual | ( | const Variant & | variant, |
const T & | value, | ||
typename boost::enable_if< boost::is_base_of< Variant, T > >::type * | = 0 |
||
) | [static, protected] |
True, if a variant's value equals another value (overloaded version taking a variant)
static bool variant_topic_tools::Variant::isEqual | ( | const Variant & | variant, |
const T & | value, | ||
typename boost::disable_if< boost::is_base_of< Variant, T > >::type * | = 0 |
||
) | [static, protected] |
True, if a variant's value equals another value (overloaded version taking a variant value)
bool variant_topic_tools::Variant::isMessage | ( | ) | const |
True, if this variant represents a message.
Definition at line 88 of file Variant.cpp.
variant_topic_tools::Variant::operator T | ( | ) | const |
Conversion operator.
bool variant_topic_tools::Variant::operator!= | ( | const T & | value | ) | const |
True, if this variant's value does not equal another value.
Variant& variant_topic_tools::Variant::operator= | ( | const T & | src | ) |
Assignment operator.
bool variant_topic_tools::Variant::operator== | ( | const T & | value | ) | const |
True, if this variant's value equals another value.
void variant_topic_tools::Variant::read | ( | std::istream & | stream | ) |
Read the variant from a stream.
Definition at line 128 of file Variant.cpp.
static void variant_topic_tools::Variant::set | ( | Variant & | variant, |
const Pointer< typename type_traits::DataType< T >::ValueType > & | value | ||
) | [static, protected] |
Set a variant's value pointer.
void variant_topic_tools::Variant::setValue | ( | const T & | value | ) |
Set the variant's value.
static void variant_topic_tools::Variant::setValue | ( | Variant & | dst, |
const T & | value, | ||
typename boost::enable_if< boost::is_base_of< Variant, T > >::type * | = 0 |
||
) | [static, protected] |
Set a variant's value (overloaded version taking a variant)
static void variant_topic_tools::Variant::setValue | ( | Variant & | dst, |
const T & | value, | ||
typename boost::disable_if< boost::is_base_of< Variant, T > >::type * | = 0 |
||
) | [static, protected] |
Set a variant's value (overloaded version taking a variant value)
void variant_topic_tools::Variant::write | ( | std::ostream & | stream | ) | const |
Write the variant to a stream.
Definition at line 133 of file Variant.cpp.
friend class MessageVariable [friend] |
DataType variant_topic_tools::Variant::type [protected] |
ValuePtr variant_topic_tools::Variant::value [protected] |