Commit 9bf49b5a authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

[PathValidation] method validate takes a PathConstPtr_t as input.

parent 257faea8
Pipeline #18415 failed with stage
in 2 minutes and 4 seconds
......@@ -145,7 +145,7 @@ namespace hpp {
/// \retval report information about the validation process. A report
/// is allocated if the path is not valid.
/// \return true if the whole path is valid.
virtual bool validate (const PathPtr_t& path, bool reverse,
virtual bool validate (const PathConstPtr_t& path, bool reverse,
PathPtr_t& validPart,
PathValidationReportPtr_t& report);
/// Iteratively call method doExecute of delegate classes AddObstacle
......@@ -228,7 +228,7 @@ namespace hpp {
typedef continuousValidation::IntervalValidations_t IntervalValidations_t;
static void setPath(IntervalValidations_t& intervalValidations,
const PathPtr_t &path, bool reverse);
const PathConstPtr_t &path, bool reverse);
/// Constructor
/// \param robot the robot for which validation is performed,
......@@ -323,7 +323,7 @@ namespace hpp {
virtual bool validateStraightPath
(IntervalValidations_t& intervalValidations,
const PathPtr_t& path, bool reverse, PathPtr_t& validPart,
const PathConstPtr_t& path, bool reverse, PathPtr_t& validPart,
PathValidationReportPtr_t& report) = 0;
std::vector<Initialize> initialize_;
......
......@@ -71,12 +71,12 @@ namespace hpp {
// Weak pointer to itself
DichotomyWkPtr_t weak_;
bool validateStraightPath (IntervalValidations_t& bodyPairCollisions,
const PathPtr_t& path, bool reverse,
const PathConstPtr_t& path, bool reverse,
PathPtr_t& validPart,
PathValidationReportPtr_t& report);
template <bool reverse>
bool validateStraightPath (IntervalValidations_t& bodyPairCollisions,
const PathPtr_t& path,
const PathConstPtr_t& path,
PathPtr_t& validPart,
PathValidationReportPtr_t& report);
}; // class Dichotomy
......
......@@ -83,7 +83,7 @@ namespace hpp {
/// Set path to validate
/// \param path path to validate,
/// \param reverse whether path is validated from end to beginning.
void path(const PathPtr_t &path, bool reverse)
void path(const PathConstPtr_t &path, bool reverse)
{
path_ = path;
reverse_ = reverse;
......@@ -110,7 +110,7 @@ namespace hpp {
protected:
typedef boost::icl::continuous_interval<value_type> continuous_interval;
typedef boost::icl::interval_set<value_type> interval_set;
PathPtr_t path_;
PathConstPtr_t path_;
value_type tolerance_;
bool reverse_;
bool refine_;
......
......@@ -71,12 +71,12 @@ namespace hpp {
// Weak pointer to itself
ProgressiveWkPtr_t weak_;
bool validateStraightPath (IntervalValidations_t& bodyPairCollisions,
const PathPtr_t& path, bool reverse,
const PathConstPtr_t& path, bool reverse,
PathPtr_t& validPart,
PathValidationReportPtr_t& report);
template <bool reverse>
bool validateStraightPath (IntervalValidations_t& bodyPairCollisions,
const PathPtr_t& path,
const PathConstPtr_t& path,
PathPtr_t& validPart,
PathValidationReportPtr_t& report);
}; // class Progressive
......
......@@ -31,7 +31,7 @@
# define HPP_CORE_EDGE_HH
# include <hpp/core/config.hh>
# include <hpp/core/fwd.hh>
# include <hpp/core/path.hh>
# include <hpp/util/serialization-fwd.hh>
namespace hpp {
......
......@@ -60,7 +60,7 @@ namespace hpp {
/// \retval report information about the validation process. A report
/// is allocated if the path is not valid.
/// \return whether the whole path is valid.
virtual bool validate (const PathPtr_t& path, bool reverse,
virtual bool validate (const PathConstPtr_t& path, bool reverse,
PathPtr_t& validPart,
PathValidationReportPtr_t& report) = 0;
......
......@@ -61,7 +61,7 @@ namespace hpp {
/// \retval report information about the validation process. A report
/// is allocated if the path is not valid.
/// \return whether the whole path is valid.
virtual bool validate (const PathPtr_t& path, bool reverse,
virtual bool validate (const PathConstPtr_t& path, bool reverse,
PathPtr_t& validPart,
PathValidationReportPtr_t& report);
......
......@@ -57,7 +57,7 @@ namespace hpp {
/// \retval report information about the validation process. A report
/// is allocated if the path is not valid.
/// \return whether the whole path is valid.
virtual bool validate (const PathPtr_t& path, bool reverse,
virtual bool validate (const PathConstPtr_t& path, bool reverse,
PathPtr_t& validPart,
PathValidationReportPtr_t& report);
......
......@@ -165,10 +165,11 @@ namespace hpp {
return true;
}
bool ContinuousValidation::validate(const PathPtr_t &path, bool reverse, PathPtr_t &validPart,
PathValidationReportPtr_t &report)
bool ContinuousValidation::validate(const PathConstPtr_t &path,
bool reverse, PathPtr_t &validPart, PathValidationReportPtr_t &report)
{
if (PathVectorPtr_t pv = HPP_DYNAMIC_PTR_CAST(PathVector, path))
if (PathVectorConstPtr_t pv = HPP_DYNAMIC_PTR_CAST
(const PathVector, path))
{
PathVectorPtr_t validPathVector = PathVector::create(path->outputSize(), path->outputDerivativeSize());
validPart = validPathVector;
......@@ -245,7 +246,7 @@ namespace hpp {
void ContinuousValidation::setPath
(IntervalValidations_t& intervalValidations,
const PathPtr_t &path, bool reverse)
const PathConstPtr_t &path, bool reverse)
{
for (IntervalValidations_t::iterator itPair(intervalValidations.begin ());
itPair != intervalValidations.end (); ++itPair) {
......
......@@ -107,7 +107,7 @@ namespace hpp {
void BodyPairCollision::setupPath()
{
if (HPP_DYNAMIC_PTR_CAST(StraightPath, path_)) refine_ = false;
if (HPP_DYNAMIC_PTR_CAST(const StraightPath, path_)) refine_ = false;
Vb_ = vector_t (path_->outputDerivativeSize());
value_type t0 = path_->timeRange ().first;
value_type t1 = path_->timeRange ().second;
......
......@@ -57,8 +57,8 @@ namespace hpp {
}
bool Dichotomy::validateStraightPath
(IntervalValidations_t& bpc, const PathPtr_t& path, bool reverse, PathPtr_t& validPart,
PathValidationReportPtr_t& report)
(IntervalValidations_t& bpc, const PathConstPtr_t& path, bool reverse,
PathPtr_t& validPart, PathValidationReportPtr_t& report)
{
if (reverse) return validateStraightPath<true> (bpc, path, validPart, report);
else return validateStraightPath<false>(bpc, path, validPart, report);
......@@ -66,8 +66,8 @@ namespace hpp {
template <bool reverse>
bool Dichotomy::validateStraightPath
(IntervalValidations_t& bodyPairCollisions, const PathPtr_t& path, PathPtr_t& validPart,
PathValidationReportPtr_t& report)
(IntervalValidations_t& bodyPairCollisions, const PathConstPtr_t& path,
PathPtr_t& validPart, PathValidationReportPtr_t& report)
{
// start by validating end of path
bool finished = false;
......@@ -117,7 +117,7 @@ namespace hpp {
validPart = path->extract (tmin, tmax);
return false;
} else {
validPart = path;
validPart = path->copy();
return true;
}
return false;
......
......@@ -67,7 +67,7 @@ namespace hpp {
}
bool Progressive::validateStraightPath
(IntervalValidations_t& bpc, const PathPtr_t& path,
(IntervalValidations_t& bpc, const PathConstPtr_t& path,
bool reverse, PathPtr_t& validPart, PathValidationReportPtr_t& report)
{
if (reverse) return validateStraightPath<true> (bpc, path, validPart, report);
......@@ -76,7 +76,7 @@ namespace hpp {
template <bool reverse>
bool Progressive::validateStraightPath
(IntervalValidations_t& bodyPairCollisions, const PathPtr_t& path,
(IntervalValidations_t& bodyPairCollisions, const PathConstPtr_t& path,
PathPtr_t& validPart, PathValidationReportPtr_t& report)
{
// for each IntervalValidation
......@@ -118,7 +118,7 @@ namespace hpp {
}
}
if (valid) {
validPart = path;
validPart = path->copy();
return true;
} else {
validPart = reverse ?
......
......@@ -53,6 +53,7 @@ namespace hpp {
assert (device);
assert (length() >= 0);
assert (!constraints ());
assert(timeRange.second > timeRange.first || init == end);
}
InterpolatedPath::InterpolatedPath (const DevicePtr_t& device,
......@@ -69,6 +70,7 @@ namespace hpp {
insert (timeRange.second, end);
assert (device);
assert (length() >= 0);
assert(timeRange.second > timeRange.first || init == end);
}
InterpolatedPath::InterpolatedPath (const PathPtr_t& path,
......
......@@ -56,7 +56,7 @@ namespace hpp {
}
bool Discretized::validate
(const PathPtr_t& path, bool reverse, PathPtr_t& validPart,
(const PathConstPtr_t& path, bool reverse, PathPtr_t& validPart,
PathValidationReportPtr_t& validationReport)
{
hppDout(notice,"path validation, reverse : "<<reverse);
......@@ -102,7 +102,7 @@ namespace hpp {
}
}
if (valid) {
validPart = path;
validPart = path->copy();
return true;
} else {
if (reverse)
......
......@@ -44,11 +44,11 @@ namespace hpp {
{
public:
// Validate all paths
virtual bool validate (const PathPtr_t& path, bool,
virtual bool validate (const PathConstPtr_t& path, bool,
PathPtr_t& validPart,
PathValidationReportPtr_t&)
{
validPart = path;
validPart = path->copy();
return true;
}
static NoValidationPtr_t create (const DevicePtr_t&,
......
......@@ -50,10 +50,10 @@ namespace hpp {
}
bool PathValidations::validate
(const PathPtr_t& path, bool reverse, PathPtr_t& validPart,
(const PathConstPtr_t& path, bool reverse, PathPtr_t& validPart,
PathValidationReportPtr_t& validationReport)
{
PathPtr_t tempPath = path;
PathConstPtr_t tempPath = path;
PathPtr_t tempValidPart;
PathValidationReportPtr_t tempValidationReport;
......@@ -73,7 +73,7 @@ namespace hpp {
result = false;
}
}
validPart = tempPath;
validPart = tempPath->copy();
validationReport->setParameter(lastValidTime);
return result;
}
......
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