22 #ifndef BasicExpression_h
23 #define BasicExpression_h
26 #include <SeExpr2/Expression.h>
27 #include <SeExpr2/ExprFunc.h>
28 #include <SeExpr2/ExprNode.h>
37 void eval(
const char** result){assert(
false);}
44 for(
int k=0;k<3;k++) result[k]=
value[k];
46 void eval(
const char** result){assert(
false);};
58 for(
int i=0; i<nargs; i++)
68 double* out = &args.
outFp;
69 for(
int i=0; i<3; i++) out[i] = 0.0;
78 typedef std::map<std::string,VectorRef*>
VARMAP;
80 typedef std::map<std::string,bool>
FUNCMAP;
89 void setExpr(
const std::string& str);
virtual void eval(ArgHandle args)
ExprType & Varying()
Mutate this into a varying lifetime.
virtual SeExpr2::ExprType prep(SeExpr2::ExprFuncNode *node, bool scalarWanted, SeExpr2::ExprVarEnvBuilder &envBuilder) const
</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")
std::map< std::string, VectorRef * > VARMAP
Function Definition, used in parse tree and func table.
SeExpr2::ExprVarRef * resolveVar(const std::string &name) const
void eval(const char **result)
std::map< std::string, bool > FUNCMAP
Node that calls a function.
ExprFuncSimple(const bool threadSafe)
void eval(double *result)
returns this variable's value by setting result
void eval(const char **result)
bool checkArg(int argIndex, ExprType type, ExprVarEnvBuilder &envBuilder)
void eval(double *result)
returns this variable's value by setting result
ExprType & Constant()
Mutate this into a constant lifetime.
base class for custom instance data
int numChildren() const
Number of children.
void setExpr(const std::string &str)
virtual SeExpr2::ExprFuncNode::Data * evalConstant(const SeExpr2::ExprFuncNode *node, ArgHandle args) const
BasicExpression::DummyFuncX dummyFuncX
virtual ~BasicExpression()
ExprType & FP(int d)
Mutate this into a floating point type of dimension d.
SeExpr2::ExprFunc * resolveFunc(const std::string &name) const
abstract class for implementing variable references
SeExpr2::ExprFunc dummyFunc
ExprType & Error()
Mutate this into an error type.
BasicExpression(const std::string &expr, const SeExpr2::ExprType &type=SeExpr2::ExprType().FP(3))
Variable scope builder is used by the type checking and code gen to track visiblity of variables and ...