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 
24 
27 
28 namespace memoryx
29 {
30 
31  SemanticEventChainSegment::SemanticEventChainSegment(PersistentObjectClassSegmentBasePrx objClassSegment, CollectionInterfacePrx entityCollection, Ice::CommunicatorPtr ic, bool useMongoIds) :
32  PersistentEntitySegment(entityCollection, ic, useMongoIds),
33  objClassSegment(objClassSegment)
34  {
35  }
36 
37  void SemanticEventChainSegment::ReplaceObjectDummies(SECObjectRelationsBasePtr objRelations, PersistentObjectClassSegmentBasePrx objClassSegment)
38  {
39  if (!objClassSegment)
40  {
41  throw armarx::LocalException("PersistentObjectClassSegmentBaseProxy is NULL");
42  }
43 
44  for (unsigned int i = 0; i < objRelations->relations.size(); i++)
45  {
46  memoryx::SECRelationBasePtr relation = objRelations->relations.at(i);
47 
48  for (unsigned int j = 0; j < relation->objects1.size(); j++)
49  {
50  ObjectClassBasePtr obj = relation->objects1.at(j);
51 
52  if (obj->getId().empty())
53  {
54  relation->objects1.at(j) = objClassSegment->getObjectClassByName(obj->getName());
55  }
56 
57  if (!relation->objects1.at(j))
58  {
59  ARMARX_ERROR_S << "Could not find object with name " << obj->getName();
60  }
61  }
62 
63  for (unsigned int j = 0; j < relation->objects2.size(); j++)
64  {
65  ObjectClassBasePtr obj = relation->objects2.at(j);
66 
67  if (obj->getId().empty())
68  {
69  relation->objects2.at(j) = objClassSegment->getObjectClassByName(obj->getName());
70  }
71 
72  if (!relation->objects2.at(j))
73  {
74  ARMARX_ERROR_S << "Could not find object with name " << obj->getName();
75  }
76  }
77  }
78  }
79 
80 }
cyberglove_with_calib_22dof.ic
ic
Definition: cyberglove_with_calib_22dof.py:22
memoryx::SemanticEventChainSegment::objClassSegment
PersistentObjectClassSegmentBasePrx objClassSegment
Definition: SemanticEventChainSegment.h:40
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:37
ARMARX_ERROR_S
#define ARMARX_ERROR_S
Definition: Logging.h:209
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:107
Logging.h
Exception.h