Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
ibis::math::barrel Class Reference

A barrel to hold a list of variables. More...

#include <qExpr.h>

Inheritance diagram for ibis::math::barrel:
ibis::index::barrel ibis::part::barrel ibis::part::vault

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
 

Detailed Description

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.

Member Function Documentation

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)
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.

Member Data Documentation

termMap ibis::math::barrel::varmap
protected

Associate a variable name with a position in varvalues and namelist.

Referenced by equivalent(), and getValue().


The documentation for this class was generated from the following files:

Make It A Bit Faster
Contact us
Disclaimers
FastBit source code
FastBit mailing list archive