26#include <Ice/ObjectAdapter.h>
27#include <Ice/ValueFactory.h>
28#include <IceUtil/UUID.h>
53 IceUtil::Shared(source), VariantContainerBase(source), SingleTypeVariantListBase(source)
61 typeContainer = ContainerTypePtr::dynamicCast(source.typeContainer->clone());
64 for (
unsigned int i = 0; i < source.elements.size(); i++)
66 elements.push_back(source.elements[i]->cloneContainer());
72 VariantContainerBasePtr
87 const Ice::Current&
c)
94 getContainerType()->subType->typeId, variantContainer->getContainerType()->typeId);
102 elements.push_back(variantContainer->cloneContainer());
137 return int(elements.size());
143 VariantContainerBaseList::iterator it = elements.begin();
146 for (; it != elements.end(); it++)
148 result = result && (*it)->validateElements();
154 VariantContainerBasePtr
159 throw IndexOutOfBoundsException();
162 return elements.at(
index);
172 throw InvalidTypeException();
180 const Ice::Current&)
const
186 for (
size_t i = 0; i < elements.size(); i++)
188 arr->setIceObject(i, elements.at(i));
191 obj->setString(
"type", ice_id());
192 obj->setElement(
"array", arr);
202 for (
size_t i = 0; i < arr->size(); i++)
204 VariantContainerBasePtr
c = VariantContainerBasePtr::dynamicCast(arr->getIceObject(i));
212 throw LocalException(
"Could not cast to VariantContainerBasePtr");
220 return "::armarx::SingleTypeVariantListBase";
226 std::stringstream ss;
228 for (
const auto& element : elements)
230 if (elements[elements.size() - 1] != element)
232 ss << element->toString() <<
"\n";
236 ss << element->toString();
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
std::string toString(const Ice::Current &=Ice::emptyCurrent) const override
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
void deserialize(const ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
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 serialize(const ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) 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)
The SingleVariant class is required to store single Variant instances in VariantContainer subclasses.
static bool compare(const ContainerTypePtr &type1, const ContainerTypePtr &secondType)
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
ContainerTypePtr getContainerType(const Ice::Current &c=Ice::emptyCurrent) const override
The Variant class is described here: Variants.
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's internal type.
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
static std::string typeToString(VariantTypeId typeId)
Return the name of the registered type typeId.
const VariantTypeId Invalid
const VariantContainerType List
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< Variant > VariantPtr
IceInternal::Handle< AbstractObjectSerializer > AbstractObjectSerializerPtr