本文整理汇总了C++中Submodel::convertTimeAndExtent方法的典型用法代码示例。如果您正苦于以下问题:C++ Submodel::convertTimeAndExtent方法的具体用法?C++ Submodel::convertTimeAndExtent怎么用?C++ Submodel::convertTimeAndExtent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Submodel
的用法示例。
在下文中一共展示了Submodel::convertTimeAndExtent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collectRenameAndConvertReplacements
int CompModelPlugin::collectRenameAndConvertReplacements(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 perform replacements in CompModelPlugin::collectRenameAndConvertReplacements: 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;
}
List* allElements = model->getAllElements();
vector<ReplacedElement*> res;
vector<ReplacedBy*> rbs;
//Collect replaced elements and replaced by's.
for (unsigned int e=0; e<allElements->getSize(); e++) {
SBase* element = static_cast<SBase*>(allElements->get(e));
int type = element->getTypeCode();
if (type==SBML_COMP_REPLACEDELEMENT) {
ReplacedElement* reference = static_cast<ReplacedElement*>(element);
res.push_back(reference);
}
if (type==SBML_COMP_REPLACEDBY) {
ReplacedBy* reference = static_cast<ReplacedBy*>(element);
rbs.push_back(reference);
}
}
delete allElements;
//ReplacedElement replacements
for (size_t re=0; re<res.size(); re++) {
ret = res[re]->performReplacementAndCollect(removed, toremove);
if (ret != LIBSBML_OPERATION_SUCCESS) {
return ret;
}
}
//Now do the same thing for anything left over in the submodels
for (unsigned int sub=0; sub<getNumSubmodels(); sub++) {
Submodel* submodel = getSubmodel(sub);
Model* mod = submodel->getInstantiation();
if (mod==NULL) return LIBSBML_OPERATION_FAILED;
CompModelPlugin* modplug = static_cast<CompModelPlugin*>(mod->getPlugin(getPrefix()));
if (modplug==NULL) return LIBSBML_OPERATION_FAILED;
//'left behind' converions (not LaHaye-style)
ret = submodel->convertTimeAndExtent();
if (ret != LIBSBML_OPERATION_SUCCESS) return ret;
ret = modplug->collectRenameAndConvertReplacements(removed, toremove);
if (ret != LIBSBML_OPERATION_SUCCESS) return ret;
}
//Perform ReplacedBy replacements *after* the submodels are done, so that the topmost-level names take precedence.
for (size_t rb=0; rb<rbs.size(); rb++) {
ret = rbs[rb]->performReplacementAndCollect(removed, toremove);
if (ret != LIBSBML_OPERATION_SUCCESS) {
return ret;
}
}
return ret;
}