Go to the documentation of this file.
30 #include <IceUtil/UUID.h>
31 #include <Ice/ObjectAdapter.h>
32 #include <Ice/ValueFactory.h>
54 VariantContainerBase(
source),
55 SingleTypeVariantListBase(
source)
62 typeContainer = ContainerTypePtr::dynamicCast(
source.typeContainer->clone());
65 for (
unsigned int i = 0; i <
source.elements.size(); i++)
67 elements.push_back(
source.elements[i]->cloneContainer());
97 elements.push_back(variantContainer->cloneContainer());
126 return int(elements.size());
131 VariantContainerBaseList::iterator it = elements.begin();
134 for (; it != elements.end(); it++)
136 result = result && (*it)->validateElements();
147 throw IndexOutOfBoundsException();
150 return elements.at(
index);
160 throw InvalidTypeException();
172 for (
size_t i = 0; i < elements.size(); i++)
174 arr->setIceObject(i, elements.at(i));
177 obj->setString(
"type", ice_id());
178 obj->setElement(
"array", arr);
186 for (
size_t i = 0; i < arr->size(); i++)
188 VariantContainerBasePtr
c = VariantContainerBasePtr::dynamicCast(arr->getIceObject(i));
196 throw LocalException(
"Could not cast to VariantContainerBasePtr");
203 return "::armarx::SingleTypeVariantListBase";
209 std::stringstream ss;
211 for (
const auto& element : elements)
213 if (elements[elements.size() - 1] != element)
215 ss << element->toString() <<
"\n";
219 ss << element->toString();
bool validateElements(const Ice::Current &c=Ice::emptyCurrent) override
The Variant class is described here: Variants.
const VariantContainerType List
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's internal type.
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
The SingleVariant class is required to store single Variant instances in VariantContainer subclasses.
static bool compare(const ContainerTypePtr &type1, const ContainerTypePtr &secondType)
const VariantTypeId Invalid
The SingleTypeVariantList class is a subclass of VariantContainer and is comparable to a std::vector<...
static std::string typeToString(VariantTypeId typeId)
Return the name of the registered type typeId.
void clear(const Ice::Current &c=Ice::emptyCurrent) override
SingleTypeVariantList & operator=(const SingleTypeVariantList &source)
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
static VariantTypeId getStaticType(const Ice::Current &c=Ice::emptyCurrent)
void deserialize(const ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
void addElement(const VariantContainerBasePtr &variantContainer, const Ice::Current &c=Ice::emptyCurrent) 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...
void serialize(const ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
std::shared_ptr< Object > ObjectPtr
Ice::ObjectPtr ice_clone() const override
This file offers overloads of toIce() and fromIce() functions for STL container types.
int getSize(const Ice::Current &c=Ice::emptyCurrent) const override
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
void addVariant(const Variant &variant)
ContainerTypePtr getContainerType(const Ice::Current &c=Ice::emptyCurrent) const override
Ice::Int getType(const Ice::Current &c=Ice::emptyCurrent) const override
static std::string getTypePrefix()