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

 node_binary (std::istream &stream)
number evaluate_left () const
number evaluate_right () const

Private Member Functions

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

Private Attributes

node left_
node right_


Detailed Description

Abstract base class for binary operators.

Definition at line 151 of file node_impl.hpp.


Constructor & Destructor Documentation

node_binary::node_binary ( node  left,
node  right 
)

Definition at line 379 of file node_impl.cpp.

00380 : left_(left), right_(right)
00381 {}

node_binary::node_binary ( std::istream &  stream  )  [protected]

Definition at line 383 of file node_impl.cpp.

00384 : node_impl(), left_(stream), right_(stream)
00385 {}


Member Function Documentation

node node_binary::left (  )  const

Definition at line 387 of file node_impl.cpp.

References left_.

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

00389 {
00390   return left_;
00391 }

node node_binary::right (  )  const

Definition at line 393 of file node_impl.cpp.

References right_.

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

00395 {
00396   return right_;
00397 }

number node_binary::evaluate_left (  )  const [protected]

Definition at line 399 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().

00401 {
00402   return left().evaluate();
00403 }

number node_binary::evaluate_right (  )  const [protected]

Definition at line 405 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().

00407 {
00408   return right().evaluate();
00409 }

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 number node_binary::evaluate_node (  )  const [private, pure virtual]

Implements node_impl.

Implemented in node_add, node_subtract, node_multiply, and node_divide.

virtual void node_binary::save_node ( std::ostream &  stream  )  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 165 of file node_impl.hpp.

Referenced by left().

node node_binary::right_ [private]

Definition at line 166 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:06:53 2008 for Calculator by  doxygen 1.5.3