本文整理汇总了C++中ListOf::getItemTypeCode方法的典型用法代码示例。如果您正苦于以下问题:C++ ListOf::getItemTypeCode方法的具体用法?C++ ListOf::getItemTypeCode怎么用?C++ ListOf::getItemTypeCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListOf
的用法示例。
在下文中一共展示了ListOf::getItemTypeCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: performReplacementAndCollect
int ReplacedElement::performReplacementAndCollect(set<SBase*>* removed, set<SBase*>* toremove)
{
SBMLDocument* doc = getSBMLDocument();
if (isSetDeletion()) {
//Deletions don't need to be replaced.
return LIBSBML_OPERATION_SUCCESS;
}
//Find the various objects and plugin objects we need for this to work.
SBase* lore = getParentSBMLObject();
ListOf* lorelist = static_cast<ListOf*>(lore);
if (lore == NULL) {
if (doc) {
string error = "Cannot carry out replacement in ReplacedElement::performReplacement: no parent <listOfReplacedElements> could be found for the given replacement element.";
doc->getErrorLog()->logPackageError("comp", CompModelFlatteningFailed, getPackageVersion(), getLevel(), getVersion(), error, getLine(), getColumn());
}
return LIBSBML_INVALID_OBJECT;
}
if (lore->getTypeCode() != SBML_LIST_OF || lorelist->getItemTypeCode() != SBML_COMP_REPLACEDELEMENT) {
if (doc) {
string error = "Cannot carry out replacement in ReplacedElement::performReplacement: no parent <listOfReplacedElements> could be found for the given replacement element.";
doc->getErrorLog()->logPackageError("comp", CompModelFlatteningFailed, getPackageVersion(), getLevel(), getVersion(), error, getLine(), getColumn());
}
return LIBSBML_INVALID_OBJECT;
}
SBase* parent = lore->getParentSBMLObject();
if (parent==NULL) {
if (doc) {
string error = "Cannot carry out replacement in ReplacedElement::performReplacement: no parent could be found for the parent <listOfReplacedElements> object.";
doc->getErrorLog()->logPackageError("comp", CompModelFlatteningFailed, getPackageVersion(), getLevel(), getVersion(), error, getLine(), getColumn());
}
return LIBSBML_INVALID_OBJECT;
}
SBase* ref = getReferencedElement();
if (ref==NULL) {
//getReferencedElement sets its own error messages.
return LIBSBML_INVALID_OBJECT;
}
if (removed && removed->find(ref)!=removed->end()) {
//Already deleted: can't get the deleted element's ID to
if (doc) {
string error = "Cannot carry out replacement in ReplacedElement::performReplacement: a <" + parent->getElementName() + ">";
if (parent->isSetId()) {
error += " with the ID '" + parent->getId() + "'";
}
error += " has a child <replacedElement> that points to something that has already been deleted, probably because its parent was deleted.";
doc->getErrorLog()->logPackageError("comp", CompDeletedReplacement, getPackageVersion(), getLevel(), getVersion(), error, getLine(), getColumn());
}
return LIBSBML_INVALID_OBJECT;
}
//Update the IDs.
int ret = updateIDs(ref, parent);
if (ret != LIBSBML_OPERATION_SUCCESS) {
return ret;
}
//Perform any conversions on references in the submodel.
ASTNode* blank = NULL;
ret = performConversions(parent, &blank);
if (ret != LIBSBML_OPERATION_SUCCESS)
{
if (blank != NULL)
{
delete blank;
}
return ret;
}
CompSBasePlugin* refplug = static_cast<CompSBasePlugin*>(ref->getPlugin(getPrefix()));
if (refplug != NULL) {
//Now recurse down the 'replace*' tree, renaming IDs and deleting things as we go.
for (unsigned int re=0; re<refplug->getNumReplacedElements(); re++) {
refplug->getReplacedElement(re)->replaceWithAndMaybeDelete(parent, true, blank);
if (toremove) {
toremove->insert(refplug->getReplacedElement(re)->getReferencedElement());
}
}
if (refplug->isSetReplacedBy()) {
//Even if the subelement used to be replaced by something further down, it is now being replaced by the parent. It just can't catch a break, it seems.
refplug->getReplacedBy()->replaceWithAndMaybeDelete(parent, true, blank);
if (toremove) {
toremove->insert(refplug->getReplacedBy()->getReferencedElement());
}
}
}
if (toremove) {
toremove->insert(ref);
}
if (blank != NULL)
{
delete blank;
}
return LIBSBML_OPERATION_SUCCESS;
}