35 EntityAttribute::EntityAttribute(
const std::string& name)
47 IceUtil::Shared(other), EntityAttributeBase()
50 this->name = other.name;
54 this->
values.reserve(size);
56 for (
size_t i = 0; i <
size; ++i)
58 AttributeElement elem;
59 const AttributeElement& origElem = other.values.at(i);
61 ProbabilityMeasureBasePtr uncertainty = origElem.uncertainty;
65 elem.uncertainty = ProbabilityMeasureBasePtr::dynamicCast(uncertainty->clone());
68 elem.value = var->clone();
106 const ProbabilityMeasureBasePtr& uncertainty,
107 const ::Ice::Current&)
119 AttributeElement elem;
120 elem.value = armarx::VariantPtr::dynamicCast(val)->clone();
124 elem.uncertainty = ProbabilityMeasureBasePtr::dynamicCast(uncertainty->ice_clone());
142 const ProbabilityMeasureBasePtr& uncertainty,
143 const ::Ice::Current&)
145 AttributeElement elem;
146 elem.value = armarx::VariantPtr::dynamicCast(val)->clone();
150 elem.uncertainty = ProbabilityMeasureBasePtr::dynamicCast(uncertainty->ice_clone());
165 throw armarx::NotImplementedYetException();
168 const std::string valStr = val->getString();
172 for (AttributeElementList::const_iterator it =
values.begin(); it !=
values.end(); ++it)
175 it->value->getString() == valStr)
190 ProbabilityMeasureBasePtr
203 ProbabilityMeasureBasePtr
208 : ProbabilityMeasureBasePtr();
266 return this->
clone();
280 EntityAttribute::output(std::ostream& stream)
const
284 for (AttributeElementList::const_iterator it =
values.begin(); it !=
values.end(); ++it)
286 stream <<
"value: " << armarx::VariantPtr::dynamicCast(it->value);
290 stream <<
", uncertainty: "
291 << ProbabilityMeasureBasePtr::dynamicCast(it->uncertainty)->output();
300 const ::Ice::Current&
c)
const
303 armarx::AbstractObjectSerializerPtr::dynamicCast(serializer);
308 for (AttributeElementList::const_iterator it =
values.begin(); it !=
values.end(); ++it)
311 armarx::AbstractObjectSerializerPtr::dynamicCast(serializer)->createElement();
312 objValue->setVariant(
"value", armarx::VariantPtr::dynamicCast(it->value));
317 new armarx::Variant(armarx::VariantDataClassPtr::dynamicCast(it->uncertainty));
318 objValue->setVariant(
"uncertainty", uncertaintyVar);
321 obj->append(objValue);
327 const ::Ice::Current&
c)
330 armarx::AbstractObjectSerializerPtr::dynamicCast(serializer);
336 for (
unsigned int i = 0; i < obj->size(); ++i)
339 AttributeElement elem;
343 elem.value = objValue->getVariant(
"value");
345 catch (std::exception& e)
348 <<
"Could not get variant for: " << objValue->toString().substr(0, 2000) <<
": "
349 << e.what() <<
"\n Backtrace: \n"
355 <<
"Could not get variant for: " << objValue->toString().substr(0, 2000)
356 <<
"\n Backtrace: \n"
360 if (objValue->hasElement(
"uncertainty"))
363 elem.uncertainty = uncertaintyVar->getClass<ProbabilityMeasureBase>();