#include <expression.h>
Inheritance diagram for CalcNode:
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 |
From it the different nullary, unary and binary nodes are derived.
Definition at line 14 of file expression.h.
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.
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().