libSBML C# API  libSBML 5.10.0 C# API
 All Classes Namespaces Files Functions Variables Properties Pages
libsbmlcs.SBMLErrorLog Class Reference
Inheritance diagram for libsbmlcs.SBMLErrorLog:
[legend]

Detailed Description

{core}

Log of errors and other events encountered during SBML processing.

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.

The error log is a list. Each SBMLDocument maintains its own SBMLErrorLog. When a libSBML operation on SBML content results in an error, or when there is something worth noting about the SBML content, the issue is reported as an SBMLError object stored in the SBMLErrorLog list.

SBMLErrorLog is derived from XMLErrorLog, an object class that serves exactly the same purpose but for the XML parsing layer. XMLErrorLog provides crucial methods such as getNumErrors() for determining how many SBMLError or XMLError objects are in the log. SBMLErrorLog inherits these methods.

The general approach to working with SBMLErrorLog in user programs involves first obtaining a pointer to a log from a libSBML object such as SBMLDocument. Callers should then use getNumErrors() to inquire how many objects there are in the list. (The answer may be 0.) If there is at least one SBMLError object in the SBMLErrorLog instance, callers can then iterate over the list using SBMLErrorLog::getError(), using methods provided by the SBMLError class to find out the error code and associated information such as the error severity, the message, and the line number in the input.

If you wish to simply print the error strings for a human to read, an easier and more direct way might be to use SBMLDocument::printErrors().

See also
SBMLError
XMLErrorLog
XMLError

Public Member Functions

void add (XMLError error)
 Logs the given XMLError. More...
 
void add (SWIGTYPE_p_std__vectorT_XMLError_p_t errors)
 Logs (copies) the XMLErrors in the given XMLError list to this XMLErrorLog. More...
 
void add (SBMLError error)
 Adds the given SBMLError to the log. More...
 
void changeErrorSeverity (int originalSeverity, int targetSeverity, string package)
 Changes the severity override for errors in the log that have a given severity. More...
 
void changeErrorSeverity (int originalSeverity, int targetSeverity)
 Changes the severity override for errors in the log that have a given severity. More...
 
void clearLog ()
 Deletes all errors from this log. More...
 
bool contains (long errorId)
 Returns true if SBMLErrorLog contains an errorId. More...
 
override void Dispose ()
 
override bool Equals (Object sb)
 
new SBMLError getError (long n)
 Returns the nth SBMLError object in this log. More...
 
override int GetHashCode ()
 
long getNumErrors ()
 Returns the number of errors that have been logged. More...
 
long getNumFailsWithSeverity (long severity)
 Returns the number of errors that have been logged with the given severity code. More...
 
int getSeverityOverride ()
 Returns the current override. More...
 
bool isSeverityOverridden ()
 Returns a bool indicating whether or not the severity has been overridden. More...
 
void logError (long errorId, long level, long version, string details, long line, long column, long severity, long category)
 Convenience function that combines creating an SBMLError object and adding it to the log. More...
 
void logError (long errorId, long level, long version, string details, long line, long column, long severity)
 Convenience function that combines creating an SBMLError object and adding it to the log. More...
 
void logError (long errorId, long level, long version, string details, long line, long column)
 Convenience function that combines creating an SBMLError object and adding it to the log. More...
 
void logError (long errorId, long level, long version, string details, long line)
 Convenience function that combines creating an SBMLError object and adding it to the log. More...
 
void logError (long errorId, long level, long version, string details)
 Convenience function that combines creating an SBMLError object and adding it to the log. More...
 
void logError (long errorId, long level, long version)
 Convenience function that combines creating an SBMLError object and adding it to the log. More...
 
void logError (long errorId, long level)
 Convenience function that combines creating an SBMLError object and adding it to the log. More...
 
void logError (long errorId)
 Convenience function that combines creating an SBMLError object and adding it to the log. More...
 
void logError ()
 Convenience function that combines creating an SBMLError object and adding it to the log. More...
 
void logPackageError (string package, long errorId, long pkgVersion, long level, long version, string details, long line, long column, long severity, long category)
 
void logPackageError (string package, long errorId, long pkgVersion, long level, long version, string details, long line, long column, long severity)
 
void logPackageError (string package, long errorId, long pkgVersion, long level, long version, string details, long line, long column)
 
void logPackageError (string package, long errorId, long pkgVersion, long level, long version, string details, long line)
 
void logPackageError (string package, long errorId, long pkgVersion, long level, long version, string details)
 
void logPackageError (string package, long errorId, long pkgVersion, long level, long version)
 
void logPackageError (string package, long errorId, long pkgVersion, long level)
 
void logPackageError (string package, long errorId, long pkgVersion)
 
void logPackageError (string package, long errorId)
 
void logPackageError (string package)
 
void logPackageError ()
 
void printErrors (OStream stream)
 Prints all the errors or warnings stored in this error log. More...
 
void printErrors ()
 Prints all the errors or warnings stored in this error log. More...
 
void remove (long errorId)
 Removes an error having errorId from the SBMLError list. More...
 
 SBMLErrorLog ()
 Creates a new, empty SBMLErrorLog. More...
 
 SBMLErrorLog (SBMLErrorLog other)
 Copy Constructor. More...
 
void setSeverityOverride (int severity)
 Set the severity override. More...
 
string toString ()
 Writes all errors contained in this log to a string and returns it. More...
 
void unsetSeverityOverride ()
 Usets an existing override. More...
 

Static Public Member Functions

static bool operator!= (XMLErrorLog lhs, XMLErrorLog rhs)
 
static bool operator== (XMLErrorLog lhs, XMLErrorLog rhs)
 

Protected Attributes

bool swigCMemOwn
 

Constructor & Destructor Documentation

libsbmlcs.SBMLErrorLog.SBMLErrorLog ( )

Creates a new, empty SBMLErrorLog.

libsbmlcs.SBMLErrorLog.SBMLErrorLog ( SBMLErrorLog  other)

Copy Constructor.

Member Function Documentation

void libsbmlcs.XMLErrorLog.add ( XMLError  error)
inherited

Logs the given XMLError.

Parameters
errorXMLError, the error to be logged.
void libsbmlcs.XMLErrorLog.add ( SWIGTYPE_p_std__vectorT_XMLError_p_t  errors)
inherited

Logs (copies) the XMLErrors in the given XMLError list to this XMLErrorLog.

Parameters
errorslist, a list of XMLError to be added to the log.
void libsbmlcs.SBMLErrorLog.add ( SBMLError  error)

Adds the given SBMLError to the log.

Parameters
errorSBMLError, the error to be logged.
void libsbmlcs.XMLErrorLog.changeErrorSeverity ( int  originalSeverity,
int  targetSeverity,
string  package 
)
inherited

Changes the severity override for errors in the log that have a given severity.

This searches through the list of errors in the log, comparing each one's severity to the value of originalSeverity. For each error encountered with that severity logged by the named package, the severity of the error is reset to targetSeverity.

Parameters
originalSeveritythe severity code to match
targetSeveritythe severity code to use as the new severity
packagea string, the name of an SBML Level 3 package extension to use to narrow the search for errors. A value of 'all' signifies to match against errors logged from any package; a value of a package nickname such as 'comp' signifies to limit consideration to errors from just that package.
See also
getSeverityOverride()
void libsbmlcs.XMLErrorLog.changeErrorSeverity ( int  originalSeverity,
int  targetSeverity 
)
inherited

Changes the severity override for errors in the log that have a given severity.

This searches through the list of errors in the log, comparing each one's severity to the value of originalSeverity. For each error encountered with that severity logged by the named package, the severity of the error is reset to targetSeverity.

Parameters
originalSeveritythe severity code to match
targetSeveritythe severity code to use as the new severity
packagea string, the name of an SBML Level 3 package extension to use to narrow the search for errors. A value of 'all' signifies to match against errors logged from any package; a value of a package nickname such as 'comp' signifies to limit consideration to errors from just that package.
See also
getSeverityOverride()
void libsbmlcs.XMLErrorLog.clearLog ( )
inherited

Deletes all errors from this log.

bool libsbmlcs.SBMLErrorLog.contains ( long  errorId)

Returns true if SBMLErrorLog contains an errorId.

Parameters
errorIdthe error identifier of the error to be found.
override void libsbmlcs.SBMLErrorLog.Dispose ( )
virtual

Reimplemented from libsbmlcs.XMLErrorLog.

override bool libsbmlcs.XMLErrorLog.Equals ( Object  sb)
inherited
new SBMLError libsbmlcs.SBMLErrorLog.getError ( long  n)

Returns the nth SBMLError object in this log.

Index n is counted from 0. Callers should first inquire about the number of items in the log by using the getNumErrors()method. Attempts to use an error index number that exceeds the actual number of errors in the log will result in a null being returned.

Parameters
nthe index number of the error to retrieve (with 0 being the first error).
Returns
the nth SBMLError in this log, or null if n is greater than or equal to getNumErrors().
See also
getNumErrors()
override int libsbmlcs.XMLErrorLog.GetHashCode ( )
inherited
long libsbmlcs.XMLErrorLog.getNumErrors ( )
inherited

Returns the number of errors that have been logged.

To retrieve individual errors from the log, callers may use XMLErrorLog::getError(long n) .

Returns
the number of errors that have been logged.
long libsbmlcs.SBMLErrorLog.getNumFailsWithSeverity ( long  severity)

Returns the number of errors that have been logged with the given severity code.

*

LibSBML associates severity levels with every SBMLError object to provide an indication of how serious the problem is. Severities range from informational diagnostics to fatal (irrecoverable) errors. Given an SBMLError object instance, a caller can interrogate it for its severity level using methods such as SBMLError::getSeverity(), SBMLError::isFatal(), and so on. The present method encapsulates iteration and interrogation of all objects in an SBMLErrorLog, making it easy to check for the presence of error objects with specific severity levels.

Returns
a count of the number of errors with the given severity code.
See also
getNumErrors()
int libsbmlcs.XMLErrorLog.getSeverityOverride ( )
inherited

Returns the current override.

Returns
a severity override code. The possible values are:
See also
setSeverityOverride()
bool libsbmlcs.XMLErrorLog.isSeverityOverridden ( )
inherited

Returns a bool indicating whether or not the severity has been overridden.

Returns
true if an error severity override has been set, false otherwise.
See also
setSeverityOverride()
void libsbmlcs.SBMLErrorLog.logError ( long  errorId,
long  level,
long  version,
string  details,
long  line,
long  column,
long  severity,
long  category 
)

Convenience function that combines creating an SBMLError object and adding it to the log.

Parameters
errorIda long integer, the identification number of the error.
levela long integer, the SBML Level
versiona long integer, the SBML Level's Version
detailsa string containing additional details about the error. If the error code in errorId is one that is recognized by SBMLError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error.
linea long integer, the line number at which the error occured.
columna long integer, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan integer indicating the category to which the error belongs.
void libsbmlcs.SBMLErrorLog.logError ( long  errorId,
long  level,
long  version,
string  details,
long  line,
long  column,
long  severity 
)

Convenience function that combines creating an SBMLError object and adding it to the log.

Parameters
errorIda long integer, the identification number of the error.
levela long integer, the SBML Level
versiona long integer, the SBML Level's Version
detailsa string containing additional details about the error. If the error code in errorId is one that is recognized by SBMLError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error.
linea long integer, the line number at which the error occured.
columna long integer, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan integer indicating the category to which the error belongs.
void libsbmlcs.SBMLErrorLog.logError ( long  errorId,
long  level,
long  version,
string  details,
long  line,
long  column 
)

Convenience function that combines creating an SBMLError object and adding it to the log.

Parameters
errorIda long integer, the identification number of the error.
levela long integer, the SBML Level
versiona long integer, the SBML Level's Version
detailsa string containing additional details about the error. If the error code in errorId is one that is recognized by SBMLError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error.
linea long integer, the line number at which the error occured.
columna long integer, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan integer indicating the category to which the error belongs.
void libsbmlcs.SBMLErrorLog.logError ( long  errorId,
long  level,
long  version,
string  details,
long  line 
)

Convenience function that combines creating an SBMLError object and adding it to the log.

Parameters
errorIda long integer, the identification number of the error.
levela long integer, the SBML Level
versiona long integer, the SBML Level's Version
detailsa string containing additional details about the error. If the error code in errorId is one that is recognized by SBMLError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error.
linea long integer, the line number at which the error occured.
columna long integer, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan integer indicating the category to which the error belongs.
void libsbmlcs.SBMLErrorLog.logError ( long  errorId,
long  level,
long  version,
string  details 
)

Convenience function that combines creating an SBMLError object and adding it to the log.

Parameters
errorIda long integer, the identification number of the error.
levela long integer, the SBML Level
versiona long integer, the SBML Level's Version
detailsa string containing additional details about the error. If the error code in errorId is one that is recognized by SBMLError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error.
linea long integer, the line number at which the error occured.
columna long integer, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan integer indicating the category to which the error belongs.
void libsbmlcs.SBMLErrorLog.logError ( long  errorId,
long  level,
long  version 
)

Convenience function that combines creating an SBMLError object and adding it to the log.

Parameters
errorIda long integer, the identification number of the error.
levela long integer, the SBML Level
versiona long integer, the SBML Level's Version
detailsa string containing additional details about the error. If the error code in errorId is one that is recognized by SBMLError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error.
linea long integer, the line number at which the error occured.
columna long integer, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan integer indicating the category to which the error belongs.
void libsbmlcs.SBMLErrorLog.logError ( long  errorId,
long  level 
)

Convenience function that combines creating an SBMLError object and adding it to the log.

Parameters
errorIda long integer, the identification number of the error.
levela long integer, the SBML Level
versiona long integer, the SBML Level's Version
detailsa string containing additional details about the error. If the error code in errorId is one that is recognized by SBMLError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error.
linea long integer, the line number at which the error occured.
columna long integer, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan integer indicating the category to which the error belongs.
void libsbmlcs.SBMLErrorLog.logError ( long  errorId)

Convenience function that combines creating an SBMLError object and adding it to the log.

Parameters
errorIda long integer, the identification number of the error.
levela long integer, the SBML Level
versiona long integer, the SBML Level's Version
detailsa string containing additional details about the error. If the error code in errorId is one that is recognized by SBMLError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error.
linea long integer, the line number at which the error occured.
columna long integer, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan integer indicating the category to which the error belongs.
void libsbmlcs.SBMLErrorLog.logError ( )

Convenience function that combines creating an SBMLError object and adding it to the log.

Parameters
errorIda long integer, the identification number of the error.
levela long integer, the SBML Level
versiona long integer, the SBML Level's Version
detailsa string containing additional details about the error. If the error code in errorId is one that is recognized by SBMLError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error.
linea long integer, the line number at which the error occured.
columna long integer, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan integer indicating the category to which the error belongs.
void libsbmlcs.SBMLErrorLog.logPackageError ( string  package,
long  errorId,
long  pkgVersion,
long  level,
long  version,
string  details,
long  line,
long  column,
long  severity,
long  category 
)
void libsbmlcs.SBMLErrorLog.logPackageError ( string  package,
long  errorId,
long  pkgVersion,
long  level,
long  version,
string  details,
long  line,
long  column,
long  severity 
)
void libsbmlcs.SBMLErrorLog.logPackageError ( string  package,
long  errorId,
long  pkgVersion,
long  level,
long  version,
string  details,
long  line,
long  column 
)
void libsbmlcs.SBMLErrorLog.logPackageError ( string  package,
long  errorId,
long  pkgVersion,
long  level,
long  version,
string  details,
long  line 
)
void libsbmlcs.SBMLErrorLog.logPackageError ( string  package,
long  errorId,
long  pkgVersion,
long  level,
long  version,
string  details 
)
void libsbmlcs.SBMLErrorLog.logPackageError ( string  package,
long  errorId,
long  pkgVersion,
long  level,
long  version 
)
void libsbmlcs.SBMLErrorLog.logPackageError ( string  package,
long  errorId,
long  pkgVersion,
long  level 
)
void libsbmlcs.SBMLErrorLog.logPackageError ( string  package,
long  errorId,
long  pkgVersion 
)
void libsbmlcs.SBMLErrorLog.logPackageError ( string  package,
long  errorId 
)
void libsbmlcs.SBMLErrorLog.logPackageError ( string  package)
void libsbmlcs.SBMLErrorLog.logPackageError ( )
static bool libsbmlcs.XMLErrorLog.operator!= ( XMLErrorLog  lhs,
XMLErrorLog  rhs 
)
staticinherited
static bool libsbmlcs.XMLErrorLog.operator== ( XMLErrorLog  lhs,
XMLErrorLog  rhs 
)
staticinherited
void libsbmlcs.XMLErrorLog.printErrors ( OStream  stream)
inherited

Prints all the errors or warnings stored in this error log.

This method prints the text to the stream given by the optional parameter stream. If no stream is given, the method prints the output to the standard error stream.

The format of the output is:

  N error(s):
    line NNN: (id) message

If no errors have occurred, i.e., getNumErrors() == 0, then no output will be produced.

Parameters
streamthe ostream or ostringstream object indicating where the output should be printed.
void libsbmlcs.XMLErrorLog.printErrors ( )
inherited

Prints all the errors or warnings stored in this error log.

This method prints the text to the stream given by the optional parameter stream. If no stream is given, the method prints the output to the standard error stream.

The format of the output is:

  N error(s):
    line NNN: (id) message

If no errors have occurred, i.e., getNumErrors() == 0, then no output will be produced.

Parameters
streamthe ostream or ostringstream object indicating where the output should be printed.
void libsbmlcs.SBMLErrorLog.remove ( long  errorId)

Removes an error having errorId from the SBMLError list.

Only the first item will be removed if there are multiple errors with the given errorId.

Parameters
errorIdthe error identifier of the error to be removed.
void libsbmlcs.XMLErrorLog.setSeverityOverride ( int  severity)
inherited

Set the severity override.

Parameters
severityan override code indicating what to do. If the value is LIBSBML_OVERRIDE_DISABLED (the default setting) all errors logged will be given the severity specified in their usual definition. If the value is LIBSBML_OVERRIDE_WARNING, then all errors will be logged as warnings. If the value is LIBSBML_OVERRIDE_DONT_LOG, no error will be logged, regardless of their severity.
See also
getSeverityOverride()
string libsbmlcs.XMLErrorLog.toString ( )
inherited

Writes all errors contained in this log to a string and returns it.

This method uses printErrors() to format the diagnostic messages. Please consult that method for information about the organization of the messages in the string returned by this method.

Returns
a string containing all logged errors and warnings.
See also
printErrors()
void libsbmlcs.XMLErrorLog.unsetSeverityOverride ( )
inherited

Usets an existing override.

See also
setSeverityOverride()

Member Data Documentation

bool libsbmlcs.XMLErrorLog.swigCMemOwn
protectedinherited