diff --git a/include/hpp/manipulation/graph/graph-component.hh b/include/hpp/manipulation/graph/graph-component.hh index 0c4e769686cb3b3a941e5a1ec3037897689656e5..9007b9e4ae53800fc28564411a6a8e1c52722d78 100644 --- a/include/hpp/manipulation/graph/graph-component.hh +++ b/include/hpp/manipulation/graph/graph-component.hh @@ -100,6 +100,9 @@ namespace hpp { /// Print the component in DOT language. virtual std::ostream& dotPrint (std::ostream& os, dot::DrawingAttributes da = dot::DrawingAttributes ()) const; + /// Declare a component as dirty + void setDirty(); + protected: /// Initialize the component void init (const GraphComponentWkPtr_t& weak); @@ -120,10 +123,7 @@ namespace hpp { bool isInit_; - void throwIfNotInitialized () const - { - if (!isInit_) throw std::logic_error ("The graph should have been initialized first."); - } + void throwIfNotInitialized () const; /// Print the object in a stream. virtual std::ostream& print (std::ostream& os) const; diff --git a/include/hpp/manipulation/problem.hh b/include/hpp/manipulation/problem.hh index c7c318b5db32f81ed8300fe833845b1ad5cda92a..34bc9e48476fa46b12655512255de19d889ad403 100644 --- a/include/hpp/manipulation/problem.hh +++ b/include/hpp/manipulation/problem.hh @@ -74,11 +74,7 @@ namespace hpp { void setPathValidationFactory ( const core::PathValidationBuilder_t& factory, - const value_type& tol) - { - pvFactory_ = factory; - pvTol_ = tol; - } + const value_type& tol); private: /// The graph of constraints diff --git a/src/graph/graph-component.cc b/src/graph/graph-component.cc index b53bfd0a08b04fac7e4c91f5ff75c3c31526f139..b609ea8eb1383f220a87be13f11413f555356518 100644 --- a/src/graph/graph-component.cc +++ b/src/graph/graph-component.cc @@ -45,6 +45,11 @@ namespace hpp { return os; } + void GraphComponent::setDirty() + { + isInit_ = false; + } + void GraphComponent::addNumericalConstraint (const NumericalConstraintPtr_t& nm, const segments_t& passiveDofs) { @@ -132,6 +137,11 @@ namespace hpp { wkPtr_ = weak; } + void GraphComponent::throwIfNotInitialized () const + { + if (!isInit_ || (graph_.lock() && !graph_.lock()->isInit_)) throw std::logic_error ("The graph should have been initialized first."); + } + std::ostream& operator<< (std::ostream& os, const hpp::manipulation::graph::GraphComponent& graphComp) { diff --git a/src/problem.cc b/src/problem.cc index 78a1b72cad15825c164815fb4ee90e9a14811d27..69a00b26049d662dddde3edd8560482f5503a589 100644 --- a/src/problem.cc +++ b/src/problem.cc @@ -21,6 +21,7 @@ #include <hpp/manipulation/weighed-distance.hh> #include <hpp/manipulation/graph-steering-method.hh> #include <hpp/manipulation/graph-path-validation.hh> +#include <hpp/manipulation/graph/graph.hh> namespace hpp { namespace manipulation { @@ -73,5 +74,14 @@ namespace hpp { return HPP_DYNAMIC_PTR_CAST (SteeringMethod, Parent::steeringMethod()); } + + void Problem::setPathValidationFactory ( + const core::PathValidationBuilder_t& factory, + const value_type& tol) + { + pvFactory_ = factory; + pvTol_ = tol; + if (graph_) graph_->setDirty(); + } } // namespace manipulation } // namespace hpp