libNuML 1.1.1
Library for reading / writing NuML documents
|
#include <iostream>
#include <string.h>
#include <sbml/xml/XMLAttributes.h>
#include <sbml/xml/XMLNamespaces.h>
#include <sbml/xml/XMLInputStream.h>
#include <sbml/xml/XMLOutputStream.h>
#include <sbml/xml/XMLError.h>
#include <numl/NUMLErrorLog.h>
#include <numl/NUMLVisitor.h>
#include <numl/NUMLError.h>
#include <numl/NUMLDocument.h>
#include <numl/NUMLReader.h>
#include <numl/NUMLWriter.h>
Functions | |
LIBNUML_EXTERN NUMLDocument_t * | NUMLDocument_create () |
Creates a new, empty NUMLDocument_t structure. More... | |
LIBNUML_EXTERN NUMLDocument_t * | NUMLDocument_createWithLevelAndVersion (unsigned int level, unsigned int version) |
Creates a new, empty NUMLDocument_t structure with given values for the NUML Level and Version. More... | |
LIBNUML_EXTERN void | NUMLDocument_free (NUMLDocument_t *d) |
Frees the given NUMLDocument_t structure. More... | |
LIBNUML_EXTERN NUMLDocument_t * | NUMLDocument_clone (const NUMLDocument_t *d) |
Creates and returns a deep copy of the given NUMLDocument_t structure. More... | |
LIBNUML_EXTERN unsigned int | NUMLDocument_getLevel (const NUMLDocument_t *d) |
Returns the NUML Level of the given NUMLDocument_t structure. More... | |
LIBNUML_EXTERN unsigned int | NUMLDocument_getVersion (const NUMLDocument_t *d) |
Returns the Version within the NUML Level of the given NUMLDocument_t structure. More... | |
LIBNUML_EXTERN int | NUMLDocument_setLevelAndVersion (NUMLDocument_t *d, unsigned int level, unsigned int version) |
Sets the NUML Level and Version of this NUMLDocument, attempting to convert the ResultComponent as needed. More... | |
LIBNUML_EXTERN int | NUMLDocument_setLevelAndVersionStrict (NUMLDocument_t *d, unsigned int level, unsigned int version) |
Sets the NUML Level and Version of this NUMLDocument, attempting to convert the model as needed. More... | |
LIBNUML_EXTERN const NUMLError_t * | NUMLDocument_getError (NUMLDocument_t *d, unsigned int n) |
Returns the nth error or warning encountered during parsing, consistency checking, or attempted translation of this model. More... | |
LIBNUML_EXTERN unsigned int | NUMLDocument_getNumErrors (const NUMLDocument_t *d) |
Returns the number of errors or warnings encountered during parsing, consistency checking, or attempted translation of this model. More... | |
LIBNUML_EXTERN void | NUMLDocument_printErrors (NUMLDocument_t *d, FILE *stream) |
Prints to the given output stream all the errors or warnings encountered during parsing, consistency checking, or attempted translation of this model. More... | |
unsigned int | NUMLDocument_getDefaultLevel () |
unsigned int | NUMLDocument_getDefaultVersion () |
LIBNUML_EXTERN const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces_t * | NUMLDocument_getNamespaces (NUMLDocument_t *d) |
Returns a list of XMLNamespaces_t associated with the XML content of this NUML document. More... | |
LIBNUML_EXTERN NUMLDocument_t * NUMLDocument_clone | ( | const NUMLDocument_t * | d | ) |
Creates and returns a deep copy of the given NUMLDocument_t structure.
d | the NUMLDocument_t structure |
LIBNUML_EXTERN NUMLDocument_t * NUMLDocument_create | ( | ) |
Creates a new, empty NUMLDocument_t structure.
The NUML Level and Version attributes default to the most recent NUML specification (at the time this libNUML was released).
LIBNUML_EXTERN NUMLDocument_t * NUMLDocument_createWithLevelAndVersion | ( | unsigned int | level, |
unsigned int | version | ||
) |
Creates a new, empty NUMLDocument_t structure with given values for the NUML Level and Version.
If not specified, the NUML Level and Version attributes default to the most recent NUML specification (at the time this libNUML was released).
level | an integer for the NUML Level |
version | an integer for the Version within the NUML Level |
LIBNUML_EXTERN void NUMLDocument_free | ( | NUMLDocument_t * | d | ) |
Frees the given NUMLDocument_t structure.
d | the NUMLDocument_t structure |
unsigned int NUMLDocument_getDefaultLevel | ( | ) |
unsigned int NUMLDocument_getDefaultVersion | ( | ) |
LIBNUML_EXTERN const NUMLError_t * NUMLDocument_getError | ( | NUMLDocument_t * | d, |
unsigned int | n | ||
) |
Returns the nth error or warning encountered during parsing, consistency checking, or attempted translation of this model.
Callers can use method XMLError_getSeverity() on the result to assess the severity of the problem. The severity levels range from informationl messages to fatal errors.
n
, or return NULL if n > (NUMLDocument_getNumErrors() - 1).d | the NUMLDocument_t structure |
n | the index of the error sought. |
LIBNUML_EXTERN unsigned int NUMLDocument_getLevel | ( | const NUMLDocument_t * | d | ) |
Returns the NUML Level of the given NUMLDocument_t structure.
d | the NUMLDocument_t structure |
LIBNUML_EXTERN const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces_t * NUMLDocument_getNamespaces | ( | NUMLDocument_t * | d | ) |
Returns a list of XMLNamespaces_t associated with the XML content of this NUML document.
d | the NUMLDocument_t structure |
LIBNUML_EXTERN unsigned int NUMLDocument_getNumErrors | ( | const NUMLDocument_t * | d | ) |
Returns the number of errors or warnings encountered during parsing, consistency checking, or attempted translation of this model.
d | the NUMLDocument_t structure |
LIBNUML_EXTERN unsigned int NUMLDocument_getVersion | ( | const NUMLDocument_t * | d | ) |
Returns the Version within the NUML Level of the given NUMLDocument_t structure.
d | the NUMLDocument_t structure |
LIBNUML_EXTERN void NUMLDocument_printErrors | ( | NUMLDocument_t * | d, |
FILE * | stream | ||
) |
Prints to the given output stream all the errors or warnings encountered during parsing, consistency checking, or attempted translation of this model.
If no errors have occurred, i.e., NUMLDocument_getNumErrors() == 0, no output will be sent to the stream.
The format of the output is:
N error(s): line NNN: (id) message
d | the NUMLDocument_t structure |
stream | the output stream where the messages should be printed |
LIBNUML_EXTERN int NUMLDocument_setLevelAndVersion | ( | NUMLDocument_t * | d, |
unsigned int | level, | ||
unsigned int | version | ||
) |
Sets the NUML Level and Version of this NUMLDocument, attempting to convert the ResultComponent as needed.
This method is used to convert numl between Levels and Versions of NUML.
Callers can also check compatibility directly using the methods
The valid combinations as of this release of libNUML are the following:
d | the NUMLDocument_t structure |
level | the desired NUML Level |
version | the desired Version within the NUML Level |
LIBNUML_EXTERN int NUMLDocument_setLevelAndVersionStrict | ( | NUMLDocument_t * | d, |
unsigned int | level, | ||
unsigned int | version | ||
) |
Sets the NUML Level and Version of this NUMLDocument, attempting to convert the model as needed.
This method is used to convert models between Levels and Versions of NUML.
Callers can also check compatibility directly using the methods
The valid combinations as of this release of libNUML are the following:
d | the NUMLDocument_t structure |
level | the desired NUML Level |
version | the desired Version within the NUML Level |
Strict conversion applies the additional criteria that both the source and the target model must be consistent NUML. Users can control the consistency checks that are applied using the NUMLDocument::setConsistencyChecks function. If either the source or the potential target model have validation errors, the conversion is not performed. When a strict conversion is successful, the underlying NUML object model is altered to reflect the new level and version. Thus information that cannot be converted (e.g. sboTerms) will be lost.