In file evalfunc.hpp: Numerical expression parser.
Documentation
Numerical expression parser.
The expression is stored in reverse Polnish notation.
The evaluatino tree can be filled form an external parser,
see Addxxx methods.
Public Methods
-
EvalFunction()
-
EvalFunction(istream & aist)
- parse from input stream
-
virtual ~EvalFunction()
-
void Parse(istream & aist)
- parse from stream
-
void DefineConstant(const char* name, double val)
- define constant
-
double Eval(const double* x) const
- evaluate function
-
void Eval(const double* x, double* y, int ydim) const
- evaluate multi-value function
-
bool IsConstant() const
- is expression a constant ?
-
void AddConstant(double val)
- push constant on stack.
-
void AddVariable(int varnum)
- push variable x[varnum-1].
-
void AddGlobVariable(const double* dp)
- push pointer to global double value.
-
void AddOperation(EVAL_TOKEN op)
- push operation.
-
void AddFunction(double (*fun) (double))
- push functino call.
-
void Print(ostream & ost) const
- print expression
Protected Fields
-
ARRAY<step> program
- the evaluation sequence
-
istream* ist
- parse from stream
-
EVAL_TOKEN token
-
double num_value
-
char string_value[1000]
-
char var_num
-
static SymbolTable<TFUNP> functions
- registerd functions
-
SymbolTable<double> constants
- registerd constants
Protected Methods
-
void ParseExpression()
- parsing expression (standard parsing grammer)
-
void ParseTerm()
- parsing expression (standard parsing grammer)
-
void ParsePrimary()
- parsing expression (standard parsing grammer)
-
typedef double (*TFUNP)(double)
-
EVAL_TOKEN GetToken() const
- returns last token
-
double GetNumValue() const
- returns num_value of last token
-
int GetVariableNumber() const
- returns variable number of last token
-
const char* GetStringValue() const
- returns identifier of last token
-
void ReadNext()
- read next token
Protected Members
-
class step
- one step of evaluation
Private Members
-
enum EVAL_TOKEN
- enum EVAL_TOKEN
- EvalFunction()
- EvalFunction(istream & aist)
- parse from input stream
- virtual ~EvalFunction()
- void Parse(istream & aist)
- parse from stream
- void DefineConstant(const char* name, double val)
- define constant
- double Eval(const double* x) const
- evaluate function
- void Eval(const double* x, double* y, int ydim) const
- evaluate multi-value function
- bool IsConstant() const
- is expression a constant ?
- void AddConstant(double val)
- push constant on stack. Used for external parser.
- void AddVariable(int varnum)
- push variable x[varnum-1]. Used for external parser.
- void AddGlobVariable(const double* dp)
- push pointer to global double value. Used for external parser.
- void AddOperation(EVAL_TOKEN op)
- push operation. Used for external parser.
- void AddFunction(double (*fun) (double))
- push functino call. Used for external parser.
- void Print(ostream & ost) const
- print expression
- ARRAY<step> program
- the evaluation sequence
- void ParseExpression()
- parsing expression (standard parsing grammer)
- void ParseTerm()
- parsing expression (standard parsing grammer)
- void ParsePrimary()
- parsing expression (standard parsing grammer)
- istream* ist
- parse from stream
- EVAL_TOKEN token
- double num_value
- char string_value[1000]
- char var_num
- typedef double (*TFUNP)(double)
- static SymbolTable<TFUNP> functions
- registerd functions
- SymbolTable<double> constants
- registerd constants
- EVAL_TOKEN GetToken() const
- returns last token
- double GetNumValue() const
- returns num_value of last token
- int GetVariableNumber() const
- returns variable number of last token
- const char* GetStringValue() const
- returns identifier of last token
- void ReadNext()
- read next token
- This class has no child classes.
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.