Calculator Step 6

- Main Page
- Classes
- Files

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

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

`#include <node_impl.hpp>`

Inheritance diagram for node_negate:

## Public Member Functions
| node_negate (node operand)
| node_negate (std::istream &stream)
Public Member Functions inherited from node_unary
| node_unary (node operand)
node | operand () const
Public Member Functions inherited from node_impl
| node_impl ()
virtual | ~node_impl ()
| node_impl (node_impl &&)=default
node_impl & | operator= (node_impl &&)=default
void | print (std::ostream &stream, int indent) const
number | 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 number | 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_unary
| node_unary (std::istream &stream)
number | evaluate_operand () const

## Detailed Description

Unary negation.

Definition at line 169 of file node_impl.hpp.

## Constructor & Destructor Documentation

node_negate::node_negate | ( | node | operand | ) |

Definition at line 404 of file node_impl.cpp.

405 : node_unary{operand}
406 {}
node_unary
Definition: node_impl.hpp:134

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

Definition at line 408 of file node_impl.cpp.

409 : node_unary{stream}
410 {}
node_unary
Definition: node_impl.hpp:134

## Member Function Documentation

number node_negate::evaluate_node | ( |  | ) | const
| override private virtual

Implements node_unary.

Definition at line 419 of file node_impl.cpp.

References node_unary::evaluate_operand().

421 {
422 return -evaluate_operand();
423 }
node_unary::evaluate_operand
number evaluate_operand() const
Definition: node_impl.cpp:365

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

Implements node_unary.

Definition at line 412 of file node_impl.cpp.

References node_unary::operand(), and node::print().

414 {
415 stream << std::setw(indent) << "" << "-\n";
416 operand().print(stream, indent + 2);
417 }
node::print
void print(std::ostream &stream, int indent=0) const
Definition: node.cpp:67
node_unary::operand
node operand() const
Definition: node_impl.cpp:359

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

Implements node_unary.

Definition at line 425 of file node_impl.cpp.

References node_unary::operand(), and node::save().

427 {
428 stream << "negate ";
429 operand().save(stream);
430 }
node_unary::operand
node operand() const
Definition: node_impl.cpp:359
node::save
void save(std::ostream &stream) const
Definition: node.cpp:91

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

- node_impl.hpp
- node_impl.cpp