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 double 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 173 of file node_impl.cpp.

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

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

Definition at line 177 of file node_impl.cpp.

References name_.

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


Member Function Documentation

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

Definition at line 184 of file node_impl.cpp.

References name_.

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

00186 {
00187   return name_;
00188 }

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

Implements node_impl.

Definition at line 190 of file node_impl.cpp.

References name().

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

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

Implements node_impl.

Definition at line 196 of file node_impl.cpp.

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

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

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

Reimplemented from node_impl.

Definition at line 202 of file node_impl.cpp.

References name().

00204 {
00205   return name();
00206 }

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

Implements node_impl.

Definition at line 208 of file node_impl.cpp.

References name().

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


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:05:50 2008 for Calculator by  doxygen 1.5.3