Collection variant type. More...
#include <CollectionVariant.h>
Classes | |
class | Value |
Collection variant value (abstract base) More... | |
Public Member Functions | |
CollectionVariant () | |
Default constructor. | |
CollectionVariant (const CollectionVariant &src) | |
Copy constructor. | |
CollectionVariant (const Variant &src) | |
Copy constructor (overloaded version taking a variant) | |
Variant | getMember (int index) const |
Retrieve a member of the collection by index. | |
Variant | getMember (const std::string &name) const |
Retrieve a member of the collection by name. | |
size_t | getNumMembers () const |
Retrieve the number of members of the collection. | |
template<typename T > | |
T & | getValue (int index) |
Retrieve a member value of the collection by index (non-const version) | |
template<typename T > | |
const T & | getValue (int index) const |
Retrieve a member value of the collection by index (const version) | |
template<typename T > | |
T & | getValue (const std::string &name) |
Retrieve a member value of the collection by name (non-const version) | |
template<typename T > | |
const T & | getValue (const std::string &name) const |
Retrieve a member value of the collection by name (const version) | |
bool | hasMember (const std::string &name) const |
True, if the collection contains the member with the specified name. | |
bool | isEmpty () const |
True, if the collection is empty. | |
Variant | operator[] (int index) const |
Operator for retrieving the members of the collection by index. | |
Variant | operator[] (const char *name) const |
Operator for retrieving the members of the collection by name (overloaded version taking a char array name) | |
void | setMember (int index, const Variant &member) |
Set a member of the collection by index. | |
void | setMember (const std::string &name, const Variant &member) |
Set a member of the collection by name. | |
~CollectionVariant () | |
Destructor. | |
Protected Member Functions | |
CollectionVariant (const DataType &type) | |
Constructor (overloaded version taking a data type) | |
Friends | |
class | Variant |
Collection variant type.
Definition at line 31 of file CollectionVariant.h.
Default constructor.
Definition at line 30 of file CollectionVariant.cpp.
Copy constructor.
Definition at line 37 of file CollectionVariant.cpp.
variant_topic_tools::CollectionVariant::CollectionVariant | ( | const Variant & | src | ) |
Copy constructor (overloaded version taking a variant)
Definition at line 41 of file CollectionVariant.cpp.
Destructor.
Definition at line 47 of file CollectionVariant.cpp.
variant_topic_tools::CollectionVariant::CollectionVariant | ( | const DataType & | type | ) | [protected] |
Constructor (overloaded version taking a data type)
Definition at line 33 of file CollectionVariant.cpp.
Variant variant_topic_tools::CollectionVariant::getMember | ( | int | index | ) | const |
Retrieve a member of the collection by index.
Definition at line 82 of file CollectionVariant.cpp.
Variant variant_topic_tools::CollectionVariant::getMember | ( | const std::string & | name | ) | const |
Retrieve a member of the collection by name.
Definition at line 89 of file CollectionVariant.cpp.
size_t variant_topic_tools::CollectionVariant::getNumMembers | ( | ) | const |
Retrieve the number of members of the collection.
Definition at line 60 of file CollectionVariant.cpp.
T& variant_topic_tools::CollectionVariant::getValue | ( | int | index | ) |
Retrieve a member value of the collection by index (non-const version)
const T& variant_topic_tools::CollectionVariant::getValue | ( | int | index | ) | const |
Retrieve a member value of the collection by index (const version)
T& variant_topic_tools::CollectionVariant::getValue | ( | const std::string & | name | ) |
Retrieve a member value of the collection by name (non-const version)
const T& variant_topic_tools::CollectionVariant::getValue | ( | const std::string & | name | ) | const |
Retrieve a member value of the collection by name (const version)
bool variant_topic_tools::CollectionVariant::hasMember | ( | const std::string & | name | ) | const |
True, if the collection contains the member with the specified name.
Definition at line 96 of file CollectionVariant.cpp.
bool variant_topic_tools::CollectionVariant::isEmpty | ( | ) | const |
True, if the collection is empty.
Reimplemented from variant_topic_tools::Variant.
Definition at line 103 of file CollectionVariant.cpp.
Variant variant_topic_tools::CollectionVariant::operator[] | ( | int | index | ) | const |
Operator for retrieving the members of the collection by index.
Definition at line 214 of file CollectionVariant.cpp.
Variant variant_topic_tools::CollectionVariant::operator[] | ( | const char * | name | ) | const |
Operator for retrieving the members of the collection by name (overloaded version taking a char array name)
Definition at line 218 of file CollectionVariant.cpp.
void variant_topic_tools::CollectionVariant::setMember | ( | int | index, |
const Variant & | member | ||
) |
Set a member of the collection by index.
Definition at line 67 of file CollectionVariant.cpp.
void variant_topic_tools::CollectionVariant::setMember | ( | const std::string & | name, |
const Variant & | member | ||
) |
Set a member of the collection by name.
Definition at line 74 of file CollectionVariant.cpp.
friend class Variant [friend] |
Reimplemented in variant_topic_tools::MessageVariant, and variant_topic_tools::ArrayVariant.
Definition at line 33 of file CollectionVariant.h.