diff --git a/include/hpp/manipulation/fwd.hh b/include/hpp/manipulation/fwd.hh index e35e105517979fcc611eec454727ad78f622bc27..5b846cb5fab53aa7daa1788dfc1b5f294dac9be2 100644 --- a/include/hpp/manipulation/fwd.hh +++ b/include/hpp/manipulation/fwd.hh @@ -86,7 +86,9 @@ namespace hpp { typedef boost::shared_ptr < SymbolicPlanner > SymbolicPlannerPtr_t; HPP_PREDEF_CLASS (GraphPathValidation); typedef boost::shared_ptr < GraphPathValidation > GraphPathValidationPtr_t; + HPP_PREDEF_CLASS (SteeringMethod); HPP_PREDEF_CLASS (GraphSteeringMethod); + typedef boost::shared_ptr < SteeringMethod > SteeringMethodPtr_t; typedef boost::shared_ptr < GraphSteeringMethod > GraphSteeringMethodPtr_t; typedef core::PathOptimizer PathOptimizer; typedef core::PathOptimizerPtr_t PathOptimizerPtr_t; diff --git a/include/hpp/manipulation/graph-steering-method.hh b/include/hpp/manipulation/graph-steering-method.hh index 42d96c6b6ece8f833431317f6685c75dea20b320..d21d7a46184d737c5c77a5ede6e303c35754a6c7 100644 --- a/include/hpp/manipulation/graph-steering-method.hh +++ b/include/hpp/manipulation/graph-steering-method.hh @@ -27,11 +27,41 @@ namespace hpp { namespace manipulation { - using core::SteeringMethod; using core::PathPtr_t; /// \addtogroup steering_method /// \{ + class HPP_MANIPULATION_DLLAPI SteeringMethod : public core::SteeringMethod + { + public: + const core::SteeringMethodPtr_t& innerSteeringMethod () const + { + return steeringMethod_; + } + + void innerSteeringMethod (const core::SteeringMethodPtr_t& sm) + { + steeringMethod_ = sm; + } + + protected: + /// Constructor + SteeringMethod (const Problem& problem); + + /// Copy constructor + SteeringMethod (const SteeringMethod& other); + + void init (SteeringMethodWkPtr_t weak) + { + core::SteeringMethod::init (weak); + } + + /// A pointer to the manipulation problem + const Problem& problem_; + /// The encapsulated steering method + core::SteeringMethodPtr_t steeringMethod_; + }; + class HPP_MANIPULATION_DLLAPI GraphSteeringMethod : public SteeringMethod { typedef core::SteeringMethodBuilder_t SteeringMethodBuilder_t; @@ -59,16 +89,6 @@ namespace hpp { return createCopy (weak_.lock ()); } - const core::SteeringMethodPtr_t& innerSteeringMethod () const - { - return steeringMethod_; - } - - void innerSteeringMethod (const core::SteeringMethodPtr_t& sm) - { - steeringMethod_ = sm; - } - protected: /// Constructor GraphSteeringMethod (const Problem& problem); @@ -80,17 +100,13 @@ namespace hpp { void init (GraphSteeringMethodWkPtr_t weak) { - core::SteeringMethod::init (weak); + SteeringMethod::init (weak); weak_ = weak; } private: - /// A pointer to the problem - const Problem& problem_; /// Weak pointer to itself GraphSteeringMethodWkPtr_t weak_; - /// The encapsulated steering method - core::SteeringMethodPtr_t steeringMethod_; }; template <typename T> diff --git a/include/hpp/manipulation/problem.hh b/include/hpp/manipulation/problem.hh index 6b4b05ef3b13c26e010f6ea4dceba1a8fcb9925d..c7c318b5db32f81ed8300fe833845b1ad5cda92a 100644 --- a/include/hpp/manipulation/problem.hh +++ b/include/hpp/manipulation/problem.hh @@ -64,7 +64,7 @@ namespace hpp { void pathValidation (const PathValidationPtr_t& pathValidation); /// Get the steering method as a GraphSteeringMethod - GraphSteeringMethodPtr_t steeringMethod () const; + SteeringMethodPtr_t steeringMethod () const; /// Build a new path validation /// \note Current obstacles are added to the created object. diff --git a/src/graph-steering-method.cc b/src/graph-steering-method.cc index f6f11beaaf6684ac6a69324169c295455cf4606e..446388814d27f4f33ca2ac072b2dd4d8cef5c01e 100644 --- a/src/graph-steering-method.cc +++ b/src/graph-steering-method.cc @@ -27,6 +27,18 @@ namespace hpp { namespace manipulation { + SteeringMethod::SteeringMethod (const Problem& problem) : + core::SteeringMethod (problem), problem_ (problem), + steeringMethod_ (core::SteeringMethodStraight::create (problem)) + { + } + + SteeringMethod::SteeringMethod (const SteeringMethod& other): + core::SteeringMethod (other), problem_ (other.problem_), steeringMethod_ + (other.steeringMethod_) + { + } + GraphSteeringMethodPtr_t GraphSteeringMethod::create (const core::Problem& problem) { @@ -54,14 +66,12 @@ namespace hpp { } GraphSteeringMethod::GraphSteeringMethod (const Problem& problem) : - SteeringMethod (problem), problem_ (problem), weak_ (), - steeringMethod_ (core::SteeringMethodStraight::create (problem)) + SteeringMethod (problem), weak_ () { } GraphSteeringMethod::GraphSteeringMethod (const GraphSteeringMethod& other): - SteeringMethod (other), problem_ (other.problem_), steeringMethod_ - (other.steeringMethod_) + SteeringMethod (other) { } diff --git a/src/problem.cc b/src/problem.cc index 4658f6bbf3af973e8c2f8979f54d5523723fe1b8..78a1b72cad15825c164815fb4ee90e9a14811d27 100644 --- a/src/problem.cc +++ b/src/problem.cc @@ -68,9 +68,9 @@ namespace hpp { return pv; } - GraphSteeringMethodPtr_t Problem::steeringMethod () const + SteeringMethodPtr_t Problem::steeringMethod () const { - return HPP_DYNAMIC_PTR_CAST (GraphSteeringMethod, + return HPP_DYNAMIC_PTR_CAST (SteeringMethod, Parent::steeringMethod()); } } // namespace manipulation