From e71c764c91167ca8bcffb55031f0abdf405b7edd Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Tue, 29 Mar 2016 11:12:23 +0200 Subject: [PATCH] Remove GraphOptimizer::unpack and use PathVector::flatten instead --- include/hpp/manipulation/graph-optimizer.hh | 5 ----- src/graph-optimizer.cc | 15 +-------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/include/hpp/manipulation/graph-optimizer.hh b/include/hpp/manipulation/graph-optimizer.hh index 13514642..752fbf0c 100644 --- a/include/hpp/manipulation/graph-optimizer.hh +++ b/include/hpp/manipulation/graph-optimizer.hh @@ -71,11 +71,6 @@ namespace hpp { /// The encapsulated PathOptimizer PathOptimizerPtr_t pathOptimizer_; - - /// Append all paths of in to out - /// \param in a path vector, possibly containing other path vector - /// \param out a flat PathVector (do not contain PathVector) - static void unpack (PathVectorPtr_t in, PathVectorPtr_t out); }; /// \} diff --git a/src/graph-optimizer.cc b/src/graph-optimizer.cc index 39723180..fce049ee 100644 --- a/src/graph-optimizer.cc +++ b/src/graph-optimizer.cc @@ -31,7 +31,7 @@ namespace hpp { GraphPathValidationPtr_t gpv = HPP_DYNAMIC_PTR_CAST (GraphPathValidation, this->problem().pathValidation ()); const_cast <core::Problem&>(this->problem ()).pathValidation (gpv->innerValidation()); - unpack (path, expanded); + path->flatten (expanded); ConstraintSetPtr_t c; for (std::size_t i_s = 0; i_s < expanded->numberPaths ();) { PathVectorPtr_t toOpt = PathVector::create ( @@ -58,18 +58,5 @@ namespace hpp { const_cast <core::Problem&>(this->problem ()).pathValidation (gpv); return opted; } - - void GraphOptimizer::unpack (PathVectorPtr_t in, PathVectorPtr_t out) - { - for (size_t i = 0; i != in->numberPaths (); i++) { - PathPtr_t current = in->pathAtRank (i); - PathVectorPtr_t pv = HPP_DYNAMIC_PTR_CAST (PathVector, current); - if (pv) { - unpack (pv, out); - } else { - out->appendPath (current); - } - } - } } // namespace manipulation } // namespace hpp -- GitLab