void FunctionDefinitionRecursion::addDependencies(const Model& m, const FunctionDefinition& object) { unsigned int ns; std::string thisId = object.getId(); /* loop thru the list of names in the Math * if they refer to a FunctionDefinition add to the map * with the variable as key */ List* variables = object.getMath()->getListOfNodes( ASTNode_isFunction ); for (ns = 0; ns < variables->getSize(); ns++) { ASTNode* node = static_cast<ASTNode*>( variables->get(ns) ); string name = node->getName() ? node->getName() : ""; if (m.getFunctionDefinition(name)) { mIdMap.insert(pair<const std::string, std::string>(thisId, name)); } } delete variables; }
void FunctionDefinitionRecursion::logSelfRecursion ( const FunctionDefinition& fd, const string& varname ) { char * formula = SBML_formulaToString(fd.getMath()); msg = "The functionDefinition with id '"; msg += varname; msg += "' refers to itself within the math formula "; msg += formula; msg += "'."; safe_free(formula); logFailure(fd); }