Go to the documentation of this file.
26 #include "ExprConfig.h"
32 class ExecutionEngine;
64 virtual void eval(
double* result) = 0;
65 virtual void eval(
const char** resultStr) = 0;
101 Error(
const std::string& errorIn,
const int startPosIn,
const int endPosIn)
119 void setExpr(
const std::string& e);
155 bool usesVar(
const std::string& name)
const;
159 bool usesFunc(
const std::string& name)
const;
185 void evalMultiple(
VarBlock* varBlock,
int outputVarBlockOffset,
size_t rangeStart,
size_t rangeEnd)
const;
205 void addError(
const std::string& error,
const int startPos,
const int endPos)
const {
294 mutable std::set<std::string>
_vars;
int startPos
Error start offset in expression string.
void debugPrintInterpreter() const
bool usesVar(const std::string &name) const
static bool debugging
Whether to debug expressions.
const Context & context() const
std::vector< std::string > _threadUnsafeFunctionCalls
const std::string & parseError() const
const std::vector< Error > & getErrors() const
std::string error
Text of error.
void parseIfNeeded() const
void setVarBlockCreator(const VarBlockCreator *varBlockCreator)
A thread local evaluation context. Just allocate and fill in with data.
void evalMultiple(VarBlock *varBlock, int outputVarBlockOffset, size_t rangeStart, size_t rangeEnd) const
Evaluate multiple blocks.
const VarBlockCreator * varBlockCreator() const
virtual ExprFunc * resolveFunc(const std::string &name) const
const std::vector< std::string > & getThreadUnsafeFunctionCalls() const
A class that lets you register for the variables used by one or more expressions.
std::vector< std::pair< int, int > > _comments
static Context & global()
The global default context of the seexpr.
const std::vector< std::pair< int, int > > & getComments() const
const char * evalStr(VarBlock *varBlock=nullptr) const
void setExpr(const std::string &e)
std::set< std::string > _vars
virtual void setType(const ExprType &type)
sets (current) type to given type
void debugPrintParseTree() const
void addFunc(const char *n) const
add function evaluation (this is for internal use)
ExprType _desiredReturnType
double length(const Vec3d &v)
Function Definition, used in parse tree and func table.
void setThreadUnsafe(const std::string &functionName) const
void prepIfNeeded() const
Expression(EvaluationStrategy be=Expression::defaultEvaluationStrategy)
bool isThreadSafe() const
std::vector< Error > _errors
EvaluationStrategy _evaluationStrategy
std::set< std::string > _funcs
void setContext(const Context &context)
const std::string & getExpr() const
Get the string that this expression is currently set to evaluate.
Variable scope builder is used by the type checking and code gen to track visiblity of variables and ...
Error(const std::string &errorIn, const int startPosIn, const int endPosIn)
< b ></b >< br >< b ></b ></td >< td > vector constructor< br > vector component access n must be
virtual ExprVarRef * resolveVar(const std::string &name) const
virtual void eval(double *result)=0
returns this variable's value by setting result
const ExprType & returnType() const
ExprVarEnvBuilder _envBuilder
Interpreter * _interpreter
void setDesiredReturnType(const ExprType &type)
EvaluationStrategy
Types of evaluation strategies that are available.
static EvaluationStrategy defaultEvaluationStrategy
What evaluation strategy to use by default.
void addComment(int pos, int length)
int endPos
Error end offset in expression string.
LLVMEvaluator * _llvmEvaluator
Expression & operator=(const Expression &e)
const double * evalFP(VarBlock *varBlock=nullptr) const
void addError(const std::string &error, const int startPos, const int endPos) const
abstract class for implementing variable references
const VarBlockCreator * _varBlockCreator
virtual ExprType type() const
returns (current) type
void addVar(const char *n) const
add local variable (this is for internal use)
Represents a parse or type checking error in an expression.
void debugPrintLLVM() const
bool usesFunc(const std::string &name) const
ExprVarRef(const ExprType &type)