CalcContext Class Reference

Calculator context used to save the parsed expressions. More...

#include <expression.h>

List of all members.

Public Types

typedef std::map< std::string,
double > 
variablemap_type
 type of the variable storage

Public Member Functions

 ~CalcContext ()
 free the saved expression trees
void clearExpressions ()
 free all saved expression trees
bool existsVariable (const std::string &varname) const
 check if the given variable name exists in the storage
double getVariable (const std::string &varname) const
 return the given variable from the storage.

Public Attributes

variablemap_type variables
 variable storage. maps variable string to doubles
std::vector< CalcNode * > expressions
 array of unassigned expressions found by the parser.


Detailed Description

Calculator context used to save the parsed expressions.

This context is passed along to the example::Driver class and fill during parsing via bison actions.

Definition at line 299 of file expression.h.


Member Typedef Documentation

typedef std::map<std::string, double> CalcContext::variablemap_type

type of the variable storage

Definition at line 304 of file expression.h.


Constructor & Destructor Documentation

CalcContext::~CalcContext (  )  [inline]

free the saved expression trees

Definition at line 314 of file expression.h.

References clearExpressions().


Member Function Documentation

void CalcContext::clearExpressions (  )  [inline]

free all saved expression trees

Definition at line 320 of file expression.h.

References expressions.

Referenced by main(), and ~CalcContext().

bool CalcContext::existsVariable ( const std::string &  varname  )  const [inline]

check if the given variable name exists in the storage

Definition at line 330 of file expression.h.

References variables.

Referenced by example::Parser::parse().

double CalcContext::getVariable ( const std::string &  varname  )  const [inline]

return the given variable from the storage.

throws an exception if it does not exist.

Definition at line 337 of file expression.h.

References variables.

Referenced by example::Parser::parse().


Member Data Documentation

variable storage. maps variable string to doubles

Definition at line 307 of file expression.h.

Referenced by existsVariable(), getVariable(), and example::Parser::parse().

array of unassigned expressions found by the parser.

these are then outputted to the user.

Definition at line 311 of file expression.h.

Referenced by clearExpressions(), main(), and example::Parser::parse().


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

Generated on Thu Oct 23 11:13:54 2008 for Flex Bison C++ Example by  doxygen 1.5.6