Skip to content

Commit

Permalink
Merge branch 'mixed-env-with-zlib' of https://github.com/sbmlteam/lib…
Browse files Browse the repository at this point in the history
…sbml into mixed-env-with-zlib
  • Loading branch information
luciansmith committed May 5, 2023
2 parents f6ac408 + b70acac commit f16490f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/sbml/packages/comp/util/CompFlatteningConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ CompFlatteningConverter::performConversion()
mDocument->getVersion(),
"The subsequent errors are from this attempt.");

unsetExplicitlyListed();

// setup callback that will enable the packages on submodels
disable_info mainDoc;
mainDoc.doc = mDocument;
Expand Down Expand Up @@ -1253,6 +1255,19 @@ CompFlatteningConverter::restoreNamespaces()
mDocument->enablePackage((*pkg).first, (*pkg).second, true);
}
}

void CompFlatteningConverter::unsetExplicitlyListed()
{
List* elements = mDocument->getAllElements();
for (unsigned int el = 0; el < elements->getSize(); el++) {
SBase* element = static_cast<SBase*>(elements->get(el));
if (element->getTypeCode() == SBML_LIST_OF) {
ListOf* lo = static_cast<ListOf*>(element);
lo->setExplicitlyListed(false);
}
}
}

/** @endcond */

/** @cond doxygenLibsbmlInternal */
Expand Down
2 changes: 2 additions & 0 deletions src/sbml/packages/comp/util/CompFlatteningConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,8 @@ class LIBSBML_EXTERN CompFlatteningConverter : public SBMLConverter

void restoreNamespaces();

void unsetExplicitlyListed();

std::set<std::pair<std::string, std::string> > mDisabledPackages;

#ifndef SWIG
Expand Down
4 changes: 4 additions & 0 deletions src/sbml/util/ElementFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ LIBSBML_CPP_NAMESPACE_BEGIN
pResult->transferFrom(pSublist);\
delete pSublist;\
}\
else {\
if ((pFilter == NULL || pFilter->filter(&list)) && list.getLevel() >= 3 && list.getVersion() >= 2 && list.isExplicitlyListed())\
pResult->add(&list);\
}\
}

#define ADD_FILTERED_PLIST(pResult,pSublist,pList,pFilter)\
Expand Down

0 comments on commit f16490f

Please sign in to comment.