diff --git a/include/hpp/manipulation/graph/node.hh b/include/hpp/manipulation/graph/node.hh index e47b9248066a33a5335cb1350826e82aaac61dc4..16eaf2f3f4839c014d0f42f948e7602e434e2f5a 100644 --- a/include/hpp/manipulation/graph/node.hh +++ b/include/hpp/manipulation/graph/node.hh @@ -55,9 +55,18 @@ namespace hpp { static NodePtr_t create (const std::string& name); /// Create a link from this node to the given node. + /// \deprecated Use Edge->node(NodePtr_t) to give the node. EdgePtr_t linkTo (const std::string& name, const NodePtr_t& to, const Weight_t& w = 1, const bool& isInNodeFrom = false, + EdgeFactory create = Edge::create) + HPP_MANIPULATION_DEPRECATED; + + /// Create a link from this node to the given node. + /// \param w if strictly negative, the edge is not included in the neighbor + /// list. Otherwise, it is included with Weight_t w + EdgePtr_t linkTo (const std::string& name, const NodePtr_t& to, + const size_type& w = 1, EdgeFactory create = Edge::create); /// Check whether the configuration is in this state. @@ -156,6 +165,7 @@ namespace hpp { /// List of possible motions from this state (i.e. the outgoing /// vertices). Neighbors_t neighbors_; + std::vector <EdgePtr_t> hiddenNeighbors_; /// Set of constraints to be statisfied. typedef Cache < ConstraintSetPtr_t > Constraint_t; diff --git a/src/graph/node.cc b/src/graph/node.cc index c6e2429d612ac37a6f473ebcd56425572c72b3d7..50932ea8c00e532d159361f68c48261f43f5d6a9 100644 --- a/src/graph/node.cc +++ b/src/graph/node.cc @@ -60,6 +60,15 @@ namespace hpp { return newEdge; } + EdgePtr_t Node::linkTo(const std::string& name, const NodePtr_t& to, + const size_type& w, EdgeFactory create) + { + EdgePtr_t newEdge = create(name, graph_, wkPtr_, to); + if (w >= 0) neighbors_.insert (newEdge, (Weight_t)w); + else hiddenNeighbors_.push_back (newEdge); + return newEdge; + } + bool Node::contains (ConfigurationIn_t config) const { return configConstraint()->isSatisfied (config);