void LoadDefaultsDecoder::setAttributes(Root &obj, //Root &obj_inst, const Element& melem, std::set<std::string> used_attributes) { MapType::const_iterator I; for (I = melem.asMap().begin(); I != melem.asMap().end(); I++) { std::set<std::string>::const_iterator attr_found = used_attributes.find(I->first); if (attr_found == used_attributes.end()) { //cout<<" -->"<<I->first<<endl; obj->setAttr(I->first, I->second); //obj_inst->setAttr(I->first, I->second); } used_attributes.insert(I->first); } I = melem.asMap().find(Atlas::Objects::PARENTS_ATTR); if (I != melem.asMap().end()) { for (ListType::const_iterator J = I->second.asList().begin(); J != I->second.asList().end(); J++) { //cout<<" >"<<J->asString()<<endl; const Element & parent_melem = getMessageElement(J->asString()); setAttributes(obj, /*obj_inst,*/ parent_melem, used_attributes); } } }
static void addTypeToList(const Root & type, ListType & typeList) { typeList.push_back(type->getId()); Element children; if (type->copyAttr("children", children) != 0) { return; } if (!children.isList()) { log(ERROR, compose("Type %1 children attribute has type %2 instead of " "string.", type->getId(), Element::typeName(children.getType()))); return; } ListType::const_iterator I = children.List().begin(); ListType::const_iterator Iend = children.List().end(); for (; I != Iend; ++I) { Root child = Inheritance::instance().getClass(I->asString()); if (!child.isValid()) { log(ERROR, compose("Unable to find %1 in inheritance table", I->asString())); continue; } addTypeToList(child, typeList); } }
void TasksProperty::set(const Atlas::Message::Element & val) { if (!val.isList()) { log(ERROR, "Task property must be a list."); return; } if (m_task == 0) { log(ERROR, "No task in ::set"); return; } ListType tasks = val.asList(); ListType::const_iterator I = tasks.begin(); ListType::const_iterator Iend = tasks.end(); for (; I != Iend; ++I) { if (!I->isMap()) { log(ERROR, "Task must be a map."); return; } const MapType & task = I->asMap(); MapType::const_iterator J = task.begin(); MapType::const_iterator Jend = task.end(); for (J = task.begin(); J != Jend; ++J) { m_task->setAttr(J->first, J->second); } } }