/** @cond doxygenLibsbmlInternal */ void CompModelPlugin::resetPorts() { for (unsigned int p=0; p<getNumPorts(); p++) { Port* port = getPort(p); SBase* referenced = port->getReferencedElement(); if (port->isSetSBaseRef()) { port->unsetSBaseRef(); port->unsetIdRef(); port->unsetMetaIdRef(); port->unsetUnitRef(); int type = referenced->getTypeCode(); if (referenced->isSetId() && type != SBML_INITIAL_ASSIGNMENT && type != SBML_ASSIGNMENT_RULE && type != SBML_RATE_RULE && type != SBML_EVENT_ASSIGNMENT) { if (type==SBML_UNIT_DEFINITION) { port->setUnitRef(referenced->getId()); } else { port->setIdRef(referenced->getId()); } } else if (referenced->isSetMetaId()) { port->setMetaIdRef(referenced->getMetaId()); } else { stringstream newname; newname << "auto_port_" << p; referenced->setMetaId(newname.str()); port->setMetaIdRef(newname.str()); } } port->clearReferencedElement(); } }