Calculator Step 5

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Member Functions | List of all members
node_add Class Reference

`#include <node_impl.hpp>`

Inheritance diagram for node_add:

## Public Member Functions
| node_add (node left, node right)
| node_add (std::istream &stream)
Public Member Functions inherited from node_binary
| node_binary (node left, node right)
node | left () const
node | right () const
Public Member Functions inherited from node_impl
| node_impl ()
virtual | ~node_impl ()
void | print (std::ostream &stream, int indent) const
double | evaluate () const
std::string | to_string () const
identifier_list const & | get_parameters () const
void | save (std::ostream &stream) const

## Private Member Functions
virtual void | print_node (std::ostream &stream, int indent) const override
virtual double | evaluate_node () const override
virtual void | save_node (std::ostream &stream) const override

## Additional Inherited Members
Static Public Member Functions inherited from node_impl
static std::shared_ptr< node_impl > | read_node (std::istream &stream)
Protected Member Functions inherited from node_binary
| node_binary (std::istream &stream)
double | evaluate_left () const
double | evaluate_right () const

## Detailed Description

Addition.

Definition at line 177 of file node_impl.hpp.

## Constructor & Destructor Documentation

node_add::node_add | ( | node | left,
|  | node | right
| ) |  |

Definition at line 435 of file node_impl.cpp.

References node_binary::left().

436 : node_binary{left, right}
437 {}
node_binary
Definition: node_impl.hpp:147
node_binary::left
node left() const
Definition: node_impl.cpp:380

node_add::node_add | ( | std::istream & | stream | ) |

Definition at line 439 of file node_impl.cpp.

440 : node_binary{stream}
441 {}
node_binary
Definition: node_impl.hpp:147

## Member Function Documentation

double node_add::evaluate_node | ( |  | ) | const
| override private virtual

Implements node_binary.

Definition at line 451 of file node_impl.cpp.

References node_binary::evaluate_left(), and node_binary::evaluate_right().

453 {
454 return evaluate_left() + evaluate_right();
455 }
node_binary::evaluate_right
double evaluate_right() const
Definition: node_impl.cpp:398
node_binary::evaluate_left
double evaluate_left() const
Definition: node_impl.cpp:392

void node_add::print_node | ( | std::ostream & | stream,
|  | int | indent
| ) |  | const
| override private virtual

Implements node_binary.

Definition at line 443 of file node_impl.cpp.

References node_binary::left(), node::print(), and node_binary::right().

445 {
446 stream << std::setw(indent) << "" << "+\n";
447 left().print(stream, indent + 2);
448 right().print(stream, indent + 2);
449 }
node_binary::right
node right() const
Definition: node_impl.cpp:386
node::print
void print(std::ostream &stream, int indent=0) const
Definition: node.cpp:54
node_binary::left
node left() const
Definition: node_impl.cpp:380

void node_add::save_node | ( | std::ostream & | stream | ) | const
| override private virtual

Implements node_binary.

Definition at line 457 of file node_impl.cpp.

References node_binary::left(), node_binary::right(), and node::save().

459 {
460 stream << "add ";
461 left().save(stream);
462 right().save(stream);
463 }
node_binary::right
node right() const
Definition: node_impl.cpp:386
node::save
void save(std::ostream &stream) const
Definition: node.cpp:78
node_binary::left
node left() const
Definition: node_impl.cpp:380

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

- node_impl.hpp
- node_impl.cpp