本文整理汇总了C++中SBMLErrorLog::clearLog方法的典型用法代码示例。如果您正苦于以下问题:C++ SBMLErrorLog::clearLog方法的具体用法?C++ SBMLErrorLog::clearLog怎么用?C++ SBMLErrorLog::clearLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SBMLErrorLog
的用法示例。
在下文中一共展示了SBMLErrorLog::clearLog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/*
* Performs a set of semantic consistency checks on the document. Query
* the results by calling getNumErrors() and getError().
*
* @return the number of failed checks (errors) encountered.
*/
unsigned int
SBMLInternalValidator::checkConsistency (bool writeDocument)
{
unsigned int nerrors = 0;
unsigned int total_errors = 0;
//if (getLevel() == 3)
//{
// logError(L3NotSupported);
// return 1;
//}
/* determine which validators to run */
bool id = ((mApplicableValidators & 0x01) == 0x01);
bool sbml = ((mApplicableValidators & 0x02) == 0x02);
bool sbo = ((mApplicableValidators & 0x04) == 0x04);
bool math = ((mApplicableValidators & 0x08) == 0x08);
bool units = ((mApplicableValidators & 0x10) == 0x10);
bool over = ((mApplicableValidators & 0x20) == 0x20);
bool practice = ((mApplicableValidators & 0x40) == 0x40);
/* taken the state machine concept out for now
if (LibSBMLStateMachine::isActive())
{
units = LibSBMLStateMachine::getUnitState();
}
*/
IdentifierConsistencyValidator id_validator;
ConsistencyValidator validator;
SBOConsistencyValidator sbo_validator;
MathMLConsistencyValidator math_validator;
UnitConsistencyValidator unit_validator;
OverdeterminedValidator over_validator;
ModelingPracticeValidator practice_validator;
SBMLDocument *doc;
SBMLErrorLog *log = getErrorLog();
if (writeDocument)
{
char* sbmlString = writeSBMLToString(getDocument());
log->clearLog();
doc = readSBMLFromString(sbmlString);
free (sbmlString);
}
else
{
doc = getDocument();
}
/* calls each specified validator in turn
* - stopping when errors are encountered */
if (id)
{
id_validator.init();
nerrors = id_validator.validate(*doc);
if (nerrors > 0)
{
unsigned int origNum = log->getNumErrors();
log->add( id_validator.getFailures() );
if (origNum > 0 && log->contains(InvalidUnitIdSyntax) == true)
{
/* do not log dangling ref */
while (log->contains(DanglingUnitSIdRef) == true)
{
log->remove(DanglingUnitSIdRef);
nerrors--;
}
total_errors += nerrors;
if (nerrors > 0)
{
if (writeDocument)
SBMLDocument_free(doc);
return total_errors;
}
}
else if (log->contains(DanglingUnitSIdRef) == false)
{
total_errors += nerrors;
if (writeDocument)
SBMLDocument_free(doc);
return total_errors;
}
else
{
bool onlyDangRef = true;
for (unsigned int a = 0; a < log->getNumErrors(); a++)
{
if (log->getError(a)->getErrorId() != DanglingUnitSIdRef)
{
onlyDangRef = false;
//.........这里部分代码省略.........
示例2: if
/** @cond doxygenLibsbmlInternal */
int
CompFlatteningConverter::validateFlatDocument(Model * flatmodel,
unsigned int pkgVersion, unsigned int level, unsigned int version)
{
int result;
// create a dummyDocument that will mirror what the user options are
// we need the dummyDoc to know things about unknown packages
// but dont want the original model/error log
SBMLDocument dummy = SBMLDocument(*(mDocument));
dummy.setModel(NULL);
dummy.getErrorLog()->clearLog();
// Otherwise, transfer only errors 1090107->1090110
SBMLErrorLog* log = mDocument->getErrorLog();
for (unsigned int en=0; en<log->getNumErrors(); en++)
{
unsigned int errid = mDocument->getError(en)->getErrorId();
if (errid == CompFlatteningNotRecognisedNotReqd ||
errid == CompFlatteningNotRecognisedReqd ||
errid == CompFlatteningNotImplementedNotReqd ||
errid == CompFlatteningNotImplementedReqd)
{
dummy.getErrorLog()->add(*(mDocument->getError(en)));
}
}
log->clearLog();
result = reconstructDocument(flatmodel, dummy, true );
if (result != LIBSBML_OPERATION_SUCCESS)
{
//delete flatmodel;
restoreNamespaces();
return result;
}
//Now check to see if the flat model is valid
// run regular validation on the flattened document if requested.
// override comp flattening if necessary
CompSBMLDocumentPlugin * dummyPlugin = static_cast<CompSBMLDocumentPlugin*>
(dummy.getPlugin("comp"));
if (dummyPlugin != NULL)
{
dummyPlugin->setOverrideCompFlattening(true);
}
std::string sbml = writeSBMLToStdString(&dummy);
SBMLDocument *tempdoc = readSBMLFromString(sbml.c_str());
unsigned int errors =
tempdoc->getErrorLog()->getNumFailsWithSeverity(LIBSBML_SEV_ERROR);
// take out the error about a requiredpackage
// if the user has specified to not abort for any packages
// NOTE: we cannot actually remove it since the flattening code
// uses it to check whether references might come from
// other packages
if (getAbortForNone() == true)
{
if (tempdoc->getErrorLog()->contains(RequiredPackagePresent))
{
errors--;
}
}
if (errors > 0)
{
// we have serious errors so we are going to bail on the
// flattening - log ONLY the errors
//Transfer the errors to mDocument and don't reset the model.
if (log->contains(CompLineNumbersUnreliable) == false)
{
log->logPackageError("comp", CompLineNumbersUnreliable,
pkgVersion, level, version);
}
std::string message = "Errors that follow relate to the flattened ";
message += "document produced using the CompFlatteningConverter.";
log->logPackageError("comp", CompFlatModelNotValid,
pkgVersion, level, version);
unsigned int nerrors = tempdoc->getErrorLog()->getNumErrors();
for (unsigned int n = 0; n < nerrors; n++)
{
const SBMLError* error = tempdoc->getError(n);
if (error->getSeverity() >= LIBSBML_SEV_ERROR)
{
log->add( *(error) );
}
if (error->getErrorId() >= CompFlatteningNotRecognisedNotReqd &&
error->getErrorId() <= CompFlatteningNotImplementedReqd)
{
log->add( *(error) );
}
else if (error->getErrorId() == UnrequiredPackagePresent ||
error->getErrorId() == RequiredPackagePresent)
{
log->add( *(error) );
}
//.........这里部分代码省略.........