Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
variant_topic_tools::ArrayVariant Class Reference

Array variant type. More...

#include <ArrayVariant.h>

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

Classes

class  Value
 Array variant value (abstract base) More...
 
class  ValueImplT
 Array variant value (templated implementation) More...
 
class  ValueImplV
 Array variant value (variant-typed implementation) More...
 

Public Member Functions

void addMember (const Variant &member)
 Add a member to the array. More...
 
 ArrayVariant ()
 Default constructor. More...
 
 ArrayVariant (const ArrayVariant &src)
 Copy constructor. More...
 
 ArrayVariant (const Variant &src)
 Copy constructor (overloaded version taking a variant) More...
 
void clear ()
 Clear the array. More...
 
ArrayVariantoperator+= (const Variant &member)
 Operator for adding a member to the array. More...
 
void resize (size_t numMembers)
 Resize the array. More...
 
 ~ArrayVariant ()
 Destructor. More...
 
- Public Member Functions inherited from variant_topic_tools::CollectionVariant
 CollectionVariant ()
 Default constructor. More...
 
 CollectionVariant (const CollectionVariant &src)
 Copy constructor. More...
 
 CollectionVariant (const Variant &src)
 Copy constructor (overloaded version taking a variant) More...
 
Variant getMember (int index) const
 Retrieve a member of the collection by index. More...
 
Variant getMember (const std::string &name) const
 Retrieve a member of the collection by name. More...
 
size_t getNumMembers () const
 Retrieve the number of members of the collection. More...
 
template<typename T >
T & getValue (int index)
 Retrieve a member value of the collection by index (non-const version) More...
 
template<typename T >
const T & getValue (int index) const
 Retrieve a member value of the collection by index (const version) More...
 
template<typename T >
T & getValue (const std::string &name)
 Retrieve a member value of the collection by name (non-const version) More...
 
template<typename T >
const T & getValue (const std::string &name) const
 Retrieve a member value of the collection by name (const version) More...
 
bool hasMember (const std::string &name) const
 True, if the collection contains the member with the specified name. More...
 
bool isEmpty () const
 True, if the collection is empty. More...
 
Variant operator[] (int index) const
 Operator for retrieving the members of the collection by index. More...
 
Variant operator[] (const char *name) const
 Operator for retrieving the members of the collection by name (overloaded version taking a char array name) More...
 
void setMember (int index, const Variant &member)
 Set a member of the collection by index. More...
 
void setMember (const std::string &name, const Variant &member)
 Set a member of the collection by name. More...
 
 ~CollectionVariant ()
 Destructor. More...
 
- Public Member Functions inherited from variant_topic_tools::Variant
ArrayVariant asArray () const
 Retrieve this variant as array. More...
 
BuiltinVariant asBuiltin () const
 Retrieve this variant as builtin. More...
 
CollectionVariant asCollection () const
 Retrieve this variant as collection. More...
 
MessageVariant asMessage () const
 Retrieve this variant as message. More...
 
void clear ()
 Clear the variant. More...
 
Serializer createSerializer () const
 Create a serializer for this variant. More...
 
const DataTypegetType () const
 Retrieve the data type of this variant. More...
 
template<typename T >
type_traits::DataType< T >::ValueType & getValue ()
 Retrieve the variant's value (non-const version) More...
 
template<typename T >
const type_traits::DataType< T >::ValueType & getValue () const
 Retrieve the variant's value (const version) More...
 
const std::type_info & getValueTypeInfo () const
 Retrieve the value type information of this variant. More...
 
bool hasType () const
 True, if the variant has a type. More...
 
bool isArray () const
 True, if this variant represents an array. More...
 
bool isBuiltin () const
 True, if this variant represents a built-in. More...
 
bool isCollection () const
 True, if this variant represents a collection. More...
 
bool isEmpty () const
 True, if the variant is empty, i.e., does not have a value assigned. More...
 
bool isMessage () const
 True, if this variant represents a message. More...
 
template<typename T >
 operator T () const
 Conversion operator. More...
 
template<typename T >
bool operator!= (const T &value) const
 True, if this variant's value does not equal another value. More...
 
template<typename T >
Variantoperator= (const T &src)
 Assignment operator. More...
 
template<typename T >
bool operator== (const T &value) const
 True, if this variant's value equals another value. More...
 
void read (std::istream &stream)
 Read the variant from a stream. More...
 
template<typename T >
void setValue (const T &value)
 Set the variant's value. More...
 
 Variant ()
 Default constructor. More...
 
template<typename T >
 Variant (const T &src)
 Copy constructor. More...
 
void write (std::ostream &stream) const
 Write the variant to a stream. More...
 
 ~Variant ()
 Destructor. More...
 

Protected Member Functions

 ArrayVariant (const DataType &type, const DataType &memberType, size_t numMembers)
 Constructor (overloaded version taking an array data type and a size) More...
 
- Protected Member Functions inherited from variant_topic_tools::CollectionVariant
 CollectionVariant (const DataType &type)
 Constructor (overloaded version taking a data type) More...
 
- Protected Member Functions inherited from variant_topic_tools::Variant
 Variant (const DataType &type)
 Constructor (overloaded version taking a data type) More...
 

Static Protected Member Functions

template<typename T >
static void add (typename type_traits::ArrayType< T >::ValueType &array, const typename type_traits::ArrayType< T >::MemberType &member, typename boost::enable_if< typename type_traits::ArrayType< T >::IsDynamic >::type *=0)
 Add a member to an array (overloaded version taking a dynamic array) More...
 
template<typename T >
static void add (typename type_traits::ArrayType< T >::ValueType &array, const typename type_traits::ArrayType< T >::MemberType &member, typename boost::disable_if< typename type_traits::ArrayType< T >::IsDynamic >::type *=0)
 Add a member to an array (overloaded version taking a non-dynamic array) More...
 
template<typename T >
static void clear (typename type_traits::ArrayType< T >::ValueType &array, typename boost::enable_if< typename type_traits::ArrayType< T >::IsDynamic >::type *=0)
 Clear an array (overloaded version taking a dynamic array) More...
 
template<typename T >
static void clear (typename type_traits::ArrayType< T >::ValueType &array, typename boost::disable_if< typename type_traits::ArrayType< T >::IsDynamic >::type *=0)
 Clear an array (overloaded version taking a non-dynamic array) More...
 
template<typename T >
static ArrayVariant create (const DataType &type, const DataType &memberType)
 Create an array variant. More...
 
template<typename T >
static void initialize (typename type_traits::ArrayType< T >::ValueType &array, typename boost::enable_if< typename type_traits::ArrayType< T >::IsDynamic >::type *=0)
 Initialize an array (overloaded version taking a dynamic array) More...
 
template<typename T >
static void initialize (typename type_traits::ArrayType< T >::ValueType &array, typename boost::disable_if< typename type_traits::ArrayType< T >::IsDynamic >::type *=0)
 Initialize an array (overloaded version taking a non-dynamic array) More...
 
template<typename T >
static void resize (typename type_traits::ArrayType< T >::ValueType &array, size_t numMembers, typename boost::enable_if< typename type_traits::ArrayType< T >::IsDynamic >::type *=0)
 Resize an array (overloaded version taking a dynamic array) More...
 
template<typename T >
static void resize (typename type_traits::ArrayType< T >::ValueType &array, size_t numMembers, typename boost::disable_if< typename type_traits::ArrayType< T >::IsDynamic >::type *=0)
 Resize an array (overloaded version taking a non-dynamic array) More...
 
- Static Protected Member Functions inherited from variant_topic_tools::Variant
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) More...
 
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) More...
 
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) More...
 
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) More...
 
template<typename T >
static void set (Variant &variant, const Pointer< typename type_traits::DataType< T >::ValueType > &value)
 Set a variant's value pointer. More...
 
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) More...
 
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) More...
 

Friends

class ArrayDataType
 
class Variant
 

Additional Inherited Members

- Protected Types inherited from variant_topic_tools::Variant
typedef boost::shared_ptr< ValueValuePtr
 Declaration of the variant value pointer type. More...
 
typedef boost::weak_ptr< ValueValueWPtr
 Declaration of the variant value weak pointer type. More...
 
- Protected Attributes inherited from variant_topic_tools::Variant
DataType type
 The variant's data type. More...
 
ValuePtr value
 The variant's data value. More...
 

Detailed Description

Array variant type.

Definition at line 34 of file ArrayVariant.h.

Constructor & Destructor Documentation

variant_topic_tools::ArrayVariant::ArrayVariant ( )

Default constructor.

Definition at line 30 of file ArrayVariant.cpp.

variant_topic_tools::ArrayVariant::ArrayVariant ( const ArrayVariant src)

Copy constructor.

Definition at line 40 of file ArrayVariant.cpp.

variant_topic_tools::ArrayVariant::ArrayVariant ( const Variant src)

Copy constructor (overloaded version taking a variant)

Definition at line 44 of file ArrayVariant.cpp.

variant_topic_tools::ArrayVariant::~ArrayVariant ( )

Destructor.

Definition at line 50 of file ArrayVariant.cpp.

variant_topic_tools::ArrayVariant::ArrayVariant ( const DataType type,
const DataType memberType,
size_t  numMembers 
)
protected

Constructor (overloaded version taking an array data type and a size)

Definition at line 33 of file ArrayVariant.cpp.

Member Function Documentation

template<typename T >
static void variant_topic_tools::ArrayVariant::add ( typename type_traits::ArrayType< T >::ValueType &  array,
const typename type_traits::ArrayType< T >::MemberType &  member,
typename boost::enable_if< typename type_traits::ArrayType< T >::IsDynamic >::type = 0 
)
staticprotected

Add a member to an array (overloaded version taking a dynamic array)

template<typename T >
static void variant_topic_tools::ArrayVariant::add ( typename type_traits::ArrayType< T >::ValueType &  array,
const typename type_traits::ArrayType< T >::MemberType &  member,
typename boost::disable_if< typename type_traits::ArrayType< T >::IsDynamic >::type = 0 
)
staticprotected

Add a member to an array (overloaded version taking a non-dynamic array)

void variant_topic_tools::ArrayVariant::addMember ( const Variant member)

Add a member to the array.

Note
An attempt to adding a member to a non-dynamic array will result in an exception being thrown. Further, the data type of the variant member to be added must match the member type of this array.

Definition at line 154 of file ArrayVariant.cpp.

void variant_topic_tools::ArrayVariant::clear ( )

Clear the array.

Note
An attempt to clearing a non-dynamic array will result in an exception being thrown.

Definition at line 172 of file ArrayVariant.cpp.

template<typename T >
static void variant_topic_tools::ArrayVariant::clear ( typename type_traits::ArrayType< T >::ValueType &  array,
typename boost::enable_if< typename type_traits::ArrayType< T >::IsDynamic >::type = 0 
)
staticprotected

Clear an array (overloaded version taking a dynamic array)

template<typename T >
static void variant_topic_tools::ArrayVariant::clear ( typename type_traits::ArrayType< T >::ValueType &  array,
typename boost::disable_if< typename type_traits::ArrayType< T >::IsDynamic >::type = 0 
)
staticprotected

Clear an array (overloaded version taking a non-dynamic array)

template<typename T >
static ArrayVariant variant_topic_tools::ArrayVariant::create ( const DataType type,
const DataType memberType 
)
staticprotected

Create an array variant.

template<typename T >
static void variant_topic_tools::ArrayVariant::initialize ( typename type_traits::ArrayType< T >::ValueType &  array,
typename boost::enable_if< typename type_traits::ArrayType< T >::IsDynamic >::type = 0 
)
staticprotected

Initialize an array (overloaded version taking a dynamic array)

template<typename T >
static void variant_topic_tools::ArrayVariant::initialize ( typename type_traits::ArrayType< T >::ValueType &  array,
typename boost::disable_if< typename type_traits::ArrayType< T >::IsDynamic >::type = 0 
)
staticprotected

Initialize an array (overloaded version taking a non-dynamic array)

ArrayVariant & variant_topic_tools::ArrayVariant::operator+= ( const Variant member)

Operator for adding a member to the array.

Definition at line 245 of file ArrayVariant.cpp.

void variant_topic_tools::ArrayVariant::resize ( size_t  numMembers)

Resize the array.

Note
An attempt to resizing a non-dynamic array will result in an exception being thrown.

Definition at line 165 of file ArrayVariant.cpp.

template<typename T >
static void variant_topic_tools::ArrayVariant::resize ( typename type_traits::ArrayType< T >::ValueType &  array,
size_t  numMembers,
typename boost::enable_if< typename type_traits::ArrayType< T >::IsDynamic >::type = 0 
)
staticprotected

Resize an array (overloaded version taking a dynamic array)

template<typename T >
static void variant_topic_tools::ArrayVariant::resize ( typename type_traits::ArrayType< T >::ValueType &  array,
size_t  numMembers,
typename boost::disable_if< typename type_traits::ArrayType< T >::IsDynamic >::type = 0 
)
staticprotected

Resize an array (overloaded version taking a non-dynamic array)

Friends And Related Function Documentation

friend class ArrayDataType
friend

Definition at line 36 of file ArrayVariant.h.

friend class Variant
friend

Definition at line 37 of file ArrayVariant.h.


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


variant_topic_tools
Author(s): Ralf Kaestner
autogenerated on Sat Jan 9 2021 03:56:50