|
The StringValueMap class is a subclass of VariantContainer and is comparable to a std::map<std::string, T> containing values of type T. More...
#include <ArmarXCore/observers/variant/StringValueMap.h>
Public Member Functions | |
void | addElement (const std::string &key, const VariantContainerBasePtr &variantContainer, const Ice::Current &c=Ice::emptyCurrent) override |
void | addVariant (const std::string &key, const Variant &variant) |
void | clear (const Ice::Current &c=Ice::emptyCurrent) override |
clear calls ::clear() on the internal StringValueMap::elements container More... | |
VariantContainerBasePtr | cloneContainer (const Ice::Current &c=Ice::emptyCurrent) const override |
void | deserialize (const ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override |
template<typename ContainerType > | |
IceInternal::Handle< ContainerType > | getElement (const std::string &key) const |
getElement is the getter-function to retrieve variants from the list. More... | |
VariantContainerBasePtr | getElementBase (const std::string &key, const Ice::Current &c=Ice::emptyCurrent) const override |
getElementBase is the slice-interface implementation for getting an Element and only returns a basepointer, so a manual upcast is usually necessary. More... | |
int | getSize (const Ice::Current &c=Ice::emptyCurrent) const override |
Ice::Int | getType (const Ice::Current &c=Ice::emptyCurrent) const override |
VariantPtr | getVariant (const std::string &key) const |
getVariant returns a pointer to a Variant object associated with key More... | |
Ice::ObjectPtr | ice_clone () const override |
StringValueMap & | operator= (const StringValueMap &source) |
void | serialize (const ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override |
void | setElement (const std::string &key, const VariantContainerBasePtr &variantContainer, const Ice::Current &c=Ice::emptyCurrent) override |
template<typename ValueType > | |
void | setElements (const std::map< std::string, ValueType > &map) |
setElements adds all pairs from map to the current instance using StringValueMap::setElement(). More... | |
template<typename ValueType > | |
void | setElements (const std::vector< std::string > &keyVec, const std::vector< ValueType > &values) |
setElements adds elements with keyVec as keys and values as associated values using StringValueMap::setElement(). More... | |
StringValueMap (bool forceSingleTypeMap=true) | |
StringValueMap (const ContainerType &subType) | |
StringValueMap (const StringValueMap &source) | |
StringValueMap (VariantTypeId subType) | |
template<typename Type > | |
std::map< std::string, Type > | toContainerStdMap () const |
toContainerStdMap creates a std::map<std::string, Type> from this container. More... | |
template<class ValueType > | |
std::map< std::string, ValueType > | toStdMap () |
toStdMap creates a std::map<std::string, ValueType> from this container. More... | |
std::string | toString (const Ice::Current &=Ice::emptyCurrent) const override |
bool | validateElements (const Ice::Current &c=Ice::emptyCurrent) override |
Public Member Functions inherited from VariantContainer | |
VariantDataClassPtr | clone (const Ice::Current &c=Ice::emptyCurrent) const override |
ContainerTypePtr | getContainerType (const Ice::Current &c=Ice::emptyCurrent) const override |
Ice::Int | getType (const Ice::Current &c=Ice::emptyCurrent) const override |
std::string | output (const Ice::Current &c=Ice::emptyCurrent) const override |
void | setContainerType (const ContainerTypePtr &containerType, const Ice::Current &c=Ice::emptyCurrent) override |
bool | validate (const Ice::Current &c=Ice::emptyCurrent) override |
Static Public Member Functions | |
template<typename Type > | |
static StringValueMapPtr | FromContainerStdMap (const std::map< std::string, Type > &map) |
FromStdMap creates a StringValueMap from a std::map<std::string, Type>. More... | |
template<typename Type > | |
static StringValueMapPtr | FromStdMap (const std::map< std::string, Type > &map) |
FromStdMap creates a StringValueMap from a std::map<std::string, Type>. More... | |
static VariantTypeId | getStaticType (const Ice::Current &c=Ice::emptyCurrent) |
static std::string | getTypePrefix () |
Protected Attributes | |
bool | forceSingleTypeMap = true |
The StringValueMap class is a subclass of VariantContainer and is comparable to a std::map<std::string, T> containing values of type T.
Definition at line 49 of file StringValueMap.h.
StringValueMap | ( | bool | forceSingleTypeMap = true | ) |
StringValueMap | ( | const StringValueMap & | source | ) |
|
explicit |
Definition at line 50 of file StringValueMap.cpp.
|
explicit |
Definition at line 44 of file StringValueMap.cpp.
|
override |
Definition at line 92 of file StringValueMap.cpp.
void addVariant | ( | const std::string & | key, |
const Variant & | variant | ||
) |
|
override |
clear calls ::clear() on the internal StringValueMap::elements container
c |
Definition at line 123 of file StringValueMap.cpp.
|
override |
|
override |
|
inlinestatic |
FromStdMap creates a StringValueMap from a std::map<std::string, Type>.
Definition at line 219 of file StringValueMap.h.
|
inlinestatic |
FromStdMap creates a StringValueMap from a std::map<std::string, Type>.
Definition at line 196 of file StringValueMap.h.
|
inline |
getElement is the getter-function to retrieve variants from the list.
index | is the index of the Element in the list |
IndexOutOfBoundsException |
Definition at line 125 of file StringValueMap.h.
|
override |
getElementBase is the slice-interface implementation for getting an Element and only returns a basepointer, so a manual upcast is usually necessary.
This function exists only for completeness and compatibility. Usually you should use the getElement()-function.
index | is the index of the Element in the list |
c | Not needed, leave blank. |
IndexOutOfBoundsException |
Definition at line 155 of file StringValueMap.cpp.
|
override |
Definition at line 137 of file StringValueMap.cpp.
|
static |
Definition at line 130 of file StringValueMap.cpp.
|
override |
|
static |
VariantPtr getVariant | ( | const std::string & | key | ) | const |
getVariant returns a pointer to a Variant object associated with key
key |
Definition at line 167 of file StringValueMap.cpp.
|
override |
StringValueMap & operator= | ( | const StringValueMap & | source | ) |
|
override |
Definition at line 199 of file StringValueMap.cpp.
|
override |
Definition at line 107 of file StringValueMap.cpp.
void setElements | ( | const std::map< std::string, ValueType > & | map | ) |
setElements adds all pairs from map
to the current instance using StringValueMap::setElement().
Definition at line 262 of file StringValueMap.h.
void setElements | ( | const std::vector< std::string > & | keyVec, |
const std::vector< ValueType > & | values | ||
) |
setElements adds elements with keyVec
as keys and values
as associated values using StringValueMap::setElement().
If the vectors sizes do not match, only the minimal amount of pairs is added.
Definition at line 272 of file StringValueMap.h.
|
inline |
toContainerStdMap creates a std::map<std::string, Type> from this container.
Type must be a subclass of VariantContainer. Use this for nested VariantContainers.
Definition at line 171 of file StringValueMap.h.
|
inline |
toStdMap creates a std::map<std::string, ValueType> from this container.
ValueType must be of a type that can be stored in a Variant.
Definition at line 153 of file StringValueMap.h.
|
override |
Definition at line 185 of file StringValueMap.cpp.
|
override |
Definition at line 142 of file StringValueMap.cpp.
|
protected |
Definition at line 241 of file StringValueMap.h.