//============================================================================== void ConstrainedGroup::addConstraint(Constraint* _constraint) { assert(_constraint != NULL && "Null constraint pointer is now allowed."); assert(containConstraint(_constraint) == false && "Don't try to add same constraint multiple times into Community."); assert(_constraint->isActive()); mConstraints.push_back(_constraint); }
//============================================================================== void ConstrainedGroup::addConstraint(const ConstraintBasePtr& _constraint) { assert(_constraint != nullptr && "Attempted to add nullptr."); assert(!containConstraint(_constraint) && "Attempted to add a duplicate constraint."); assert(_constraint->isActive()); mConstraints.push_back(_constraint); }
//============================================================================== void ConstrainedGroup::removeConstraint(Constraint* _constraint) { assert(_constraint != NULL && "Null constraint pointer is now allowed."); assert(containConstraint(_constraint) == true && "Don't try to remove a constraint not contained in Community."); mConstraints.erase( remove(mConstraints.begin(), mConstraints.end(), _constraint), mConstraints.end()); }
//============================================================================== void ConstrainedGroup::removeConstraint(const ConstraintBasePtr& _constraint) { assert(_constraint != nullptr && "Attempted to add nullptr."); assert(containConstraint(_constraint) && "Attempted to remove not existing constraint."); mConstraints.erase( remove(mConstraints.begin(), mConstraints.end(), _constraint), mConstraints.end()); }