本文整理汇总了C++中Submodel::getDeletion方法的典型用法代码示例。如果您正苦于以下问题:C++ Submodel::getDeletion方法的具体用法?C++ Submodel::getDeletion怎么用?C++ Submodel::getDeletion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Submodel
的用法示例。
在下文中一共展示了Submodel::getDeletion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collectDeletionsAndDeleteSome
int CompModelPlugin::collectDeletionsAndDeleteSome(set<SBase*>* removed, set<SBase*>* toremove)
{
int ret = LIBSBML_OPERATION_SUCCESS;
SBMLDocument* doc = getSBMLDocument();
Model* model = static_cast<Model*>(getParentSBMLObject());
if (model==NULL) {
if (doc) {
string error = "Unable to attempt to perform deletions in CompModelPlugin::collectDeletionsAndDeleteSome: no parent model could be found for the given 'comp' model plugin element.";
doc->getErrorLog()->logPackageError("comp", CompModelFlatteningFailed, getPackageVersion(), getLevel(), getVersion(), error);
}
return LIBSBML_OPERATION_FAILED;
}
//Since deletions only exist in submodels, loop through the submodels.
for (unsigned int sub=0; sub<getNumSubmodels(); sub++) {
Submodel* submodel = getSubmodel(sub);
//First perform any deletions
for (unsigned int d=0; d<submodel->getNumDeletions(); d++) {
Deletion* deletion = submodel->getDeletion(d);
SBase* todel = deletion->getReferencedElement();
if (todel && (todel->getTypeCode() == SBML_COMP_DELETION ||
todel->getTypeCode() == SBML_COMP_REPLACEDBY ||
todel->getTypeCode() == SBML_COMP_REPLACEDELEMENT ||
todel->getTypeCode() == SBML_LOCAL_PARAMETER) )
{
//Go ahead and delete it!
set<SBase*> newToRemove;
newToRemove.insert(todel);
removeCollectedElements(removed, &newToRemove);
}
else {
//Otherwise, just collect it.
ret = deletion->collectDeletions(removed, toremove);
if (ret!=LIBSBML_OPERATION_SUCCESS) {
return ret;
}
}
}
//Next collect any deletions in that instantiated submodel (any that weren't just deleted)
Model* mod = submodel->getInstantiation();
if (mod==NULL) {
//getInstantiation sets its own error messages.
return LIBSBML_OPERATION_FAILED;
}
CompModelPlugin* modplug = static_cast<CompModelPlugin*>(mod->getPlugin(getPrefix()));
if (modplug==NULL) {
if (doc) {
//Shouldn't happen: 'getInstantiation' turns on the comp plugin.
string error = "Unable to rename elements in CompModelPlugin::collectDeletionsAndDeleteSome: no valid 'comp' plugin for the model instantiated from submodel " + submodel->getId();
doc->getErrorLog()->logPackageError("comp", CompModelFlatteningFailed, getPackageVersion(), getLevel(), getVersion(), error);
}
return LIBSBML_OPERATION_FAILED;
}
modplug->collectDeletionsAndDeleteSome(removed, toremove);
}
return ret;
}
示例2: getSBMLDocument
SBase*
ReplacedElement::getReferencedElementFrom(Model* model)
{
SBMLDocument* doc = getSBMLDocument();
SBase* referent = Replacing::getReferencedElementFrom(model);
if (referent != NULL) return referent;
if (!isSetDeletion()) {
//In this case, something else went wrong in getReferencedElementFrom, which will have set its own error message.
return NULL;
}
model = getParentModel(this);
if (model==NULL) {
if (doc) {
string error = "In ReplacedElement::getReferencedElementFrom, unable to find referenced deletion '" + getDeletion() + "' for <replacedElement>: no parent model could be found.";
doc->getErrorLog()->logPackageError("comp", CompModelFlatteningFailed, getPackageVersion(), getLevel(), getVersion(), error, getLine(), getColumn());
}
return NULL;
}
CompModelPlugin* mplugin = static_cast<CompModelPlugin*>(model->getPlugin(getPrefix()));
if (mplugin==NULL) {
if (doc) {
string error = "In ReplacedElement::getReferencedElementFrom, unable to find referenced deletion '" + getDeletion() + "' for <replacedElement>: no 'comp' plugin for the parent model could be found.";
doc->getErrorLog()->logPackageError("comp", CompModelFlatteningFailed, getPackageVersion(), getLevel(), getVersion(), error, getLine(), getColumn());
}
return NULL;
}
Submodel* submod = mplugin->getSubmodel(getSubmodelRef());
if (submod==NULL) {
if (doc) {
string error = "In ReplacedElement::getReferencedElementFrom, unable to find referenced deletion '" + getDeletion() + "' for <replacedElement>: no such submodel '" + getSubmodelRef() + "'.";
doc->getErrorLog()->logPackageError("comp", CompReplacedElementSubModelRef, getPackageVersion(), getLevel(), getVersion(), error, getLine(), getColumn());
}
return NULL;
}
SBase* ret = submod->getDeletion(getDeletion());
if (ret==NULL && doc) {
string error = "In ReplacedElement::getReferencedElementFrom, unable to find referenced deletion '" + getDeletion() + "' for <replacedElement>: no deletion with that ID exists in the model.";
doc->getErrorLog()->logPackageError("comp", CompDeletionMustReferenceObject, getPackageVersion(), getLevel(), getVersion(), error, getLine(), getColumn());
}
return ret;
}