SemanticEventChainSegment.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarX::
17 * @author Mirko Waechter ( mirko.waechter at kit dot edu)
18 * @date 2014
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
25 
27 
28 namespace memoryx
29 {
30 
32  PersistentObjectClassSegmentBasePrx objClassSegment,
33  CollectionInterfacePrx entityCollection,
35  bool useMongoIds) :
36  PersistentEntitySegment(entityCollection, ic, useMongoIds), objClassSegment(objClassSegment)
37  {
38  }
39 
40  void
42  SECObjectRelationsBasePtr objRelations,
43  PersistentObjectClassSegmentBasePrx objClassSegment)
44  {
45  if (!objClassSegment)
46  {
47  throw armarx::LocalException("PersistentObjectClassSegmentBaseProxy is NULL");
48  }
49 
50  for (unsigned int i = 0; i < objRelations->relations.size(); i++)
51  {
52  memoryx::SECRelationBasePtr relation = objRelations->relations.at(i);
53 
54  for (unsigned int j = 0; j < relation->objects1.size(); j++)
55  {
56  ObjectClassBasePtr obj = relation->objects1.at(j);
57 
58  if (obj->getId().empty())
59  {
60  relation->objects1.at(j) =
61  objClassSegment->getObjectClassByName(obj->getName());
62  }
63 
64  if (!relation->objects1.at(j))
65  {
66  ARMARX_ERROR_S << "Could not find object with name " << obj->getName();
67  }
68  }
69 
70  for (unsigned int j = 0; j < relation->objects2.size(); j++)
71  {
72  ObjectClassBasePtr obj = relation->objects2.at(j);
73 
74  if (obj->getId().empty())
75  {
76  relation->objects2.at(j) =
77  objClassSegment->getObjectClassByName(obj->getName());
78  }
79 
80  if (!relation->objects2.at(j))
81  {
82  ARMARX_ERROR_S << "Could not find object with name " << obj->getName();
83  }
84  }
85  }
86  }
87 
88 } // namespace memoryx
cyberglove_with_calib_22dof.ic
ic
Definition: cyberglove_with_calib_22dof.py:22
memoryx::SemanticEventChainSegment::objClassSegment
PersistentObjectClassSegmentBasePrx objClassSegment
Definition: SemanticEventChainSegment.h:46
SemanticEventChainSegment.h
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
IceInternal::Handle<::Ice::Communicator >
memoryx::SemanticEventChainSegment::ReplaceObjectDummies
static void ReplaceObjectDummies(SECObjectRelationsBasePtr objRelations, PersistentObjectClassSegmentBasePrx objClassSegment)
Definition: SemanticEventChainSegment.cpp:41
ARMARX_ERROR_S
#define ARMARX_ERROR_S
Definition: Logging.h:216
memoryx::SemanticEventChainSegment::SemanticEventChainSegment
SemanticEventChainSegment(PersistentObjectClassSegmentBasePrx objClassSegment, CollectionInterfacePrx entityCollection, Ice::CommunicatorPtr ic, bool useMongoIds=true)
Definition: SemanticEventChainSegment.cpp:31
memoryx::PersistentEntitySegment
The PersistentEntitySegment class is the base class for all memory segments containing memoryx::Entit...
Definition: PersistentEntitySegment.h:105
Logging.h
Exception.h