diff --git a/include/hpp/manipulation/graph-steering-method.hh b/include/hpp/manipulation/graph-steering-method.hh index 29a750cc92e073f5b8bc6eb21e6da9ebfe051c52..42d96c6b6ece8f833431317f6685c75dea20b320 100644 --- a/include/hpp/manipulation/graph-steering-method.hh +++ b/include/hpp/manipulation/graph-steering-method.hh @@ -38,16 +38,16 @@ namespace hpp { public: /// Create instance and return shared pointer - /// \warning core::ProblemPtr_t will be casted to ProblemPtr_t + /// \warning core::Problem will be casted to Problem static GraphSteeringMethodPtr_t create - (const core::ProblemPtr_t& problem); + (const core::Problem& problem); template <typename T> static GraphSteeringMethodPtr_t create - (const core::ProblemPtr_t& problem); + (const core::Problem& problem); /// Create instance and return shared pointer - static GraphSteeringMethodPtr_t create (const ProblemPtr_t& problem); + static GraphSteeringMethodPtr_t create (const Problem& problem); /// Create copy and return shared pointer static GraphSteeringMethodPtr_t createCopy @@ -71,7 +71,7 @@ namespace hpp { protected: /// Constructor - GraphSteeringMethod (const ProblemPtr_t& problem); + GraphSteeringMethod (const Problem& problem); /// Copy constructor GraphSteeringMethod (const GraphSteeringMethod&); @@ -86,7 +86,7 @@ namespace hpp { private: /// A pointer to the problem - ProblemPtr_t problem_; + const Problem& problem_; /// Weak pointer to itself GraphSteeringMethodWkPtr_t weak_; /// The encapsulated steering method @@ -95,7 +95,7 @@ namespace hpp { template <typename T> GraphSteeringMethodPtr_t GraphSteeringMethod::create - (const core::ProblemPtr_t& problem) + (const core::Problem& problem) { GraphSteeringMethodPtr_t gsm = GraphSteeringMethod::create (problem); gsm->innerSteeringMethod (T::create (problem)); diff --git a/src/graph-steering-method.cc b/src/graph-steering-method.cc index 09f42b400aed56eec31c031b1511bfc297cb1dcc..c52f8e5fac8851249a82b94cf9c12377a5039277 100644 --- a/src/graph-steering-method.cc +++ b/src/graph-steering-method.cc @@ -27,16 +27,15 @@ namespace hpp { namespace manipulation { GraphSteeringMethodPtr_t GraphSteeringMethod::create - (const core::ProblemPtr_t& problem) + (const core::Problem& problem) { - assert (dynamic_cast <const ProblemPtr_t> (problem) != NULL - && "Cast to const ProblemPtr_t failed"); - const ProblemPtr_t& p = static_cast <const ProblemPtr_t> (problem); + dynamic_cast <const Problem&> (problem); + const Problem& p = static_cast <const Problem&> (problem); return create (p); } GraphSteeringMethodPtr_t GraphSteeringMethod::create - (const ProblemPtr_t& problem) + (const Problem& problem) { GraphSteeringMethod* ptr = new GraphSteeringMethod (problem); GraphSteeringMethodPtr_t shPtr (ptr); @@ -53,7 +52,7 @@ namespace hpp { return shPtr; } - GraphSteeringMethod::GraphSteeringMethod (const ProblemPtr_t& problem) : + GraphSteeringMethod::GraphSteeringMethod (const Problem& problem) : SteeringMethod (problem), problem_ (problem), weak_ () { } @@ -66,7 +65,7 @@ namespace hpp { PathPtr_t GraphSteeringMethod::impl_compute (ConfigurationIn_t q1, ConfigurationIn_t q2) const { graph::Edges_t possibleEdges; - graph::Graph& graph = *problem_->constraintGraph (); + const graph::Graph& graph = *problem_.constraintGraph (); try { possibleEdges = graph.getEdges (graph.getState (q1), graph.getState (q2)); diff --git a/src/problem.cc b/src/problem.cc index 1f50bd355ddf93c3e6d5f7d0379a8e5db9c5e93b..4658f6bbf3af973e8c2f8979f54d5523723fe1b8 100644 --- a/src/problem.cc +++ b/src/problem.cc @@ -27,7 +27,7 @@ namespace hpp { Problem::Problem (DevicePtr_t robot) : Parent (robot), graph_() { - Parent::steeringMethod (GraphSteeringMethod::create (this)); + Parent::steeringMethod (GraphSteeringMethod::create (*this)); distance (WeighedDistance::create (robot, graph_)); setPathValidationFactory(core::DiscretizedCollisionChecking::create, 0.05);