Skip to content
Snippets Groups Projects
Commit de15cf28 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Split GraphSteeringMethod in two class

parent 0c9d19d3
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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>
......
......@@ -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.
......
......@@ -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)
{
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment