libSBML C API
5.18.0
|
The FunctionDefinition_t structure associates an identifier with a function definition. This identifier can then be used as the function called in subsequent MathML content elsewhere in an SBML model.
FunctionDefinition_t has one required attribute, "id", to give the function a unique identifier by which other parts of an SBML model definition can refer to it. A FunctionDefinition_t instance can also have an optional "name" attribute of type string
. Identifiers and names must be used according to the guidelines described in the SBML specification (e.g., Section 3.3 in the Level 2 Version 4 specification).
FunctionDefinition_t has a "math" subelement containing a MathML expression defining the function body. In SBML Level 2 and SBML Level 3 Version 1, that "math" subelement is required; in SBML Level 3 Version 2, this restriction was relaxed, making the "math" subelement optional. The content of this element can only be a MathML "lambda" element. The "lambda" element must begin with zero or more "bvar" elements, followed by any other of the elements in the MathML subset allowed in SBML Level 2 except "lambda" (i.e., a "lambda" element cannot contain another "lambda" element). This is the only place in SBML where a "lambda" element can be used. The function defined by a FunctionDefinition_t is only available for use in other MathML elements that follow the FunctionDefinition_t definition in the model. (These restrictions prevent recursive and mutually-recursive functions from being expressed.)
A further restriction on the content of "math" is that it cannot contain references to variables other than the variables declared to the "lambda" itself. That is, the contents of MathML "ci" elements inside the body of the "lambda" can only be the variables declared by its "bvar" elements, or the identifiers of other FunctionDefinition_t instances in the model. This means must be written so that all variables or parameters used in the MathML content are passed to them via their function parameters. In SBML Level 2, this restriction applies also to the MathML csymbol
elements for time and delay; in SBML Level 3, it additionally applies to the csymbol
element for avogadro.
In SBML Level 3 Version 2, if no math element is present in the FunctionDefinition_t, the function has no mathematical meaning defined in SBML Level 3 Core. This situation may arise when models are incomplete, or when additional meanings are provided by an SBML Level 3 package.
Public Member Functions | |
FunctionDefinition_t * | FunctionDefinition_clone (const FunctionDefinition_t *fd) |
Creates a deep copy of the given FunctionDefinition_t structure. More... | |
FunctionDefinition_t * | FunctionDefinition_create (unsigned int level, unsigned int version) |
Creates a new FunctionDefinition_t structure using the given SBML level and version values. More... | |
FunctionDefinition_t * | FunctionDefinition_createWithNS (SBMLNamespaces_t *sbmlns) |
Creates a new FunctionDefinition_t structure using the given SBMLNamespaces_t structure. More... | |
void | FunctionDefinition_free (FunctionDefinition_t *fd) |
Frees the given FunctionDefinition_t. More... | |
const ASTNode_t * | FunctionDefinition_getArgument (const FunctionDefinition_t *fd, unsigned int n) |
Get the nth argument (bound variable) to the given FunctionDefinition_t structure. More... | |
const ASTNode_t * | FunctionDefinition_getArgumentByName (FunctionDefinition_t *fd, const char *name) |
Get the argument named name to the given FunctionDefinition_t structure. More... | |
const ASTNode_t * | FunctionDefinition_getBody (const FunctionDefinition_t *fd) |
Get the mathematical expression that constitutes the body of the given function definition. More... | |
const char * | FunctionDefinition_getId (const FunctionDefinition_t *fd) |
Get the identifier of the given FunctionDefinition_t structure. More... | |
const ASTNode_t * | FunctionDefinition_getMath (const FunctionDefinition_t *fd) |
Get the mathematical formula implemented by the given function. More... | |
const char * | FunctionDefinition_getName (const FunctionDefinition_t *fd) |
Get the name of the given FunctionDefinition_t structure. More... | |
const XMLNamespaces_t * | FunctionDefinition_getNamespaces (FunctionDefinition_t *fd) |
Returns a list of XMLNamespaces_t associated with this FunctionDefinition_t structure. More... | |
unsigned int | FunctionDefinition_getNumArguments (const FunctionDefinition_t *fd) |
Get the number of arguments that the given function definition takes. More... | |
int | FunctionDefinition_isSetBody (const FunctionDefinition_t *fd) |
Predicate returning 1 (true) or 0 (false) depending on whether the given FunctionDefinition_t structure's "math" subelement has a body. More... | |
int | FunctionDefinition_isSetId (const FunctionDefinition_t *fd) |
Predicate returning 1 (true) or 0 (false) depending on whether the given FunctionDefinition_t structure's "id" attribute is set. More... | |
int | FunctionDefinition_isSetMath (const FunctionDefinition_t *fd) |
Predicate returning 1 (true) or 0 (false) depending on whether the given FunctionDefinition_t structure's "math" subelement is set. More... | |
int | FunctionDefinition_isSetName (const FunctionDefinition_t *fd) |
Predicate returning 1 (true) or 0 (false) depending on whether the given FunctionDefinition_t structure's "name" attribute is set. More... | |
int | FunctionDefinition_setId (FunctionDefinition_t *fd, const char *sid) |
Sets the value of the "id" attribute of a FunctionDefinition_t structure. More... | |
int | FunctionDefinition_setMath (FunctionDefinition_t *fd, const ASTNode_t *math) |
Sets the "math" subelement of a given FunctionDefinition_t structure. More... | |
int | FunctionDefinition_setName (FunctionDefinition_t *fd, const char *name) |
Sets the value of the "name" attribute of a FunctionDefinition_t structure. More... | |
int | FunctionDefinition_unsetName (FunctionDefinition_t *fd) |
Unsets the "name" attribute of the given FunctionDefinition_t structure. More... | |
FunctionDefinition_t * FunctionDefinition_clone | ( | const FunctionDefinition_t * | fd | ) |
Creates a deep copy of the given FunctionDefinition_t structure.
fd | the FunctionDefinition_t structure to be copied. |
FunctionDefinition_t * FunctionDefinition_create | ( | unsigned int | level, |
unsigned int | version | ||
) |
Creates a new FunctionDefinition_t structure using the given SBML level
and version
values.
level | an unsigned int, the SBML Level to assign to this FunctionDefinition_t. |
version | an unsigned int, the SBML Version to assign to this FunctionDefinition_t. |
FunctionDefinition_t * FunctionDefinition_createWithNS | ( | SBMLNamespaces_t * | sbmlns | ) |
Creates a new FunctionDefinition_t structure using the given SBMLNamespaces_t structure.
sbmlns | SBMLNamespaces_t, a pointer to an SBMLNamespaces_t structure to assign to this FunctionDefinition_t. |
void FunctionDefinition_free | ( | FunctionDefinition_t * | fd | ) |
Frees the given FunctionDefinition_t.
fd | the FunctionDefinition_t structure. |
const ASTNode_t * FunctionDefinition_getArgument | ( | const FunctionDefinition_t * | fd, |
unsigned int | n | ||
) |
Get the nth argument (bound variable) to the given FunctionDefinition_t structure.
fd | the FunctionDefinition_t structure. |
n | the index of the argument to return. |
const ASTNode_t * FunctionDefinition_getArgumentByName | ( | FunctionDefinition_t * | fd, |
const char * | name | ||
) |
Get the argument named name
to the given FunctionDefinition_t structure.
fd | the FunctionDefinition_t structure. |
name | the exact name (case-sensitive) of the sought-after argument. |
const ASTNode_t * FunctionDefinition_getBody | ( | const FunctionDefinition_t * | fd | ) |
Get the mathematical expression that constitutes the body of the given function definition.
fd | the FunctionDefinition_t structure. |
const char * FunctionDefinition_getId | ( | const FunctionDefinition_t * | fd | ) |
Get the identifier of the given FunctionDefinition_t structure.
fd | the FunctionDefinition_t structure. |
const ASTNode_t * FunctionDefinition_getMath | ( | const FunctionDefinition_t * | fd | ) |
Get the mathematical formula implemented by the given function.
fd | the FunctionDefinition_t structure. |
const char * FunctionDefinition_getName | ( | const FunctionDefinition_t * | fd | ) |
Get the name of the given FunctionDefinition_t structure.
fd | the FunctionDefinition_t structure. |
const XMLNamespaces_t * FunctionDefinition_getNamespaces | ( | FunctionDefinition_t * | fd | ) |
Returns a list of XMLNamespaces_t associated with this FunctionDefinition_t structure.
fd | the FunctionDefinition_t structure. |
unsigned int FunctionDefinition_getNumArguments | ( | const FunctionDefinition_t * | fd | ) |
Get the number of arguments that the given function definition takes.
fd | the FunctionDefinition_t structure. |
int FunctionDefinition_isSetBody | ( | const FunctionDefinition_t * | fd | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given FunctionDefinition_t structure's "math" subelement has a body.
fd | the FunctionDefinition_t structure. |
1
(true) if the body of this FunctionDefinition_t is set, 0
(false) otherwise. int FunctionDefinition_isSetId | ( | const FunctionDefinition_t * | fd | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given FunctionDefinition_t structure's "id" attribute is set.
fd | the FunctionDefinition_t structure. |
1
(true) if the "id" attribute of the FunctionDefinition_t structure is set, 0
(false) otherwise. int FunctionDefinition_isSetMath | ( | const FunctionDefinition_t * | fd | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given FunctionDefinition_t structure's "math" subelement is set.
fd | the FunctionDefinition_t structure. |
1
(true) if the mathematical expression of this FunctionDefinition_t is set, 0
(false) otherwise. int FunctionDefinition_isSetName | ( | const FunctionDefinition_t * | fd | ) |
Predicate returning 1
(true) or 0
(false) depending on whether the given FunctionDefinition_t structure's "name" attribute is set.
fd | the FunctionDefinition_t structure. |
1
(true) if the "name" attribute of the FunctionDefinition_t structure is set, 0
(false) otherwise. int FunctionDefinition_setId | ( | FunctionDefinition_t * | fd, |
const char * | sid | ||
) |
Sets the value of the "id" attribute of a FunctionDefinition_t structure.
fd | the FunctionDefinition_t structure to set. |
sid | the identifier to assign to the "id" attribute of fd . |
sid
of NULL is equivalent to unsetting the "id" attribute. int FunctionDefinition_setMath | ( | FunctionDefinition_t * | fd, |
const ASTNode_t * | math | ||
) |
Sets the "math" subelement of a given FunctionDefinition_t structure.
The ASTNode_t structure given in math
is copied.
fd | the FunctionDefinition_t structure to set. |
math | the ASTNode_t structure to copy and assign to the "math" subelement of the given FunctionDefinition_t structure. |
int FunctionDefinition_setName | ( | FunctionDefinition_t * | fd, |
const char * | name | ||
) |
Sets the value of the "name" attribute of a FunctionDefinition_t structure.
fd | the FunctionDefinition_t structure to set. |
name | the identifier to assign to the "name" attribute of fd . |
int FunctionDefinition_unsetName | ( | FunctionDefinition_t * | fd | ) |
Unsets the "name" attribute of the given FunctionDefinition_t structure.
fd | the FunctionDefinition_t structure. |