From fd1da58eee033b9c1ebc34632f1ce41caf8f65d4 Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Mon, 21 Jul 2014 11:04:12 +0200 Subject: [PATCH] Add a pointer to the robot in graph::Graph --- include/hpp/manipulation/graph/graph.hh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/hpp/manipulation/graph/graph.hh b/include/hpp/manipulation/graph/graph.hh index b4a0838f..26644ba1 100644 --- a/include/hpp/manipulation/graph/graph.hh +++ b/include/hpp/manipulation/graph/graph.hh @@ -17,6 +17,7 @@ #ifndef HPP_MANIPULATION_GRAPH_GRAPH_HH # define HPP_MANIPULATION_GRAPH_GRAPH_HH +# include "hpp/manipulation/robot.hh" # include "hpp/manipulation/graph/node-selector.hh" # include "hpp/manipulation/fwd.hh" @@ -39,11 +40,11 @@ namespace hpp { { public: /// Create a new Graph. - static GraphPtr_t create() + static GraphPtr_t create(RobotPtr_t robot) { Graph* ptr = new Graph; GraphPtr_t shPtr (ptr); - ptr->init (shPtr); + ptr->init (shPtr, robot); return shPtr; } @@ -63,8 +64,9 @@ namespace hpp { protected: /// Initialization of the object. - void init (const GraphWkPtr_t& weak) + void init (const GraphWkPtr_t& weak, RobotPtr_t robot) { + robot_ = robot; wkPtr_ = weak; } @@ -80,6 +82,9 @@ namespace hpp { /// stability constraints. ConstraintPtr_t constraints_; + /// Keep a pointer to the composite robot. + RobotPtr_t robot_; + /// Weak pointer to itself. GraphWkPtr_t wkPtr_; }; // Class Graph -- GitLab