From 567d6e9471640e41d88b48242ff7419e6fe887a1 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Mon, 24 Aug 2015 17:01:11 +0200
Subject: [PATCH] Add Graph::nodeSelector

---
 include/hpp/manipulation/graph/graph.hh | 6 ++++++
 src/graph/graph.cc                      | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/include/hpp/manipulation/graph/graph.hh b/include/hpp/manipulation/graph/graph.hh
index 7068dc76..d59bad99 100644
--- a/include/hpp/manipulation/graph/graph.hh
+++ b/include/hpp/manipulation/graph/graph.hh
@@ -52,6 +52,12 @@ namespace hpp {
           /// Create and insert a NodeSelector inside the graph.
           NodeSelectorPtr_t createNodeSelector (const std::string& name);
 
+          /// Set the nodeSelector
+          /// \warning This should be done before adding nodes to the node
+          /// selector otherwise the pointer to the parent graph will NOT be
+          /// valid.
+          void nodeSelector (NodeSelectorPtr_t ns);
+
           /// Returns the states of a configuration.
           NodePtr_t getNode (ConfigurationIn_t config) const;
 
diff --git a/src/graph/graph.cc b/src/graph/graph.cc
index 3913979f..cbc2bc33 100644
--- a/src/graph/graph.cc
+++ b/src/graph/graph.cc
@@ -48,6 +48,12 @@ namespace hpp {
         return nodeSelector_;
       }
 
+      void Graph::nodeSelector (NodeSelectorPtr_t ns)
+      {
+        nodeSelector_ = ns;
+        nodeSelector_->parentGraph (wkPtr_);
+      }
+
       void Graph::maxIterations (size_type iterations)
       {
         maxIterations_ = iterations;
-- 
GitLab