libNuML  1.1.1
Library for reading / writing NuML documents
NUMLError.h
Go to the documentation of this file.
1 /*
2 * ****************************************************************************
3 * This file is part of libNUML. Please visit http://code.google.com/p/numl/for more
4 * information about NUML, and the latest version of libNUML.
5 * Copyright (c) 2013 The University of Manchester.
6 *
7 * This library is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation. A copy of the license agreement is
10 * provided in the file named "LICENSE.txt" included with this software
11 * distribution and also available online as http://www.gnu.org/licenses/lgpl.html
12 *
13 * Contributors:
14 * Joseph O. Dada, The University of Manchester - initial API and implementation
15 * ****************************************************************************
16 **/
17 
24 #ifndef NUMLError_h
25 #define NUMLError_h
26 
27 #include <numl/common/extern.h>
28 #include <sbml/xml/XMLError.h>
29 #include <numl/NUMLNamespaces.h>
30 
31 
32 LIBNUML_CPP_NAMESPACE_BEGIN
34 
45 typedef enum
46 {
48  , NUMLNotUTF8 = 10101
80  , NUMLMissingModel = 20201
95  /* Lower bound for additional error codes returned by libNUML but not
96  * defined in NUML specifications. */
97 
102  /* L1Compatability */
103 
104  , NUMLNoEventsInL1 = 91001
110  /* These are errors checked by libNUML that were never
111  * published in a spec. */
112 
118  /* These are internal errors that reverts to 10501. */
119 
123  /* Internal consistency checks */
124 
127  /* Bounds */
128 
134 
135 
145 typedef enum
146 {
148 
149  LIBNUML_CAT_NUML = (LIBSBML_CPP_NAMESPACE_QUALIFIER LIBSBML_CAT_XML + 1)
174  /* , LIBNUML_CAT_SBO_CONSISTENCY
175  !< Category of errors that can occur while validating SBO identifiers
176  * in a numl objects. With respect to the NUML specification, these concern
177  * failures in applying the validation rules numbered 107xx in the
178  * Level&nbsp;2 Versions&nbsp;2 and&nbsp;3 specifications. */
186 
187 
195 typedef enum
196 {
197 
198  /* The following are used internally in NUMLErrorTable, but publicly,
199  * we only report one of the 4 XMLError_Severity values. Translation
200  * of the codes is done in NUMLError.cpp.
201  */
202 
203  LIBNUML_SEV_ERROR = LIBSBML_CPP_NAMESPACE_QUALIFIER LIBSBML_SEV_ERROR,
204  LIBNUML_SEV_FATAL = LIBSBML_CPP_NAMESPACE_QUALIFIER LIBSBML_SEV_FATAL,
205  LIBNUML_SEV_WARNING = LIBSBML_CPP_NAMESPACE_QUALIFIER LIBSBML_SEV_WARNING,
206 
226 
228 LIBNUML_CPP_NAMESPACE_END
229 
230 #ifdef __cplusplus
231 
232 LIBNUML_CPP_NAMESPACE_BEGIN
233 
234 class LIBNUML_EXTERN NUMLError : public LIBSBML_CPP_NAMESPACE_QUALIFIER XMLError
235 {
236 public:
237 
348  NUMLError
349  (
350  const unsigned int errorId = 0
351  , const unsigned int level = NUML_DEFAULT_LEVEL
352  , const unsigned int version = NUML_DEFAULT_VERSION
353  , const std::string& details = ""
354  , const unsigned int line = 0
355  , const unsigned int column = 0
356  , const unsigned int severity = LIBNUML_SEV_ERROR
357  , const unsigned int category = LIBNUML_CAT_NUML
358  );
359 
363  NUMLError(const NUMLError& orig);
364 
365 
369  virtual NUMLError* clone() const;
370 
371 #ifndef SWIG
372 
381  virtual void print(std::ostream& stream) const;
382 
383 
384 #endif /* !SWIG */
385 
386 protected:
387 
388  virtual std::string stringForSeverity(unsigned int code) const;
389  virtual std::string stringForCategory(unsigned int code) const;
390 
391 
392 };
393 
394 LIBNUML_CPP_NAMESPACE_END
395 
396 #endif /* __cplusplus */
397 #endif /* NUMLError_h */
InvalidNUMLLevelVersion
Invalid NUML Level and Version.
Definition: NUMLError.h:113
NUMLMissingOntologyTerms
Missing OntologyTerms.
Definition: NUMLError.h:63
NUMLMultipleEventAssignmentsForId
Multiple event assignments for the same variable.
Definition: NUMLError.h:53
NUMLDuplicateAnnotationNamespaces
Multiple annotations using same XML namespace.
Definition: NUMLError.h:61
LIBNUML_CAT_GENERAL_CONSISTENCY
Category of errors that can occur while validating general NUML constructs.
Definition: NUMLError.h:163
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: extern.h:112
LIBNUML_CAT_NUML
General NUML error not falling into another category below.
Definition: NUMLError.h:149
NUMLUnknownError
Unknown internal libNUML error.
Definition: NUMLError.h:47
LIBNUML_SEV_NOT_APPLICABLE
This error code is only a placeholder for errors that have relevance to some versions of NUML but not...
Definition: NUMLError.h:220
NUMLNotSchemaConformant
Not conformant to NUML XML schema.
Definition: NUMLError.h:50
NUMLInvalidMathElement
Invalid MathML.
Definition: NUMLError.h:51
NUMLErrorCode_t
NUMLErrorCode_t
Codes for all NUML-level errors and warnings.
Definition: NUMLError.h:45
NUMLError
contains all error information collected
Definition: NUMLError.h:234
NUML_DEFAULT_LEVEL
const LIBNUML_CPP_NAMESPACE_BEGIN unsigned int NUML_DEFAULT_LEVEL
Definition: NUMLNamespaces.h:41
NUMLDuplicateMetaId
Duplicate metaid identifier.
Definition: NUMLError.h:55
extern.h
NUMLInvalidNamespaceOnNUML
Invalid XML namespace for NUML container.
Definition: NUMLError.h:76
LIBNUML_EXTERN
#define LIBNUML_EXTERN
Begin svn Header.
Definition: extern.h:104
LIBNUML_SEV_FATAL
Definition: NUMLError.h:204
LIBNUML_SEV_GENERAL_WARNING
The XML content is invalid for some levels/versions of NUML, and while it may be valid in others,...
Definition: NUMLError.h:212
NUMLStrictUnitsRequiredInL1
NUML Level&#160;1 requires strict unit consistency.
Definition: NUMLError.h:105
NUMLConstraintContainsXMLDecl
XML declarations not permitted in constraint messages.
Definition: NUMLError.h:87
LIBNUML_CAT_NUML_L1_COMPAT
Category of errors that can only occur during attempted translation from one Level/Version of NUML to...
Definition: NUMLError.h:152
NUMLInvalidModelSBOTerm
Invalid sboTerm value for model.
Definition: NUMLError.h:68
NUMLNoEventsInL1
NUML Level&#160;1 does not support events.
Definition: NUMLError.h:104
NUMLNeedCompartmentIfHaveSpecies
Missing compartment in species definition.
Definition: NUMLError.h:83
NUMLNoConstraintsInL2v1
NUML Level&#160;2 Version&#160;1 does not support constraints.
Definition: NUMLError.h:107
NUMLEventAndAssignmentRuleForId
variable value used in both event assignments and assignment rules
Definition: NUMLError.h:54
NUMLInvalidUnitIdSyntax
Invalid unit identifier syntax.
Definition: NUMLError.h:59
NUMLConstraintContainsDOCTYPE
XML DOCTYPE not permitted in constraint messages.
Definition: NUMLError.h:88
NUMLErrorCategory_t
NUMLErrorCategory_t
Category codes for NUMLError diagnostics.
Definition: NUMLError.h:145
NUML_DEFAULT_VERSION
const unsigned int NUML_DEFAULT_VERSION
Definition: NUMLNamespaces.h:42
END_C_DECLS
#define END_C_DECLS
Definition: extern.h:113
NUMLInvalidApplyCiInLambda
Invalid forward reference in <apply><ci>...</ci></apply> value.
Definition: NUMLError.h:85
NUMLInvalidSBOTermSyntax
Invalid sboTerm value syntax.
Definition: NUMLError.h:56
NUMLAnnotationNotesNotAllowedLevel1
Annotation on <numl> not permitted in NUML Level&#160;1.
Definition: NUMLError.h:79
LIBNUML_CAT_NUML_L1V1_COMPAT
Category of errors that can only occur during attempted translation from one Level/Version of NUML to...
Definition: NUMLError.h:158
NUMLAssignRuleCompartmentMismatch
Mismatched units in assignment rule for compartment.
Definition: NUMLError.h:66
NUMLNotUTF8
Not UTF8.
Definition: NUMLError.h:48
NUMLNamespaces.h
LIBNUML_CAT_INTERNAL
Definition: NUMLError.h:147
NUMLIncorrectOrderInModel
Incorrect ordering of components in model definition.
Definition: NUMLError.h:81
NUMLInvalidFunctionDefSBOTerm
Invalid sboTerm value for function definition.
Definition: NUMLError.h:69
NUMLInvalidConstraintContent
Invalid content for constraint message.
Definition: NUMLError.h:89
NUMLNotesContainsDOCTYPE
XML DOCTYPE not permitted in notes.
Definition: NUMLError.h:74
NUMLFunctionDefMathNotLambda
Invalid expression in function definition.
Definition: NUMLError.h:84
NUMLOffsetNotValidAttribute
Attribute offset on units only available in NUML Level&#160;2 Version&#160;1.
Definition: NUMLError.h:125
NUMLErrorSeverity_t
NUMLErrorSeverity_t
Severity codes for NUMLError diagnostics.
Definition: NUMLError.h:195
NUMLCodesUpperBound
99999, the upper bound of all libNUML codes.
Definition: NUMLError.h:129
NUMLNamespaceInAnnotation
Invalid use of NUML XML namespace in annotation.
Definition: NUMLError.h:62
NUMLInvalidRuleSBOTerm
Invalid sboTerm value for rule.
Definition: NUMLError.h:70
NUMLMissingResultComponents
Missing ResultComponents.
Definition: NUMLError.h:64
LIBNUML_SEV_WARNING
Definition: NUMLError.h:205
NUMLMultipleAssignmentOrRateRules
Multiple rules for the same variable.
Definition: NUMLError.h:52
LIBNUML_SEV_SCHEMA_ERROR
The XML content does not conform to the relevant version of the NUML XML Schema.
Definition: NUMLError.h:207
LIBNUML_SEV_ERROR
Definition: NUMLError.h:203
NUMLNoTimeSymbolInFunctionDef
<csymbol> for time used within the <math> of a function definition
Definition: NUMLError.h:115
NUMLMissingOrInconsistentLevel
Missing or inconsistent value for level attribute.
Definition: NUMLError.h:77
NUMLNotesNotInXHTMLNamespace
Notes not placed in XHTML namespace.
Definition: NUMLError.h:72
NUMLNotesContainsXMLDecl
XML declarations not permitted in notes.
Definition: NUMLError.h:73
NUMLUnrecognizedElement
Unrecognized element.
Definition: NUMLError.h:49
NUMLInvalidIdSyntax
Invalid identifier syntax.
Definition: NUMLError.h:58
LibNUMLAdditionalCodesLowerBound
Lower bound of libNUML-specific codes.
Definition: NUMLError.h:98
NUMLMissingModel
Missing model.
Definition: NUMLError.h:80
NUMLStrictUnitsRequiredInL2v1
NUML Level&#160;2 Version&#160;1 requires strict unit consistency.
Definition: NUMLError.h:108
NUMLEventAssignmentForConstantEntity
Cannot assign to a constant component in an event assignment.
Definition: NUMLError.h:91
LIBNUML_CAT_INTERNAL_CONSISTENCY
Category of errors that can occur while validating libNUML's internal representation of NUML construc...
Definition: NUMLError.h:179
NUMLMissingAnnotationNamespace
Missing declaration of XML namespace for annotation.
Definition: NUMLError.h:60
NUMLInvalidNotesContent
Invalid notes content.
Definition: NUMLError.h:75
LIBNUML_CAT_IDENTIFIER_CONSISTENCY
Category of errors that can occur while validating symbol identifiers in a numl objects.
Definition: NUMLError.h:169
NUMLInvalidMetaidSyntax
Invalid metaid value syntax.
Definition: NUMLError.h:57
NUMLUnrecognisedSBOTerm
Unrecognized sboTerm value.
Definition: NUMLError.h:120
NUMLEmptyListElement
A given listOf___, if present, cannot be empty.
Definition: NUMLError.h:82
NUMLInvalidConstraintSBOTerm
Invalid sboTerm value for constraint.
Definition: NUMLError.h:71
NUMLCannotConvertToL1V1
Cannot convert to NUML Level&#160;1 Version&#160;1.
Definition: NUMLError.h:100
NUMLObseleteSBOTerm
Obsolete sboTerm value.
Definition: NUMLError.h:121
NUMLGeneralWarningNotSpecified
Unknown error.
Definition: NUMLError.h:93
NUMLMissingOrInconsistentVersion
Missing or inconsistent value for version attribute.
Definition: NUMLError.h:78
NUMLConstraintNotInXHTMLNamespace
Constraint message is not in XHTML XML namespace.
Definition: NUMLError.h:86
NUMLOverdeterminedSystem
Model is overdetermined.
Definition: NUMLError.h:67
NUMLInconsistentArgUnits
Units of arguments to function call do not match function's definition.
Definition: NUMLError.h:65
NUMLInvalidRuleOrdering
Invalid ordering of rules.
Definition: NUMLError.h:114