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

#include <node_impl.hpp>

Inheritance diagram for node_negate:
node_unary node_impl

Public Member Functions

 node_negate (node operand)
 
- Public Member Functions inherited from node_unary
 node_unary (node operand)
 
node operand () const
 
- Public Member Functions inherited from node_impl
 node_impl ()
 
 node_impl (node_impl &&)=default
 
node_imploperator= (node_impl &&)=default
 
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
 

Private Member Functions

virtual void print_node (std::ostream &stream, int indent) const override
 
virtual double evaluate_node () const override
 

Additional Inherited Members

- Protected Member Functions inherited from node_unary
double evaluate_operand () const
 

Detailed Description

Unary negation.

Definition at line 146 of file node_impl.hpp.

Constructor & Destructor Documentation

node_negate::node_negate ( node  operand)

Definition at line 279 of file node_impl.cpp.

280 : node_unary(operand)
281 {}
node_unary(node operand)
Definition: node_impl.cpp:234

Member Function Documentation

double node_negate::evaluate_node ( ) const
overrideprivatevirtual

Implements node_unary.

Definition at line 290 of file node_impl.cpp.

References node_unary::evaluate_operand().

292 {
293  return -evaluate_operand();
294 }
double evaluate_operand() const
Definition: node_impl.cpp:244
void node_negate::print_node ( std::ostream &  stream,
int  indent 
) const
overrideprivatevirtual

Implements node_unary.

Definition at line 283 of file node_impl.cpp.

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

285 {
286  stream << std::setw(indent) << "" << "-\n";
287  operand().print(stream, indent + 2);
288 }
void print(std::ostream &stream, int indent=0) const
Definition: node.cpp:51
node operand() const
Definition: node_impl.cpp:238

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