32 class VarBlockCreator;
53 double*&
Pointer(uint32_t variableOffset) {
return reinterpret_cast<double*&
>(
_dataPtrs[variableOffset]); }
54 char**&
CharPointer(uint32_t variableOffset) {
return reinterpret_cast<char**&
>(
_dataPtrs[variableOffset]); }
83 void eval(
double*)
override { assert(
false); }
84 void eval(
const char**)
override { assert(
false); }
90 throw std::runtime_error(
"Already registered a variable named " + name);
94 _vars.insert(std::make_pair(name,
Ref(type, offset, type.
dim())));
105 if (
it !=
_vars.end())
return const_cast<Ref*>(&
it->second);
A thread local evaluation context. Just allocate and fill in with data.
VarBlock & operator=(const VarBlock &)=delete
int registerVariable(const std::string &name, const ExprType type)
Register a variable and return a handle.
char ** data()
Raw data of the data block pointer (used by compiler)
double *& Pointer(uint32_t variableOffset)
Get a reference to the data block pointer which can be modified.
ExprVarRef * resolveVar(const std::string &name) const
Resolve the variable using anything in the data block (call from resolveVar in Expr subclass) ...
VarBlock(VarBlock &&other)
Move semantics is the only allowed way to change the structure.
std::vector< char * > _dataPtrs
This stores double* or char** ptrs.
Ref(const ExprType &type, uint32_t offset, uint32_t stride)
std::map< std::string, Ref > _vars
A class that lets you register for the variables used by one or more expressions. ...
Internally implemented var ref used by SeExpr.
VarBlock(int size)
Allocate an VarBlock.
int indirectIndex
indirect index to add to pointer based data
void eval(double *) override
returns this variable's value by setting result
virtual ExprType type() const
returns (current) type
void eval(const char **) override
you may not use this file except in compliance with the License and the following modification to it
char **& CharPointer(uint32_t variableOffset)
abstract class for implementing variable references
VarBlock create()
Get an evaluation handle (one needed per thread)