19 for (EntityBasePtr
const& entity : allEntities)
21 if (entity->getName() == name)
23 result.push_back(RelationBasePtr::dynamicCast(entity));
37 RelationBasePtr rel = RelationBasePtr::dynamicCast(
getEntityById(
id));
39 if (rel->getSign() ==
sign)
41 result.push_back(rel);
50 const Ice::Current&)
const
56 RelationBasePtr rel = RelationBasePtr::dynamicCast(
getEntityById(
id));
57 EntityRefList relEntities = rel->getEntities();
59 for (EntityRefBasePtr& relEntity : relEntities)
61 if (relEntity->entityId == entityId)
63 result.push_back(rel);
74 const Ice::Current&)
const
81 const Ice::Current&)
const
83 return getRelationsByAttrValues(entities);
88 const EntityRefList& entities,
90 const Ice::Current&)
const
92 RelationBasePtr result;
93 RelationList resultList = getRelationsByAttrValues(entities, name,
true,
sign);
95 if (!resultList.empty())
97 result = resultList[0];
104 RelationMemorySegment::getRelationsByAttrValues(
const EntityRefList& entities,
105 const std::string& name,
108 const Ice::Current&)
const
115 RelationBasePtr rel = RelationBasePtr::dynamicCast(entity);
117 if (!name.empty() && (rel->getName() != name))
122 if (considerSign && (
sign != rel->getSign()))
127 EntityRefList relEntities = rel->getEntities();
129 bool foundArgs =
true;
131 for (
const auto& entityRef : entities)
133 foundArgs &= std::find_if(relEntities.cbegin(),
135 [&](
const memoryx::EntityRefBasePtr& e)
136 { return entityRef->equals(e); }) != relEntities.cend();
141 result.push_back(rel);
151 RelationPtr rel = RelationPtr::dynamicCast(entity);
152 ARMARX_INFO_S <<
"Adding relation " << rel->getName() <<
" with sign " << rel->getSign();
158 const EntityBasePtr& entity,
161 RelationPtr rel = RelationPtr::dynamicCast(entity);
162 ARMARX_INFO_S <<
"updating relation " << rel->getName() <<
" with sign " << rel->getSign();
170 for (
auto& relation : relations)
179 std::set<std::string>
names;
180 for (
auto& relation : newRelations)
182 names.insert(relation->getName());
184 for (std::string
const& name :
names)
188 for (
auto& relation : newRelations)