Calculator  Step 6
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
node_unary Class Referenceabstract

#include <node_impl.hpp>

Inheritance diagram for node_unary:
node_impl node_negate

Public Member Functions

 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_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
 

Protected Member Functions

 node_unary (std::istream &stream)
 
number evaluate_operand () const
 

Private Member Functions

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

Private Attributes

node operand_
 

Additional Inherited Members

- Static Public Member Functions inherited from node_impl
static std::shared_ptr< node_implread_node (std::istream &stream)
 

Detailed Description

Abstract base class for unary operators.

Definition at line 134 of file node_impl.hpp.

Constructor & Destructor Documentation

node_unary::node_unary ( node  operand)

Definition at line 351 of file node_impl.cpp.

352 : node_impl{}, operand_{operand}
353 {}
node operand_
Definition: node_impl.hpp:146
node_unary::node_unary ( std::istream &  stream)
protected

Definition at line 355 of file node_impl.cpp.

356 : node_impl{}, operand_{stream}
357 {}
node operand_
Definition: node_impl.hpp:146

Member Function Documentation

virtual number node_unary::evaluate_node ( ) const
overrideprivatepure virtual

Implements node_impl.

Implemented in node_negate.

number node_unary::evaluate_operand ( ) const
protected

Definition at line 365 of file node_impl.cpp.

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

Referenced by node_negate::evaluate_node().

367 {
368  return operand().evaluate();
369 }
number evaluate() const
Definition: node.cpp:73
node operand() const
Definition: node_impl.cpp:359
node node_unary::operand ( ) const

Definition at line 359 of file node_impl.cpp.

References operand_.

Referenced by evaluate_operand(), node_negate::print_node(), and node_negate::save_node().

361 {
362  return operand_;
363 }
node operand_
Definition: node_impl.hpp:146
virtual void node_unary::print_node ( std::ostream &  stream,
int  indent 
) const
overrideprivatepure virtual

Implements node_impl.

Implemented in node_negate.

virtual void node_unary::save_node ( std::ostream &  stream) const
overrideprivatepure virtual

Implements node_impl.

Implemented in node_negate.

Member Data Documentation

node node_unary::operand_
private

Definition at line 146 of file node_impl.hpp.

Referenced by operand().


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