libSBML C++ API  5.11.0
QualValidator Class Referenceabstract
Inheritance diagram for QualValidator:
[legend]

Detailed Description

qual Entry point for package validation.

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.

LibSBML implements facilities for verifying that a given SBML document is valid according to the SBML specifications; it also exposes the validation interface so that user programs and SBML Level 3 package authors may use the facilities to implement new validators. There are two main interfaces to libSBML's validation facilities, based on the classes Validator and ValidatingVisitor.

The QualValidator class is the basis of the system for validating an SBML document against the validation rules defined in the SBML specifications. The scheme used by QualValidator relies is compact and uses the visitor programming pattern, but it relies on C/C++ features and is not directly accessible from language bindings. SBMLQualValidator offers a framework for straightforward class-based extensibility, so that user code can subclass SBMLQualValidator to implement new validation systems, different validators can be introduced or turned off at run-time, and interfaces can be provided in the libSBML language bindings. SBMLQualValidator can call QualValidator functionality internally (as is the case in the current implementation of SBMLInternalQualValidator) or use entirely different implementation approaches, as necessary.

Public Member Functions

virtual void addConstraint (VConstraint *c)
 Adds the given VContraint object to this validator. More...
 
void clearFailures ()
 Clears this Validator's list of validation failures. More...
 
unsigned int getCategory () const
 Get the category of validation rules covered by this validator. More...
 
const std::list< SBMLError > & getFailures () const
 Get the list of SBMLError objects (if any) logged as a result of running the validator. More...
 
virtual void init ()=0
 Initializes this QualValidator object. More...
 
void logFailure (const SBMLError &err)
 Adds the given failure to this list of Validators failures. More...
 
 QualValidator (SBMLErrorCategory_t category=LIBSBML_CAT_SBML)
 Constructor; creates a new QualValidator object for the given category of validation. More...
 
virtual unsigned int validate (const SBMLDocument &d)
 Validates the given SBML document. More...
 
virtual unsigned int validate (const std::string &filename)
 Validates the SBML document located at the given file name. More...
 
virtual ~QualValidator ()
 Destroys this QualValidator object. More...
 

Constructor & Destructor Documentation

QualValidator::QualValidator ( SBMLErrorCategory_t  category = LIBSBML_CAT_SBML)

Constructor; creates a new QualValidator object for the given category of validation.

Parameters
categorycode indicating the kind of validations that this validator will perform. The category code value must be taken from the enumeration SBMLErrorCategory_t
QualValidator::~QualValidator ( )
virtual

Destroys this QualValidator object.

Member Function Documentation

void QualValidator::addConstraint ( VConstraint c)
virtual

Adds the given VContraint object to this validator.

Parameters
cthe VConstraint ("validator constraint") object to add.

Reimplemented from Validator.

void Validator::clearFailures ( )
inherited

Clears this Validator's list of validation failures.

If you are validating multiple SBML documents with the same Validator, call this method after you have processed the list of failures from the last Validation run and before validating the next document.

unsigned int Validator::getCategory ( ) const
inherited

Get the category of validation rules covered by this validator.

The category values are drawn from the enumeration SBMLErrorCategory_t. See the documentation for the class SBMLError for more information.

const std::list< SBMLError > & Validator::getFailures ( ) const
inherited

Get the list of SBMLError objects (if any) logged as a result of running the validator.

Returns
a list of failures logged during validation.
virtual void QualValidator::init ( )
pure virtual

Initializes this QualValidator object.

When creating a subclass of QualValidator, override this method to add your own validation code.

Implements Validator.

void Validator::logFailure ( const SBMLError err)
inherited

Adds the given failure to this list of Validators failures.

Parameters
errthe SBMLError object to append.
unsigned int QualValidator::validate ( const SBMLDocument d)
virtual

Validates the given SBML document.

Parameters
dthe SBMLDocument object to be validated.
Returns
the number of validation failures that occurred. The objects describing the actual failures can be retrieved using getFailures().

Reimplemented from Validator.

unsigned int QualValidator::validate ( const std::string &  filename)
virtual

Validates the SBML document located at the given file name.

Parameters
filenamethe path to the file to be read and validated.
Returns
the number of validation failures that occurred. The objects describing the actual failures can be retrieved using getFailures().

Reimplemented from Validator.