Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
variant_topic_tools::Variant Class Reference

Variant type. More...

#include <Variant.h>

Inheritance diagram for variant_topic_tools::Variant:
Inheritance graph
[legend]

List of all members.

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 DataTypegetType () 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 >
Variantoperator= (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< ValueValuePtr
 Declaration of the variant value pointer type.
typedef boost::weak_ptr< ValueValueWPtr
 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

Detailed Description

Variant type.

Definition at line 39 of file Variant.h.


Member Typedef Documentation

typedef boost::shared_ptr<Value> variant_topic_tools::Variant::ValuePtr [protected]

Declaration of the variant value pointer type.

Definition at line 155 of file Variant.h.

typedef boost::weak_ptr<Value> variant_topic_tools::Variant::ValueWPtr [protected]

Declaration of the variant value weak pointer type.

Definition at line 163 of file Variant.h.


Constructor & Destructor Documentation

Default constructor.

Definition at line 32 of file Variant.cpp.

template<typename T >
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.


Member Function Documentation

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.

template<typename T >
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)

template<typename T >
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)

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.

Retrieve the data type of this variant.

Definition at line 52 of file Variant.cpp.

template<typename T >
type_traits::DataType<T>::ValueType& variant_topic_tools::Variant::getValue ( )

Retrieve the variant's value (non-const version)

template<typename T >
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.

Note:
The value type information can be different from the type information associated with this variant's data type.

Definition at line 56 of file Variant.cpp.

True, if the variant has a type.

Definition at line 63 of file Variant.cpp.

True, if this variant represents an array.

Definition at line 67 of file Variant.cpp.

True, if this variant represents a built-in.

Definition at line 74 of file Variant.cpp.

True, if this variant represents a collection.

Definition at line 81 of file Variant.cpp.

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.

template<typename T >
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)

template<typename T >
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)

True, if this variant represents a message.

Definition at line 88 of file Variant.cpp.

template<typename T >
variant_topic_tools::Variant::operator T ( ) const

Conversion operator.

template<typename T >
bool variant_topic_tools::Variant::operator!= ( const T &  value) const

True, if this variant's value does not equal another value.

template<typename T >
Variant& variant_topic_tools::Variant::operator= ( const T &  src)

Assignment operator.

template<typename T >
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.

template<typename T >
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.

template<typename T >
void variant_topic_tools::Variant::setValue ( const T &  value)

Set the variant's value.

template<typename T >
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)

template<typename T >
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.


Friends And Related Function Documentation

friend class MessageVariable [friend]

Definition at line 40 of file Variant.h.


Member Data Documentation

The variant's data type.

Definition at line 247 of file Variant.h.

The variant's data value.

Definition at line 251 of file Variant.h.


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


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Tue Jul 9 2019 03:18:42