Calculator  Step 6
Public Member Functions | Private Member Functions | List of all members
node_divide Class Reference

#include <node_impl.hpp>

Inheritance diagram for node_divide:
node_binary node_impl

Public Member Functions

 node_divide (node left, node right)
 
 node_divide (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 ()
 
 node_impl (node_impl &&)=default
 
node_imploperator= (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_implread_node (std::istream &stream)
 
- Protected Member Functions inherited from node_binary
 node_binary (std::istream &stream)
 
number evaluate_left () const
 
number evaluate_right () const
 

Detailed Description

Division.

Definition at line 213 of file node_impl.hpp.

Constructor & Destructor Documentation

node_divide::node_divide ( node  left,
node  right 
)

Definition at line 527 of file node_impl.cpp.

References node_binary::left().

528 : node_binary{left, right}
529 {}
node left() const
Definition: node_impl.cpp:379
node_divide::node_divide ( std::istream &  stream)

Definition at line 531 of file node_impl.cpp.

532 : node_binary{stream}
533 {}

Member Function Documentation

number node_divide::evaluate_node ( ) const
overrideprivatevirtual

Implements node_binary.

Definition at line 543 of file node_impl.cpp.

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

545 {
546  return evaluate_left() / evaluate_right();
547 }
number evaluate_right() const
Definition: node_impl.cpp:397
number evaluate_left() const
Definition: node_impl.cpp:391
void node_divide::print_node ( std::ostream &  stream,
int  indent 
) const
overrideprivatevirtual

Implements node_binary.

Definition at line 535 of file node_impl.cpp.

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

537 {
538  stream << std::setw(indent) << "" << "/\n";
539  left().print(stream, indent + 2);
540  right().print(stream, indent + 2);
541 }
node right() const
Definition: node_impl.cpp:385
void print(std::ostream &stream, int indent=0) const
Definition: node.cpp:67
node left() const
Definition: node_impl.cpp:379
void node_divide::save_node ( std::ostream &  stream) const
overrideprivatevirtual

Implements node_binary.

Definition at line 549 of file node_impl.cpp.

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

551 {
552  stream << "divide ";
553  left().save(stream);
554  right().save(stream);
555 }
node right() const
Definition: node_impl.cpp:385
void save(std::ostream &stream) const
Definition: node.cpp:91
node left() const
Definition: node_impl.cpp:379

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