Calculator Step 4

- Main Page
- Classes
- Files

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

Public Member Functions | Private Member Functions | Private Attributes | List of all members
node_function Class Reference

`#include <node_impl.hpp>`

Inheritance diagram for node_function:

## Public Member Functions
| node_function (identifier_list parameters, node definition)
identifier_list const & | parameters () const
node | definition () const
Public Member Functions inherited from node_impl
| node_impl ()
| node_impl (node_impl &&)=default
node_impl & | operator= (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
virtual identifier_list const & | evaluate_parameters () const override

## Private Attributes
identifier_list | parameters_
node | definition_

## Detailed Description

Function definition. A function has parameters and a definition.

Definition at line 86 of file node_impl.hpp.

## Constructor & Destructor Documentation

node_function::node_function | ( | identifier_list | parameters,
|  | node | definition
| ) |  |

Definition at line 132 of file node_impl.cpp.

133 : node_impl{}, parameters_{std::move(parameters)}, definition_{definition}
134 {}
node_function::definition_
node definition_
Definition: node_impl.hpp:97
node_impl
Definition: node_impl.hpp:17
node_function::parameters_
identifier_list parameters_
Definition: node_impl.hpp:96
node_function::parameters
identifier_list const & parameters() const
Definition: node_impl.cpp:136

## Member Function Documentation

node node_function::definition | ( |  | ) | const

Definition at line 142 of file node_impl.cpp.

References definition_.

Referenced by evaluate_node(), and print_node().

144 {
145 return definition_;
146 }
node_function::definition_
node definition_
Definition: node_impl.hpp:97

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

Implements node_impl.

Definition at line 168 of file node_impl.cpp.

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

170 {
171 return definition().evaluate();
172 }
node_function::definition
node definition() const
Definition: node_impl.cpp:142
node::evaluate
double evaluate() const
Definition: node.cpp:57

identifier_list const & node_function::evaluate_parameters | ( |  | ) | const
| override private virtual

Reimplemented from node_impl.

Definition at line 174 of file node_impl.cpp.

References parameters().

176 {
177 return parameters();
178 }
node_function::parameters
identifier_list const & parameters() const
Definition: node_impl.cpp:136

identifier_list const & node_function::parameters | ( |  | ) | const

Definition at line 136 of file node_impl.cpp.

References parameters_.

Referenced by evaluate_parameters(), and print_node().

138 {
139 return parameters_;
140 }
node_function::parameters_
identifier_list parameters_
Definition: node_impl.hpp:96

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

Implements node_impl.

Definition at line 159 of file node_impl.cpp.

References definition(), parameters(), node::print(), and print_identifier_list().

161 {
162 stream << std::setw(indent) << "" << "fun\n";
163 print_identifier_list(stream, parameters());
164 stream << '=';
165 definition().print(stream, indent + 2);
166 }
node_function::definition
node definition() const
Definition: node_impl.cpp:142
node::print
void print(std::ostream &stream, int indent=0) const
Definition: node.cpp:51
print_identifier_list
void print_identifier_list(std::ostream &stream, identifier_list const &identifiers)
Definition: node_impl.cpp:148
node_function::parameters
identifier_list const & parameters() const
Definition: node_impl.cpp:136

## Member Data Documentation

node node_function::definition_
| private

Definition at line 97 of file node_impl.hpp.

Referenced by definition().

identifier_list node_function::parameters_
| private

Definition at line 96 of file node_impl.hpp.

Referenced by parameters().

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

- node_impl.hpp
- node_impl.cpp