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 300 of file expression.h.


Member Typedef Documentation

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

type of the variable storage

Definition at line 305 of file expression.h.


Constructor & Destructor Documentation

CalcContext::~CalcContext (  )  [inline]

free the saved expression trees

Definition at line 315 of file expression.h.

References clearExpressions().


Member Function Documentation

void CalcContext::clearExpressions (  )  [inline]

free all saved expression trees

Definition at line 321 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 331 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 338 of file expression.h.

References variables.

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


Member Data Documentation

array of unassigned expressions found by the parser.

these are then outputted to the user.

Definition at line 312 of file expression.h.

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

variable storage. maps variable string to doubles

Definition at line 308 of file expression.h.

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


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

Generated on Sat Sep 5 10:26:25 2009 for Flex Bison C++ Example by  doxygen 1.5.9