A barrel to hold a list of variables. More...
#include <qExpr.h>
Public Member Functions | |
barrel () | |
Constructor. | |
barrel (const term *const t) | |
Constructor. | |
bool | equivalent (const barrel &rhs) const |
Is the given barrel of variables equivalent to this one? More... | |
const char * | name (uint32_t i) const |
void | recordVariable (const qExpr *const t) |
Record the variable names appear in the query expression. More... | |
void | recordVariable (const term *const t) |
Record the variable names appear in the term . More... | |
uint32_t | recordVariable (const char *name) |
Record the specified name. More... | |
uint32_t | size () const |
const double & | value (uint32_t i) const |
double & | value (uint32_t i) |
virtual | ~barrel () |
Destructor. Member variables clean themselves. | |
Protected Types | |
typedef std::map< const char *, uint32_t, ibis::lessi > | termMap |
Protected Member Functions | |
double | getValue (uint32_t i) const |
double | getValue (const char *nm) const |
Return the value of the named variable. | |
Protected Attributes | |
std::vector< const char * > | namelist |
List of variable names. | |
termMap | varmap |
Associate a variable name with a position in varvalues and namelist . More... | |
std::vector< double > | varvalues |
Cast values to double. | |
Friends | |
class | variable |
A barrel to hold a list of variables.
It defines an interface for evaluating arbitrary arithmetic expressions. It is also a dummy implementation that assigns all variables to have value 0.
bool ibis::math::barrel::equivalent | ( | const barrel & | rhs | ) | const |
Is the given barrel
of variables equivalent to this one?
Return true if the two barrels
contain the same set of variables, otherwise false.
References varmap.
Referenced by ibis::query::processJoin().
void ibis::math::barrel::recordVariable | ( | const qExpr *const | t | ) |
Record the variable names appear in the query expression.
It records all variables in the expression recursively.
References ibis::qExpr::getLeft(), ibis::qExpr::getRight(), and ibis::qExpr::getType().
Referenced by barrel(), ibis::part::calculate(), ibis::quaere::create(), ibis::part::doScan(), ibis::part::evaluateJoin(), ibis::selectClause::isUnivariate(), ibis::query::processJoin(), ibis::jNatural::select(), and ibis::jRange::select().
void ibis::math::barrel::recordVariable | ( | const term *const | t | ) |
Record the variable names appear in the term
.
It records all variables in the math term recursively.
References ibis::qExpr::getLeft(), and ibis::qExpr::getRight().
uint32_t ibis::math::barrel::recordVariable | ( | const char * | name | ) |
Record the specified name.
Return the number that is to be used in later functions for retrieving the variable name and its value.
|
protected |
Associate a variable name with a position in varvalues
and namelist
.
Referenced by equivalent(), and getValue().