/** * Create a new function definition with a specified type */ FunctionDefinition getRetTypeFunctionDefinition(int type, Declarator d, CompoundStatement cs) { FunctionDefinition ret = getFunctionDefinition(d, cs); ret->s = NULL; ret->tt = NULL; ret->code = NULL; ret->type_name = type; return ret; }
void Model::removeDuplicateTopLevelAnnotations() { unsigned int i, n; this->removeDuplicateAnnotations(); if (getNumFunctionDefinitions() > 0) { getListOfFunctionDefinitions()->removeDuplicateAnnotations(); for (i = 0; i < getNumFunctionDefinitions(); i++) { getFunctionDefinition(i)->removeDuplicateAnnotations(); } } if (getNumUnitDefinitions() > 0) { getListOfUnitDefinitions()->removeDuplicateAnnotations(); for (i = 0; i < getNumUnitDefinitions(); i++) { getUnitDefinition(i)->removeDuplicateAnnotations(); getUnitDefinition(i)->getListOfUnits()->removeDuplicateAnnotations(); for (n = 0; n < getUnitDefinition(i)->getNumUnits(); n++) { getUnitDefinition(i)->getUnit(n)->removeDuplicateAnnotations(); } } } if (getNumCompartmentTypes() > 0) { getListOfCompartmentTypes()->removeDuplicateAnnotations(); for (i = 0; i < getNumCompartmentTypes(); i++) { getCompartmentType(i)->removeDuplicateAnnotations(); } } if (getNumSpeciesTypes() > 0) { getListOfSpeciesTypes()->removeDuplicateAnnotations(); for (i = 0; i < getNumSpeciesTypes(); i++) { getSpeciesType(i)->removeDuplicateAnnotations(); } } if (getNumCompartments() > 0) { getListOfCompartments()->removeDuplicateAnnotations(); for (i = 0; i < getNumCompartments(); i++) { getCompartment(i)->removeDuplicateAnnotations(); } } if (getNumSpecies() > 0) { getListOfSpecies()->removeDuplicateAnnotations(); for (i = 0; i < getNumSpecies(); i++) { getSpecies(i)->removeDuplicateAnnotations(); } } if (getNumParameters() > 0) { getListOfParameters()->removeDuplicateAnnotations(); for (i = 0; i < getNumParameters(); i++) { getParameter(i)->removeDuplicateAnnotations(); } } if (getNumInitialAssignments() > 0) { getListOfInitialAssignments()->removeDuplicateAnnotations(); for (i = 0; i < getNumInitialAssignments(); i++) { getInitialAssignment(i)->removeDuplicateAnnotations(); } } if (getNumConstraints() > 0) { getListOfConstraints()->removeDuplicateAnnotations(); for (i = 0; i < getNumConstraints(); i++) { getConstraint(i)->removeDuplicateAnnotations(); } } if (getNumRules() > 0) { getListOfRules()->removeDuplicateAnnotations(); for (i = 0; i < getNumRules(); i++) { getRule(i)->removeDuplicateAnnotations(); } } if (getNumReactions() > 0) { getListOfReactions()->removeDuplicateAnnotations(); for (i = 0; i < getNumReactions(); i++) { Reaction * r = getReaction(i); r->removeDuplicateAnnotations(); if (r->getNumReactants() > 0) { r->getListOfReactants()->removeDuplicateAnnotations(); for (n = 0; n < r->getNumReactants(); n++) { r->getReactant(n)->removeDuplicateAnnotations(); } } if (r->getNumProducts() > 0) { r->getListOfProducts()->removeDuplicateAnnotations(); for (n = 0; n < r->getNumProducts(); n++) { r->getProduct(n)->removeDuplicateAnnotations(); } } if (r->getNumModifiers() > 0) { r->getListOfModifiers()->removeDuplicateAnnotations(); for (n = 0; n < r->getNumModifiers(); n++) { r->getModifier(n)->removeDuplicateAnnotations(); } } if (r->isSetKineticLaw()) { r->getKineticLaw()->removeDuplicateAnnotations(); if (r->getKineticLaw()->getNumParameters() > 0) { r->getKineticLaw()->getListOfParameters() ->removeDuplicateAnnotations(); for (n = 0; n < r->getKineticLaw()->getNumParameters(); n++) { r->getKineticLaw()->getParameter(n)->removeDuplicateAnnotations(); } } } } } if (getNumEvents() > 0) { getListOfEvents()->removeDuplicateAnnotations(); for (i = 0; i < getNumEvents(); i++) { getEvent(i)->removeDuplicateAnnotations(); if (getEvent(i)->getNumEventAssignments() > 0) { getEvent(i)->getListOfEventAssignments()->removeDuplicateAnnotations(); for (n = 0; n < getEvent(i)->getNumEventAssignments(); n++) { getEvent(i)->getEventAssignment(n)->removeDuplicateAnnotations(); } } } } }
void Model::removeSBOTerms(bool strict) { unsigned int n, i; if (strict == true) { unsetSBOTerm(); for (n = 0; n < getNumUnitDefinitions(); n++) { getUnitDefinition(n)->unsetSBOTerm(); for (i = 0; i < getUnitDefinition(n)->getNumUnits(); i++) { getUnitDefinition(n)->getUnit(i)->unsetSBOTerm(); } } for (n = 0; n < getNumCompartments(); n++) { getCompartment(n)->unsetSBOTerm(); } for (n = 0; n < getNumSpecies(); n++) { getSpecies(n)->unsetSBOTerm(); } for (n = 0; n < getNumParameters(); n++) { getParameter(n)->unsetSBOTerm(); } for (n = 0; n < getNumRules(); n++) { getRule(n)->unsetSBOTerm(); } for (n = 0; n < getNumReactions(); n++) { getReaction(n)->unsetSBOTerm(); for (i = 0; i < getReaction(n)->getNumReactants(); i++) { getReaction(n)->getReactant(i)->unsetSBOTerm(); if (getReaction(n)->getReactant(i)->isSetStoichiometryMath()) { getReaction(n)->getReactant(i)->getStoichiometryMath()->unsetSBOTerm(); } } for (i = 0; i < getReaction(n)->getNumProducts(); i++) { getReaction(n)->getProduct(i)->unsetSBOTerm(); if (getReaction(n)->getProduct(i)->isSetStoichiometryMath()) { getReaction(n)->getProduct(i)->getStoichiometryMath()->unsetSBOTerm(); } } for (i = 0; i < getReaction(n)->getNumModifiers(); i++) { getReaction(n)->getModifier(i)->unsetSBOTerm(); } if (getReaction(n)->isSetKineticLaw()) { getReaction(n)->getKineticLaw()->unsetSBOTerm(); } } for (n = 0; n < getNumFunctionDefinitions(); n++) { getFunctionDefinition(n)->unsetSBOTerm(); } for (n = 0; n < getNumEvents(); n++) { getEvent(n)->unsetSBOTerm(); for (i = 0; i < getEvent(n)->getNumEventAssignments(); i++) { getEvent(n)->getEventAssignment(i)->unsetSBOTerm(); } if (getEvent(n)->isSetTrigger()) { getEvent(n)->getTrigger()->unsetSBOTerm(); } if (getEvent(n)->isSetDelay()) { getEvent(n)->getDelay()->unsetSBOTerm(); } } } }