28 #include "../../segment/ObjectClassMemorySegment.h"
29 #include "../ObjectClass.h"
39 const memoryx::ObjectClassList& possibleObjects1,
40 const memoryx::ObjectClassList& possibleObjects2)
45 objects1 = possibleObjects1;
46 objects2 = possibleObjects2;
50 const ObjectClassBasePtr& possibleObject1,
51 const ObjectClassBasePtr& possibleObject2)
56 objects1.push_back(possibleObject1);
57 objects2.push_back(possibleObject2);
69 return _isEqual(other, ignoreName,
false);
111 if (!ignoreName &&
getName() != other->getName())
116 bool foundMatchObj1 =
false;
118 for (ObjectClassList::const_iterator it = objects1.begin(); it != objects1.end(); it++)
120 for (ObjectClassList::const_iterator itOther = other->objects1.begin();
121 itOther != other->objects1.end();
125 if ((*it)->compare(*itOther) ==
128 foundMatchObj1 =
true;
133 bool foundMatchObj2 =
false;
135 for (ObjectClassList::const_iterator it = objects2.begin(); it != objects2.end(); it++)
137 for (ObjectClassList::const_iterator itOther = other->objects2.begin();
138 itOther != other->objects2.end();
142 if ((*it)->compare(*itOther) ==
145 foundMatchObj2 =
true;
150 bool result = foundMatchObj1 && foundMatchObj2;
152 if (!result && !reversed)
154 SECRelationBasePtr inverseRelation =
156 return _isEqual(inverseRelation, ignoreName,
true);
166 name =
"NoConnection";
170 const ObjectClassList& possibleObjects2) :
171 SECRelation(
"NoConnection", possibleObjects1, possibleObjects2)
176 const ObjectClassBasePtr& possibleObject1,
177 const ObjectClassBasePtr& possibleObject2) :
178 SECRelation(
"NoConnection", possibleObject1, possibleObject2)
188 const ObjectClassList& possibleObjects2) :
189 SECRelation(
"Touching", possibleObjects1, possibleObjects2)
194 const ObjectClassBasePtr& possibleObject2) :
195 SECRelation(
"Touching", possibleObject1, possibleObject2)
205 const ObjectClassList& possibleObjects2) :
206 SECRelation(
"BehindOf", possibleObjects1, possibleObjects2)
211 const ObjectClassBasePtr& possibleObject2) :
212 SECRelation(
"BehindOf", possibleObject1, possibleObject2)
222 const ObjectClassList& possibleObjects2) :
223 SECRelation(
"LeftTo", possibleObjects1, possibleObjects2)
228 const ObjectClassBasePtr& possibleObject2) :
229 SECRelation(
"LeftTo", possibleObject1, possibleObject2)
239 const ObjectClassList& possibleObjects2) :
240 SECRelation(
"RightTo", possibleObjects1, possibleObjects2)
245 const ObjectClassBasePtr& possibleObject2) :
246 SECRelation(
"RightTo", possibleObject1, possibleObject2)
250 armarx::VariantDataClassPtr
254 result->name = getName();
256 for (ObjectClassList::const_iterator it = objects1.begin(); it != objects1.end(); it++)
258 result->objects1.push_back(ObjectClassBasePtr::dynamicCast((*it)->ice_clone()));
261 for (ObjectClassList::const_iterator it = objects2.begin(); it != objects2.end(); it++)
263 result->objects2.push_back(ObjectClassBasePtr::dynamicCast((*it)->ice_clone()));
272 return getName() +
" between " + objects1ToString() +
" and " + objects2ToString();
289 const Ice::Current&)
const
292 armarx::AbstractObjectSerializerPtr::dynamicCast(serializer);
293 obj->setString(
"relationName", getName());
302 armarx::AbstractObjectSerializerPtr::dynamicCast(serializer);
303 name = obj->getString(
"relationName");
304 Ice::StringSeq objectStrings1;
305 obj->getStringArray(
"objects1", objectStrings1);
307 for (Ice::StringSeq::iterator it = objectStrings1.begin(); it != objectStrings1.end(); it++)
310 newObj->setName(*it);
311 objects1.push_back(newObj);
314 Ice::StringSeq objectStrings2;
315 obj->getStringArray(
"objects2", objectStrings2);
317 for (Ice::StringSeq::iterator it = objectStrings2.begin(); it != objectStrings2.end(); it++)
320 newObj->setName(*it);
321 objects2.push_back(newObj);