libSBML Perl API  libSBML 5.8.0 Perl API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StoichiometryMath.cpp File Reference

Detailed Description

Implementation of StoichiometryMath.

Author
Sarah Keating
Include dependency graph for StoichiometryMath.cpp:

Functions

StoichiometryMath_tStoichiometryMath_clone (const StoichiometryMath_t *stoichMath)
 
int StoichiometryMath_containsUndeclaredUnits (StoichiometryMath_t *stoichMath)
 Predicate returning true or false depending on whether the math expression of this StoichiometryMath contains parameters/numbers with undeclared units. More...
 
StoichiometryMath_tStoichiometryMath_create (unsigned int level, unsigned int version)
 Creates a new StoichiometryMath_t structure using the given SBML level and version values. More...
 
StoichiometryMath_tStoichiometryMath_createWithNS (SBMLNamespaces_t *sbmlns)
 Creates a new StoichiometryMath_t structure using the given SBMLNamespaces_t structure. More...
 
void StoichiometryMath_free (StoichiometryMath_t *stoichMath)
 Frees the given StoichiometryMath. More...
 
UnitDefinition_tStoichiometryMath_getDerivedUnitDefinition (StoichiometryMath_t *stoichMath)
 Calculates and returns a UnitDefinition that expresses the units returned by the math expression in this StoichiometryMath. More...
 
const ASTNode_tStoichiometryMath_getMath (const StoichiometryMath_t *stoichMath)
 
const XMLNamespaces_tStoichiometryMath_getNamespaces (StoichiometryMath_t *sm)
 Returns a list of XMLNamespaces_t associated with this StoichiometryMath_t structure. More...
 
int StoichiometryMath_isSetMath (const StoichiometryMath_t *stoichMath)
 
int StoichiometryMath_setMath (StoichiometryMath_t *stoichMath, const ASTNode_t *math)
 Sets the math of this StoichiometryMath to a copy of the given ASTNode. More...
 

Function Documentation

StoichiometryMath_t* StoichiometryMath_clone ( const StoichiometryMath_t stoichMath)
Returns
a (deep) copy of this StoichiometryMath.
int StoichiometryMath_containsUndeclaredUnits ( StoichiometryMath_t stoichMath)

Predicate returning true or false depending on whether the math expression of this StoichiometryMath contains parameters/numbers with undeclared units.

Parameters
stoichMaththe StoichiometryMath structure to check
Returns
true if the math expression of this StoichiometryMath includes parameters/numbers with undeclared units, false otherwise.
Note
A return value of true indicates that the UnitDefinition returned by getDerivedUnitDefinition() may not accurately represent the units of the expression.
See Also
StoichiometryMath_getDerivedUnitDefinition()
StoichiometryMath_t* StoichiometryMath_create ( unsigned int  level,
unsigned int  version 
)

Creates a new StoichiometryMath_t structure using the given SBML level and version values.

Parameters
levelan unsigned int, the SBML Level to assign to this StoichiometryMath
versionan unsigned int, the SBML Version to assign to this StoichiometryMath
Returns
a pointer to the newly created StoichiometryMath_t structure.
Note
Once a StoichiometryMath has been added to an SBMLDocument, the level and version for the document override those used to create the StoichiometryMath. Despite this, the ability to supply the values at creation time is an important aid to creating valid SBML. Knowledge of the intended SBML Level and Version determine whether it is valid to assign a particular value to an attribute, or whether it is valid to add an object to an existing SBMLDocument.
StoichiometryMath_t* StoichiometryMath_createWithNS ( SBMLNamespaces_t sbmlns)

Creates a new StoichiometryMath_t structure using the given SBMLNamespaces_t structure.

Parameters
sbmlnsSBMLNamespaces, a pointer to an SBMLNamespaces structure to assign to this StoichiometryMath
Returns
a pointer to the newly created StoichiometryMath_t structure.
Note
Once a StoichiometryMath has been added to an SBMLDocument, the sbmlns namespaces for the document override those used to create the StoichiometryMath. Despite this, the ability to supply the values at creation time is an important aid to creating valid SBML. Knowledge of the intended SBML Level and Version determine whether it is valid to assign a particular value to an attribute, or whether it is valid to add an object to an existing SBMLDocument.
void StoichiometryMath_free ( StoichiometryMath_t stoichMath)

Frees the given StoichiometryMath.

UnitDefinition_t* StoichiometryMath_getDerivedUnitDefinition ( StoichiometryMath_t stoichMath)

Calculates and returns a UnitDefinition that expresses the units returned by the math expression in this StoichiometryMath.

Parameters
stoichMaththe StoichiometryMath structure to check
Returns
A UnitDefinition that expresses the units of the math

The units are calculated based on the mathematical expression in the StoichiometryMath and the model quantities referenced by <ci> elements used within that expression. The getDerivedUnitDefinition() method returns the calculated units.

Warning
Note that it is possible the "math" expression in the StoichiometryMath contains pure numbers or parameters with undeclared units. In those cases, it is not possible to calculate the units of the overall expression without making assumptions. LibSBML does not make assumptions about the units, and getDerivedUnitDefinition() only returns the units as far as it is able to determine them. For example, in an expression X + Y, if X has unambiguously-defined units and Y does not, it will return the units of X. It is important that callers also invoke the method containsUndeclaredUnits() to determine whether this situation holds. Callers may wish to take suitable actions in those scenarios.
See Also
containsUndeclaredUnits()
const ASTNode_t* StoichiometryMath_getMath ( const StoichiometryMath_t stoichMath)
Returns
the stoichMath of this StoichiometryMath.
const XMLNamespaces_t* StoichiometryMath_getNamespaces ( StoichiometryMath_t sm)

Returns a list of XMLNamespaces_t associated with this StoichiometryMath_t structure.

Parameters
smthe StoichiometryMath_t structure
Returns
pointer to the XMLNamespaces_t structure associated with this SBML object
int StoichiometryMath_isSetMath ( const StoichiometryMath_t stoichMath)
Returns
true (non-zero) if the stoichMath (or equivalently the formula) of this StoichiometryMath is set, false (0) otherwise.
int StoichiometryMath_setMath ( StoichiometryMath_t stoichMath,
const ASTNode_t math 
)

Sets the math of this StoichiometryMath to a copy of the given ASTNode.

Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
  • LIBSBML_OPERATION_SUCCESS
  • LIBSBML_INVALID_OBJECT