Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

EvalContext Class Reference

#include <Expression.h>

List of all members.


Detailed Description

Context for use in evaluating an expression.

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.
EStringPoolgetPool () const
 Returns the string pool contained within this context.


Constructor & Destructor Documentation

EvalContext::EvalContext unsigned int  num_tuples = 1,
unsigned int  pool_size = EStringPool::DEFAULT_INITIAL_SIZE
 

Constructor.

Parameters:
num_tuples the number of tuples contained in the EvalContext
pool_size the initial size of the memory pool to use for string data


Member Function Documentation

char* EvalContext::alloc unsigned int  size  )  const
 

Allocates memory from the string pool.

This memory remains usable only until the context is reset.

EStringPool& EvalContext::getPool  )  const
 

Returns the string pool contained within this context.

const char* EvalContext::getTuple unsigned int  index = 0  )  const
 

Returns the input tuple.

void EvalContext::reset  ) 
 

Resets the evaluation context.

Should be called after every evaluation. This resets the memory pool and hence invalidates any memory allocated with alloc.

void EvalContext::setTuple unsigned int  index,
const void *  tuple
 

Sets an input tuple.

void EvalContext::setTuple const void *  tuple  ) 
 

Sets the input tuple.


The documentation for this class was generated from the following file:
Generated on Fri Nov 12 15:15:23 2004 for Borealis by doxygen 1.3.8