Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
Fix copy methods in constraint to imporove performance.
Browse files Browse the repository at this point in the history
  * The previous implementation of clone() and createCopy() caused
    each direct path to be validated twice by all validators
    (including collision-checking).
  * The new implementation follows the Kite standard way of cloning an
    object.
  * Planning times are hence divided by two.
  • Loading branch information
Antonio El Khoury committed Dec 14, 2012
1 parent 5f4322d commit 2e250db
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/kws-constraint.cc
Expand Up @@ -39,12 +39,16 @@ namespace hpp {
KwsConstraintShPtr
KwsConstraint::createCopy ( const KwsConstraintConstShPtr &i_KwsConstraint)
{
return create(i_KwsConstraint->name(),i_KwsConstraint->getConfigProjector());
KwsConstraint * newPtr = new KwsConstraint(*i_KwsConstraint);
KwsConstraintShPtr newShPtr ( newPtr );

if ( newPtr->init(newShPtr) != KD_OK ) newShPtr.reset();
return newShPtr;
}

CkwsValidatorShPtr KwsConstraint::clone() const
{
return create(name(),getConfigProjector());
return KwsConstraint::createCopy (wkPtr_.lock ());
}

ConfigProjector *
Expand Down

0 comments on commit 2e250db

Please sign in to comment.