27#include <IceUtil/Handle.h>
30#include <ArmarXCore/interface/observers/VariantContainers.h>
48 virtual public SingleTypeVariantListBase
56 VariantContainerBasePtr
57 cloneContainer(
const Ice::Current&
c = Ice::emptyCurrent)
const override;
58 Ice::ObjectPtr
ice_clone()
const override;
61 void addElement(
const VariantContainerBasePtr& variantContainer,
62 const Ice::Current&
c = Ice::emptyCurrent)
override;
64 void clear(
const Ice::Current&
c = Ice::emptyCurrent)
override;
67 Ice::Int
getType(
const Ice::Current&
c = Ice::emptyCurrent)
const override;
69 int getSize(
const Ice::Current&
c = Ice::emptyCurrent)
const override;
84 VariantContainerBasePtr
87 template <
typename ContainerType>
96 throw InvalidTypeException();
109 template <
typename T1,
typename T2>
110 static std::map<T1, T2>
113 if (l1->getSize() != l2->getSize())
115 throw LocalException(
"List lengths do not match:")
116 << l1->getSize() <<
" != " << l2->getSize();
119 std::map<T1, T2> result;
120 size_t size = l1->getSize();
122 for (
size_t i = 0; i < size; i++)
124 result[l1->getVariant(i)->get<T1>()] = l2->getVariant(i)->get<T2>();
130 template <
typename T1>
136 for (
size_t i = 0; i < vec.size(); i++)
138 result->addVariant(vec.at(i));
144 template <
typename T1>
150 for (
size_t i = 0; i < vec.size(); i++)
152 result->addElement(vec.at(i));
159 void serialize(
const ObjectSerializerBasePtr& serializer,
160 const ::Ice::Current& = Ice::emptyCurrent)
const override;
161 void deserialize(
const ObjectSerializerBasePtr& serializer,
162 const ::Ice::Current& = Ice::emptyCurrent)
override;
165 static std::string getTypePrefix();
167 template <
typename Type>
171 std::vector<Type> result(
getSize());
173 for (
int i = 0; i <
getSize(); i++)
181 template <
typename Type>
185 std::vector<Type> result(
getSize());
187 for (
int i = 0; i <
getSize(); i++)
198 std::string toString(
const Ice::Current& = Ice::emptyCurrent)
const override;
#define ARMARXCORE_IMPORT_EXPORT
The SingleTypeVariantList class is a subclass of VariantContainer and is comparable to a std::vector<...
void addVariant(const Variant &variant)
static VariantTypeId getStaticType(const Ice::Current &c=Ice::emptyCurrent)
IceInternal::Handle< ContainerType > getElement(int index) const
VariantPtr getVariant(int index) const
static SingleTypeVariantListPtr FromContainerStdVector(const std::vector< T1 > &vec)
std::vector< Type > toStdVector() const
static std::map< T1, T2 > MakeMap(SingleTypeVariantListPtr l1, SingleTypeVariantListPtr l2)
VariantContainerBasePtr cloneContainer(const Ice::Current &c=Ice::emptyCurrent) const override
VariantContainerBasePtr getElementBase(int index, const Ice::Current &c=Ice::emptyCurrent) const override
getElementBase is the slice-interface implementation for getting an Element and only returns a basepo...
bool validateElements(const Ice::Current &c=Ice::emptyCurrent) override
std::vector< Type > toContainerStdVector() const
static SingleTypeVariantListPtr FromStdVector(const std::vector< T1 > &vec)
int getSize(const Ice::Current &c=Ice::emptyCurrent) const override
Ice::Int getType(const Ice::Current &c=Ice::emptyCurrent) const override
Ice::ObjectPtr ice_clone() const override
void clear(const Ice::Current &c=Ice::emptyCurrent) override
void addElement(const VariantContainerBasePtr &variantContainer, const Ice::Current &c=Ice::emptyCurrent) override
static std::string getTypePrefix()
SingleTypeVariantList & operator=(const SingleTypeVariantList &source)
VariantContainer is the base class of all other Variant container classes.
The Variant class is described here: Variants.
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
const VariantTypeId SingleTypeVariantList
const VariantContainerType List
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< SingleTypeVariantList > SingleTypeVariantListPtr
IceInternal::Handle< Variant > VariantPtr
SingleTypeVariantList STVarList