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_identifier Class Reference

`#include <node_impl.hpp>`

Inheritance diagram for node_identifier:

## Public Member Functions
| node_identifier (std::string name)
std::string const & | name () 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 std::string | evaluate_string () const override

## Private Attributes
std::string | name_

## Detailed Description

Identifier data type. Used for variable references.

Definition at line 71 of file node_impl.hpp.

## Constructor & Destructor Documentation

node_identifier::node_identifier | ( | std::string | name | ) |

Definition at line 103 of file node_impl.cpp.

104 : node_impl{}, name_{std::move(name)}
105 {}
node_identifier::name_
std::string name_
Definition: node_impl.hpp:80
node_impl
Definition: node_impl.hpp:17
node_identifier::name
std::string const & name() const
Definition: node_impl.cpp:107

## Member Function Documentation

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

Implements node_impl.

Definition at line 119 of file node_impl.cpp.

References node::evaluate(), get_variable(), and name().

121 {
122 return get_variable(name()).evaluate();
123 }
node_identifier::name
std::string const & name() const
Definition: node_impl.cpp:107
node::evaluate
double evaluate() const
Definition: node.cpp:57
get_variable
node get_variable(std::string const &name)
Definition: variables.cpp:45

std::string node_identifier::evaluate_string | ( |  | ) | const
| override private virtual

Reimplemented from node_impl.

Definition at line 125 of file node_impl.cpp.

References name().

127 {
128 return name();
129 }
node_identifier::name
std::string const & name() const
Definition: node_impl.cpp:107

std::string const & node_identifier::name | ( |  | ) | const

Definition at line 107 of file node_impl.cpp.

References name_.

Referenced by evaluate_node(), evaluate_string(), and print_node().

109 {
110 return name_;
111 }
node_identifier::name_
std::string name_
Definition: node_impl.hpp:80

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

Implements node_impl.

Definition at line 113 of file node_impl.cpp.

References name().

115 {
116 stream << std::setw(indent) << "" << "identifier:" << name() << '\n';
117 }
node_identifier::name
std::string const & name() const
Definition: node_impl.cpp:107

## Member Data Documentation

std::string node_identifier::name_
| private

Definition at line 80 of file node_impl.hpp.

Referenced by name().

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

- node_impl.hpp
- node_impl.cpp