30 #include <ArmarXCore/interface/observers/VariantContainers.h>
33 #include <IceUtil/Handle.h>
49 virtual public SingleTypeVariantListBase
57 VariantContainerBasePtr cloneContainer(
const Ice::Current&
c = Ice::emptyCurrent)
const override;
61 void addElement(
const VariantContainerBasePtr& variantContainer,
const Ice::Current&
c = Ice::emptyCurrent)
override;
62 void addVariant(
const Variant& variant);
63 void clear(
const Ice::Current&
c = Ice::emptyCurrent)
override;
66 Ice::Int getType(
const Ice::Current&
c = Ice::emptyCurrent)
const override;
67 static VariantTypeId getStaticType(
const Ice::Current&
c = Ice::emptyCurrent);
68 int getSize(
const Ice::Current&
c = Ice::emptyCurrent)
const override;
69 bool validateElements(
const Ice::Current&
c = Ice::emptyCurrent)
override;
83 VariantContainerBasePtr getElementBase(
int index,
const Ice::Current&
c = Ice::emptyCurrent)
const override;
85 template <
typename ContainerType>
92 throw InvalidTypeException();
105 template <
typename T1,
typename T2>
108 if (l1->getSize() != l2->getSize())
110 throw LocalException(
"List lengths do not match:") << l1->getSize() <<
" != " << l2->getSize();
113 std::map<T1, T2> result;
114 size_t size = l1->getSize();
116 for (
size_t i = 0; i < size; i++)
118 result[l1->getVariant(i)->get<T1>()] = l2->getVariant(i)->get<T2>();
124 template <
typename T1>
129 for (
size_t i = 0; i < vec.size(); i++)
131 result->addVariant(vec.at(i));
137 template <
typename T1>
142 for (
size_t i = 0; i < vec.size(); i++)
144 result->addElement(vec.at(i));
151 void serialize(
const ObjectSerializerBasePtr& serializer, const ::Ice::Current& = Ice::emptyCurrent)
const override;
152 void deserialize(
const ObjectSerializerBasePtr& serializer, const ::Ice::Current& = Ice::emptyCurrent)
override;
155 static std::string getTypePrefix();
157 template <
typename Type>
160 std::vector<Type> result(getSize());
162 for (
int i = 0; i < getSize(); i++)
164 result.at(i) = getVariant(i)->get<
Type>();
169 template <
typename Type>
172 std::vector<Type> result(getSize());
174 for (
int i = 0; i < getSize(); i++)
176 Type p = getElement<typename Type::element_type>(i);
185 std::string
toString(
const Ice::Current& = Ice::emptyCurrent)
const override;