/** * Returns the index of parameter if the ref points to this ParamFunction * @param ref :: A reference to a parameter * @return Parameter index or number of nParams() if parameter not found */ size_t TiesFunction::getParameterIndex(const ParameterReference& ref)const { if (ref.getFunction() == this && ref.getIndex() < nParams()) { return ref.getIndex(); } return nParams(); }
/** * Returns the index of parameter if the ref points to one of the member * function * @param ref :: A reference to a parameter * @return Parameter index or number of nParams() if parameter not found */ size_t CompositeFunction::getParameterIndex(const ParameterReference &ref) const { if (ref.getFunction() == this && ref.getIndex() < nParams()) { return ref.getIndex(); } for (size_t iFun = 0; iFun < nFunctions(); iFun++) { IFunction_sptr fun = getFunction(iFun); size_t iLocalIndex = fun->getParameterIndex(ref); if (iLocalIndex < fun->nParams()) { return m_paramOffsets[iFun] + iLocalIndex; } } return nParams(); }