node_binary Class Reference

#include <node_impl.hpp>

Inheritance diagram for node_binary:

node_impl node_add node_divide node_multiply node_subtract

List of all members.

Public Member Functions

 node_binary (node left, node right)
node left () const
node right () const

Protected Member Functions

double evaluate_left () const
double evaluate_right () const

Private Member Functions

virtual void print_node (std::ostream &stream, int indent) const =0
virtual double evaluate_node () const =0

Private Attributes

node left_
node right_


Detailed Description

Abstract base class for binary operators.

Definition at line 134 of file node_impl.hpp.


Constructor & Destructor Documentation

node_binary::node_binary ( node  left,
node  right 
)

Definition at line 259 of file node_impl.cpp.

00260 : left_(left), right_(right)
00261 {}


Member Function Documentation

node node_binary::left (  )  const

Definition at line 263 of file node_impl.cpp.

References left_.

Referenced by evaluate_left(), node_divide::print_node(), node_multiply::print_node(), node_subtract::print_node(), and node_add::print_node().

00265 {
00266   return left_;
00267 }

node node_binary::right (  )  const

Definition at line 269 of file node_impl.cpp.

References right_.

Referenced by evaluate_right(), node_divide::print_node(), node_multiply::print_node(), node_subtract::print_node(), and node_add::print_node().

00271 {
00272   return right_;
00273 }

double node_binary::evaluate_left (  )  const [protected]

Definition at line 275 of file node_impl.cpp.

References node::evaluate(), and left().

Referenced by node_divide::evaluate_node(), node_multiply::evaluate_node(), node_subtract::evaluate_node(), and node_add::evaluate_node().

00277 {
00278   return left().evaluate();
00279 }

double node_binary::evaluate_right (  )  const [protected]

Definition at line 281 of file node_impl.cpp.

References node::evaluate(), and right().

Referenced by node_divide::evaluate_node(), node_multiply::evaluate_node(), node_subtract::evaluate_node(), and node_add::evaluate_node().

00283 {
00284   return right().evaluate();
00285 }

virtual void node_binary::print_node ( std::ostream &  stream,
int  indent 
) const [private, pure virtual]

Implements node_impl.

Implemented in node_add, node_subtract, node_multiply, and node_divide.

virtual double node_binary::evaluate_node (  )  const [private, pure virtual]

Implements node_impl.

Implemented in node_add, node_subtract, node_multiply, and node_divide.


Member Data Documentation

node node_binary::left_ [private]

Definition at line 146 of file node_impl.hpp.

Referenced by left().

node node_binary::right_ [private]

Definition at line 147 of file node_impl.hpp.

Referenced by right().


The documentation for this class was generated from the following files:
Generated on Sun Nov 30 10:05:27 2008 for Calculator by  doxygen 1.5.3