#include <Expression.h>
Before evaluating an expression, create an EvalContext to describe the actual evaluation environment.
Currently, the only property of an EvalContext is a single input tuple (which must match the TupleDescription in the ExprContext specified when the expression was originally parsed).
Note that creating an EvalContext is (by design) expensive since an EvalContext contains an EStringPool; create only one EvalContext for many evaluation and use reset() to clear the context each time.
Public Member Functions | |
EvalContext (unsigned int num_tuples=1, unsigned int pool_size=EStringPool::DEFAULT_INITIAL_SIZE) | |
Constructor. | |
void | reset () |
Resets the evaluation context. | |
void | setTuple (const void *tuple) |
Sets the input tuple. | |
void | setTuple (unsigned int index, const void *tuple) |
Sets an input tuple. | |
const char * | getTuple (unsigned int index=0) const |
Returns the input tuple. | |
char * | alloc (unsigned int size) const |
Allocates memory from the string pool. | |
EStringPool & | getPool () const |
Returns the string pool contained within this context. |
|
Constructor.
|
|
Allocates memory from the string pool. This memory remains usable only until the context is reset. |
|
Returns the string pool contained within this context.
|
|
Returns the input tuple.
|
|
Resets the evaluation context. Should be called after every evaluation. This resets the memory pool and hence invalidates any memory allocated with alloc. |
|
Sets an input tuple.
|
|
Sets the input tuple.
|