Calculator  Step 3
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:
node_impl

Public Member Functions

 node_identifier (std::string identifier)
 
std::string const & identifier () const
 
- Public Member Functions inherited from node_impl
 node_impl ()
 
virtual ~node_impl ()
 
void print (std::ostream &stream, int indent) const
 
double evaluate () const
 
std::string to_string () 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 identifier_
 

Detailed Description

Identifier data type. Used in assignments and for variable references in expressions.

Definition at line 66 of file node_impl.hpp.

Constructor & Destructor Documentation

node_identifier::node_identifier ( std::string  identifier)

Definition at line 88 of file node_impl.cpp.

89 : node_impl{}, identifier_{std::move(identifier)}
90 {}
std::string identifier_
Definition: node_impl.hpp:75
std::string const & identifier() const
Definition: node_impl.cpp:92

Member Function Documentation

double node_identifier::evaluate_node ( ) const
overrideprivatevirtual

Implements node_impl.

Definition at line 104 of file node_impl.cpp.

References get_variable(), and identifier().

106 {
107  return get_variable(identifier());
108 }
double get_variable(std::string const &name)
Definition: variables.cpp:18
std::string const & identifier() const
Definition: node_impl.cpp:92
std::string node_identifier::evaluate_string ( ) const
overrideprivatevirtual

Reimplemented from node_impl.

Definition at line 110 of file node_impl.cpp.

References identifier().

112 {
113  return identifier();
114 }
std::string const & identifier() const
Definition: node_impl.cpp:92
std::string const & node_identifier::identifier ( ) const

Definition at line 92 of file node_impl.cpp.

References identifier_.

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

94 {
95  return identifier_;
96 }
std::string identifier_
Definition: node_impl.hpp:75
void node_identifier::print_node ( std::ostream &  stream,
int  indent 
) const
overrideprivatevirtual

Implements node_impl.

Definition at line 98 of file node_impl.cpp.

References identifier().

100 {
101  stream << std::setw(indent) << "" << identifier() << '\n';
102 }
std::string const & identifier() const
Definition: node_impl.cpp:92

Member Data Documentation

std::string node_identifier::identifier_
private

Definition at line 75 of file node_impl.hpp.

Referenced by identifier().


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