Go to the documentation of this file.
30 class VarBlockCreator;
44 d = std::move(other.d);
45 s = std::move(other.s);
57 double*&
Pointer(uint32_t variableOffset) {
return reinterpret_cast<double*&
>(
_dataPtrs[variableOffset]); }
58 char**&
CharPointer(uint32_t variableOffset) {
return reinterpret_cast<char**&
>(
_dataPtrs[variableOffset]); }
68 std::vector<double>
d;
96 void eval(
double*)
override { assert(
false); }
97 void eval(
const char**)
override { assert(
false); }
103 throw std::runtime_error(
"Already registered a variable named " + name);
107 _vars.insert(std::make_pair(name,
Ref(type, offset, type.
dim())));
128 if (
it !=
_vars.end())
return const_cast<Ref*
>(&
it->second);
Ref(const ExprType &type, uint32_t offset, uint32_t stride)
void eval(const char **) override
A thread local evaluation context. Just allocate and fill in with data.
A class that lets you register for the variables used by one or more expressions.
int registerVariable(const std::string &name, const ExprType type)
Register a variable and return a handle.
VarBlock(int size, bool makeThreadSafe)
Allocate an VarBlock.
std::vector< double > d
copy of Interpreter's double data
VarBlock create(bool makeThreadSafe=false)
std::map< std::string, Ref > _vars
void eval(double *) override
returns this variable's value by setting result
ExprVarRef * resolveVar(const std::string &name) const
Resolve the variable using anything in the data block (call from resolveVar in Expr subclass)
Internally implemented var ref used by SeExpr.
VarBlock & operator=(const VarBlock &)=delete
you may not use this file except in compliance with the License and the following modification to it
char **& CharPointer(uint32_t variableOffset)
int indirectIndex
indirect index to add to pointer based data
VarBlock(const VarBlock &)=delete
Don't allow copying and operator='ing'.
double *& Pointer(uint32_t variableOffset)
Get a reference to the data block pointer which can be modified.
bool threadSafe
if true, interpreter's data will be copied to this instance before evaluation.
VarBlock(VarBlock &&other)
Move semantics is the only allowed way to change the structure.
std::vector< char * > s
copy of Interpreter's str data
char ** data()
Raw data of the data block pointer (used by compiler)
abstract class for implementing variable references
virtual ExprType type() const
returns (current) type
std::vector< char * > _dataPtrs
This stores double* or char** ptrs to variables.