node_identifier Class Reference

#include <node_impl.hpp>

Inheritance diagram for node_identifier:

node_impl

List of all members.

Public Member Functions

 node_identifier (std::string const &name)
 node_identifier (std::istream &stream)
std::string const & name () const

Private Member Functions

virtual void print_node (std::ostream &stream, int indent) const
virtual number evaluate_node () const
virtual std::string evaluate_string () const
virtual void save_node (std::ostream &stream) const

Private Attributes

std::string name_


Detailed Description

Identifier data type. Used for variable references.

Definition at line 85 of file node_impl.hpp.


Constructor & Destructor Documentation

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

Definition at line 172 of file node_impl.cpp.

00173 : node_impl(), name_(name)
00174 {}

node_identifier::node_identifier ( std::istream &  stream  ) 

Definition at line 176 of file node_impl.cpp.

References name_.

00177 : node_impl()
00178 {
00179   if (not (stream >> name_))
00180     throw calc_error("malformed library file, cannot read identifier");
00181 }


Member Function Documentation

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

Definition at line 183 of file node_impl.cpp.

References name_.

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

00185 {
00186   return name_;
00187 }

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

Implements node_impl.

Definition at line 189 of file node_impl.cpp.

References name().

00191 {
00192   stream << std::setw(indent) << "" << "identifier " << name() << '\n';
00193 }

number node_identifier::evaluate_node (  )  const [private, virtual]

Implements node_impl.

Definition at line 195 of file node_impl.cpp.

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

00197 {
00198   return get_variable(name()).evaluate();
00199 }

std::string node_identifier::evaluate_string (  )  const [private, virtual]

Reimplemented from node_impl.

Definition at line 201 of file node_impl.cpp.

References name().

00203 {
00204   return name();
00205 }

void node_identifier::save_node ( std::ostream &  stream  )  const [private, virtual]

Implements node_impl.

Definition at line 207 of file node_impl.cpp.

References name().

00209 {
00210   stream << "identifier " << name() << '\n';
00211 }


Member Data Documentation

std::string node_identifier::name_ [private]

Definition at line 96 of file node_impl.hpp.

Referenced by name(), and node_identifier().


The documentation for this class was generated from the following files:
Generated on Sun Nov 30 10:06:53 2008 for Calculator by  doxygen 1.5.3