diff --git a/include/hpp/manipulation/graph/edge.hh b/include/hpp/manipulation/graph/edge.hh index 7c78acfcaf0504c54db98ce50d37b13559f8a064..8426a2196e2f8253115d9cb39d058e91f0043eee 100644 --- a/include/hpp/manipulation/graph/edge.hh +++ b/include/hpp/manipulation/graph/edge.hh @@ -85,17 +85,29 @@ namespace hpp { NodePtr_t from () const; /// Get the node in which path is. - virtual NodePtr_t node () const; + NodePtr_t node () const + { + return node_.lock(); + } + + void node (NodePtr_t node) + { + node_ = node; + } - void isInNodeFrom (bool iinf) + /// \deprecated use node(NodePtr_t) instead. + void isInNodeFrom (bool iinf) HPP_MANIPULATION_DEPRECATED { - isInNodeFrom_ = iinf; + if (iinf) node_ = from_; + else node_ = to_; } - bool isInNodeFrom () const + /// \deprecated see NodePtr_t node() const + bool isInNodeFrom () const HPP_MANIPULATION_DEPRECATED { - return isInNodeFrom_; + return node_.lock() == from_.lock(); } + /// Get steering method associated to the edge. const core::SteeringMethodPtr_t& steeringMethod () const { @@ -158,7 +170,7 @@ namespace hpp { NodeWkPtr_t from_, to_; /// True if this path is in node from, False if in node to - bool isInNodeFrom_; + NodeWkPtr_t node_; /// Steering method used to create paths associated to the edge SteeringMethod_t* steeringMethod_; diff --git a/src/graph/edge.cc b/src/graph/edge.cc index 78fad10c7fac174d6e8f00cb17fa6be5dd725406..bcef230ea03906a566ddfd779c72516362b3e2c1 100644 --- a/src/graph/edge.cc +++ b/src/graph/edge.cc @@ -57,12 +57,6 @@ namespace hpp { return from_.lock(); } - NodePtr_t Edge::node () const - { - if (isInNodeFrom_) return from (); - else return to (); - } - bool Edge::direction (const core::PathPtr_t& path) const { Configuration_t q0 = path->initial (), @@ -169,7 +163,7 @@ namespace hpp { wkPtr_ = weak; from_ = from; to_ = to; - isInNodeFrom_ = false; + node_ = to; } std::ostream& Edge::print (std::ostream& os) const