Commit 4489b432 authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

[Problem] Add copy constructor.

parent 3dbd8b46
Pipeline #12798 failed with stage
in 2 minutes and 12 seconds
......@@ -52,6 +52,10 @@ namespace hpp {
/// \param robot robot associated to the path planning problem.
static ProblemPtr_t create (DevicePtr_t robot);
/// Copy a path planning problem and return a shared pointer.
/// \param other problem to copy
static ProblemPtr_t createCopy(const ProblemConstPtr_t& other);
/// Constructor without argument
/// \warning do not use this constructor. It is necessary to define
/// std::pairs <Problem, OtherType>.
......@@ -296,6 +300,8 @@ namespace hpp {
protected:
/// \copydoc Problem::create(DevicePtr_t);
Problem (DevicePtr_t robot);
/// \copydoc Problem::create(DevicePtr_t);
Problem (const Problem& other);
void init (ProblemWkPtr_t wkPtr);
......
......@@ -78,12 +78,34 @@ namespace hpp {
return p;
}
ProblemPtr_t Problem::createCopy(const ProblemConstPtr_t& other)
{
ProblemPtr_t p(new Problem(*other));
p->init(p);
return p;
}
// ======================================================================
Problem::Problem (DevicePtr_t robot) :
robot_ (robot), configValidations_ (ConfigValidations::create ())
{
}
// ======================================================================
Problem::Problem (const Problem& other) :
robot_ (other.robot_), distance_(other.distance_),
initConf_(other.initConf_), goalConfigurations_
(other.goalConfigurations_), target_(other.target_),
steeringMethod_(other.steeringMethod_),
configValidations_ (other.configValidations()),
pathValidation_(other.pathValidation_),
pathProjector_(other.pathProjector_),
collisionObstacles_(other.collisionObstacles_),
constraints_(other.constraints_),
configurationShooter_(other.configurationShooter_)
{
}
// ======================================================================
void Problem::init (ProblemWkPtr_t wkPtr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment