CalcNode Class Reference

CalcNode is the abstract base class for calculation nodes. More...

#include <expression.h>

Inheritance diagram for CalcNode:

CNAdd CNConstant CNDivide CNModulo CNMultiply CNNegate CNPower CNSubtract

List of all members.

Public Member Functions

virtual ~CalcNode ()
 required for virtual functions.
virtual double evaluate () const =0
 evaluate the complete calculation tree and return the floating point result value
virtual void print (std::ostream &os, unsigned int depth=0) const =0
 output the calculation tree to the given stream.

Static Public Member Functions

static std::string indent (unsigned int d)
 helper function for print() which makes the indention string


Detailed Description

CalcNode is the abstract base class for calculation nodes.

From it the different nullary, unary and binary nodes are derived.

Definition at line 14 of file expression.h.


Constructor & Destructor Documentation

virtual CalcNode::~CalcNode (  )  [inline, virtual]

required for virtual functions.

in the derived classes the operands are deleted.

Definition at line 19 of file expression.h.


Member Function Documentation

virtual double CalcNode::evaluate (  )  const [pure virtual]

evaluate the complete calculation tree and return the floating point result value

Implemented in CNConstant, CNNegate, CNAdd, CNSubtract, CNMultiply, CNDivide, CNModulo, and CNPower.

Referenced by CNPower::evaluate(), CNModulo::evaluate(), CNDivide::evaluate(), CNMultiply::evaluate(), CNSubtract::evaluate(), CNAdd::evaluate(), and CNNegate::evaluate().

virtual void CalcNode::print ( std::ostream &  os,
unsigned int  depth = 0 
) const [pure virtual]

output the calculation tree to the given stream.

tries to format the output to make tree levels visible.

Implemented in CNConstant, CNNegate, CNAdd, CNSubtract, CNMultiply, CNDivide, CNModulo, and CNPower.

Referenced by CNPower::print(), CNModulo::print(), CNDivide::print(), CNMultiply::print(), CNSubtract::print(), CNAdd::print(), and CNNegate::print().

static std::string CalcNode::indent ( unsigned int  d  )  [inline, static]

helper function for print() which makes the indention string

Definition at line 32 of file expression.h.

Referenced by CNPower::print(), CNModulo::print(), CNDivide::print(), CNMultiply::print(), CNSubtract::print(), CNAdd::print(), CNNegate::print(), and CNConstant::print().


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

Generated on Sun Aug 3 12:34:09 2008 for Flex Bison C++ Example by  doxygen 1.5.5