25 : Expression(
expr, type), dummyFunc(dummyFuncX, 0, 16) {}
31 for (
typename T_MAP::iterator i =
map.begin(); i !=
map.end(); ++i)
delete i->second;
42 Expression::setExpr(str);
54 VARMAP::iterator i =
varmap.find(name);
void deleteAndClear(T_MAP &map)
SeExpr2::ExprFunc dummyFunc
SeExpr2::ExprFunc * resolveFunc(const std::string &name) const
virtual ~BasicExpression()
SeExpr2::ExprVarRef * resolveVar(const std::string &name) const
BasicExpression(const std::string &expr, const SeExpr2::ExprType &type=SeExpr2::ExprType().FP(3))
void setExpr(const std::string &str)
Function Definition, used in parse tree and func table.
static const ExprFunc * lookup(const std::string &name)
Lookup a builtin function by name.
abstract class for implementing variable references
</pre >< h3 > Binding our variable reference</h3 > If we now tried to use the variable would still not be found by our expressions To make it bindable we need to override the resolveVar() function as follows</pre >< h3 > Variable setting</h3 > Next we need to make a way of setting the variable As the controlling code will use the expression it will repeatedly alternate between setting the independent variables that are used and calling evaluate(). What it has to do depends very much on the application. In this case we only need to set the independent variable x as</pre >< h2 > Evaluating expressions</h2 > Evaluating an expression is pretty easy But before we can do that we need to make an instance< pre > GrapherExpr expr("x+x^2")