17 for (EntityBasePtr
const& entity : allEntities)
19 if (entity->getName() == name)
21 result.push_back(RelationBasePtr::dynamicCast(entity));
34 RelationBasePtr rel = RelationBasePtr::dynamicCast(
getEntityById(
id));
36 if (rel->getSign() ==
sign)
38 result.push_back(rel);
51 RelationBasePtr rel = RelationBasePtr::dynamicCast(
getEntityById(
id));
52 EntityRefList relEntities = rel->getEntities();
54 for (EntityRefBasePtr& relEntity : relEntities)
56 if (relEntity->entityId == entityId)
58 result.push_back(rel);
74 return getRelationsByAttrValues(entities);
79 RelationBasePtr result;
80 RelationList resultList = getRelationsByAttrValues(entities, name,
true,
sign);
82 if (!resultList.empty())
84 result = resultList[0];
90 RelationList RelationMemorySegment::getRelationsByAttrValues(
const EntityRefList& entities,
const std::string& name,
bool considerSign,
bool sign,
const Ice::Current&)
const
97 RelationBasePtr rel = RelationBasePtr::dynamicCast(entity);
99 if (!name.empty() && (rel->getName() != name))
104 if (considerSign && (
sign != rel->getSign()))
109 EntityRefList relEntities = rel->getEntities();
111 bool foundArgs =
true;
113 for (
const auto& entityRef : entities)
115 foundArgs &= std::find_if(relEntities.cbegin(), relEntities.cend(), [&](
const memoryx::EntityRefBasePtr & e)
117 return entityRef->equals(e);
118 }) != relEntities.cend();
123 result.push_back(rel);
132 RelationPtr rel = RelationPtr::dynamicCast(entity);
133 ARMARX_INFO_S <<
"Adding relation " << rel->getName() <<
" with sign " << rel->getSign();
139 RelationPtr rel = RelationPtr::dynamicCast(entity);
140 ARMARX_INFO_S <<
"updating relation " << rel->getName() <<
" with sign " << rel->getSign();
147 for (
auto& relation : relations)
155 std::set<std::string>
names;
156 for (
auto& relation : newRelations)
158 names.insert(relation->getName());
160 for (std::string
const& name :
names)
164 for (
auto& relation : newRelations)