libSBML C++ API  libSBML 5.8.0 C++ API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ASTNode.h File Reference

Detailed Description

Abstract Syntax Tree (AST) for representing formula trees.

Author
Ben Bornstein
Include dependency graph for ASTNode.h:
This graph shows which files directly or indirectly include this file:

Classes

class  ASTNode
 Abstract Syntax Tree (AST) representation of a mathematical expression. More...
 

Typedefs

typedef int(* ASTNodePredicate )(const ASTNode_t *node)
 A pointer to a function that takes an ASTNode and returns true (non-zero) or false (0). More...
 

Enumerations

enum  ASTNodeType_t {
  AST_PLUS = 43,
  AST_MINUS = 45,
  AST_TIMES = 42,
  AST_DIVIDE = 47,
  AST_POWER = 94,
  AST_INTEGER = 256,
  AST_REAL,
  AST_REAL_E,
  AST_RATIONAL,
  AST_NAME,
  AST_NAME_AVOGADRO,
  AST_NAME_TIME,
  AST_CONSTANT_E,
  AST_CONSTANT_FALSE,
  AST_CONSTANT_PI,
  AST_CONSTANT_TRUE,
  AST_LAMBDA,
  AST_FUNCTION,
  AST_FUNCTION_ABS,
  AST_FUNCTION_ARCCOS,
  AST_FUNCTION_ARCCOSH,
  AST_FUNCTION_ARCCOT,
  AST_FUNCTION_ARCCOTH,
  AST_FUNCTION_ARCCSC,
  AST_FUNCTION_ARCCSCH,
  AST_FUNCTION_ARCSEC,
  AST_FUNCTION_ARCSECH,
  AST_FUNCTION_ARCSIN,
  AST_FUNCTION_ARCSINH,
  AST_FUNCTION_ARCTAN,
  AST_FUNCTION_ARCTANH,
  AST_FUNCTION_CEILING,
  AST_FUNCTION_COS,
  AST_FUNCTION_COSH,
  AST_FUNCTION_COT,
  AST_FUNCTION_COTH,
  AST_FUNCTION_CSC,
  AST_FUNCTION_CSCH,
  AST_FUNCTION_DELAY,
  AST_FUNCTION_EXP,
  AST_FUNCTION_FACTORIAL,
  AST_FUNCTION_FLOOR,
  AST_FUNCTION_LN,
  AST_FUNCTION_LOG,
  AST_FUNCTION_PIECEWISE,
  AST_FUNCTION_POWER,
  AST_FUNCTION_ROOT,
  AST_FUNCTION_SEC,
  AST_FUNCTION_SECH,
  AST_FUNCTION_SIN,
  AST_FUNCTION_SINH,
  AST_FUNCTION_TAN,
  AST_FUNCTION_TANH,
  AST_LOGICAL_AND,
  AST_LOGICAL_NOT,
  AST_LOGICAL_OR,
  AST_LOGICAL_XOR,
  AST_RELATIONAL_EQ,
  AST_RELATIONAL_GEQ,
  AST_RELATIONAL_GT,
  AST_RELATIONAL_LEQ,
  AST_RELATIONAL_LT,
  AST_RELATIONAL_NEQ,
  AST_UNKNOWN
}
 ASTNodeType_t is the enumeration of possible ASTNode types. More...
 

Typedef Documentation

typedef int(* ASTNodePredicate)(const ASTNode_t *node)

A pointer to a function that takes an ASTNode and returns true (non-zero) or false (0).

See Also
ASTNode_getListOfNodes()
ASTNode_fillListOfNodes()

Enumeration Type Documentation

ASTNodeType_t is the enumeration of possible ASTNode types.

Each ASTNode has a type whose value is one of the elements of this enumeration. The types have the following meanings:

  • If the node is basic mathematical operator (e.g., "+"), then the node's type will be AST_PLUS, AST_MINUS, AST_TIMES, AST_DIVIDE, or AST_POWER, as appropriate.

  • If the node is a predefined function or operator from SBML Level 1 (in the string-based formula syntax used in Level 1) or SBML Level 2 and 3 (in the subset of MathML used in SBML Levels 2 and 3), then the node's type will be either AST_FUNCTION_ X, AST_LOGICAL_ X, or AST_RELATIONAL_ X, as appropriate. (Examples: AST_FUNCTION_LOG, AST_RELATIONAL_LEQ.)

  • If the node refers to a user-defined function, the node's type will be AST_FUNCTION (because it holds the name of the function).

  • If the node is a lambda expression, its type will be AST_LAMBDA.

  • If the node is a predefined constant ("ExponentialE", "Pi", "True" or "False"), then the node's type will be AST_CONSTANT_E, AST_CONSTANT_PI, AST_CONSTANT_TRUE, or AST_CONSTANT_FALSE.

  • (Levels 2 and 3 only) If the node is the special MathML csymbol time, the value of the node will be AST_NAME_TIME. (Note, however, that the MathML csymbol delay is translated into a node of type AST_FUNCTION_DELAY. The difference is due to the fact that time is a single variable, whereas delay is actually a function taking arguments.)

  • (Level 3 only) If the node is the special MathML csymbol avogadro, the value of the node will be AST_NAME_AVOGADRO.

  • If the node contains a numerical value, its type will be AST_INTEGER, AST_REAL, AST_REAL_E, or AST_RATIONAL, as appropriate.
See Also
ASTNode::getType()
ASTNode::canonicalize()
Enumerator
AST_PLUS 
AST_MINUS 
AST_TIMES 
AST_DIVIDE 
AST_POWER 
AST_INTEGER 
AST_REAL 
AST_REAL_E 
AST_RATIONAL 
AST_NAME 
AST_NAME_AVOGADRO 
AST_NAME_TIME 
AST_CONSTANT_E 
AST_CONSTANT_FALSE 
AST_CONSTANT_PI 
AST_CONSTANT_TRUE 
AST_LAMBDA 
AST_FUNCTION 
AST_FUNCTION_ABS 
AST_FUNCTION_ARCCOS 
AST_FUNCTION_ARCCOSH 
AST_FUNCTION_ARCCOT 
AST_FUNCTION_ARCCOTH 
AST_FUNCTION_ARCCSC 
AST_FUNCTION_ARCCSCH 
AST_FUNCTION_ARCSEC 
AST_FUNCTION_ARCSECH 
AST_FUNCTION_ARCSIN 
AST_FUNCTION_ARCSINH 
AST_FUNCTION_ARCTAN 
AST_FUNCTION_ARCTANH 
AST_FUNCTION_CEILING 
AST_FUNCTION_COS 
AST_FUNCTION_COSH 
AST_FUNCTION_COT 
AST_FUNCTION_COTH 
AST_FUNCTION_CSC 
AST_FUNCTION_CSCH 
AST_FUNCTION_DELAY 
AST_FUNCTION_EXP 
AST_FUNCTION_FACTORIAL 
AST_FUNCTION_FLOOR 
AST_FUNCTION_LN 
AST_FUNCTION_LOG 
AST_FUNCTION_PIECEWISE 
AST_FUNCTION_POWER 
AST_FUNCTION_ROOT 
AST_FUNCTION_SEC 
AST_FUNCTION_SECH 
AST_FUNCTION_SIN 
AST_FUNCTION_SINH 
AST_FUNCTION_TAN 
AST_FUNCTION_TANH 
AST_LOGICAL_AND 
AST_LOGICAL_NOT 
AST_LOGICAL_OR 
AST_LOGICAL_XOR 
AST_RELATIONAL_EQ 
AST_RELATIONAL_GEQ 
AST_RELATIONAL_GT 
AST_RELATIONAL_LEQ 
AST_RELATIONAL_LT 
AST_RELATIONAL_NEQ 
AST_UNKNOWN