- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# node_function_call Class Reference

`#include <node_impl.hpp>`

Inheritance diagram for node_function_call:

List of all members.

## Public Member Functions
| node_function_call (std::string const &name, node_list const &arguments)
std::string | name () const
node_list const & | arguments () const
## Private Member Functions
virtual void | print_node (std::ostream &stream, int indent) const
virtual double | evaluate_node () const
## Private Attributes
std::string | name_
node_list | arguments_

## Detailed Description

Function call.

Definition at line 106 of file node_impl.hpp.

## Constructor & Destructor Documentation

node_function_call::node_function_call | ( | std::string const & | name,
|  | node_list const & | arguments |
| ) |  |  |

Definition at line 193 of file node_impl.cpp.

    00194 : node_impl(), name_(name), arguments_(arguments)
    00195 {}

## Member Function Documentation

std::string node_function_call::name | ( |  | ) | const

Definition at line 197 of file node_impl.cpp.

References name_.

Referenced by evaluate_node(), and print_node().

    00199 {
    00200   return name_;
    00201 }

node_list const & node_function_call::arguments | ( |  | ) | const

Definition at line 203 of file node_impl.cpp.

References arguments_.

Referenced by evaluate_node(), and print_node().

    00205 {
    00206   return arguments_;
    00207 }

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

Implements node_impl.

Definition at line 209 of file node_impl.cpp.

References arguments(), and name().

    00211 {
    00212   stream << std::setw(indent) << "" << name() << "(\n";
    00213   for (node_list::const_iterator first(arguments().begin()), arg(first); arg != arguments().end(); ++arg) {
    00214     stream << std::setw(indent+1) << "" << "arg " << std::distance(first, arg) << ": ";
    00215     arg->print(stream, indent + 2);
    00216   }
    00217   stream << std::setw(indent) << "" << ")\n";
    00218 }

double node_function_call::evaluate_node | ( |  | ) | const`[private, virtual]`

Implements node_impl.

Definition at line 220 of file node_impl.cpp.

References arguments(), node::evaluate(), get_function(), node::get_parameters(), and name().

    00222 {
    00223   // Create a local symbol table, assigning all the node values to the parameters.
    00224   node function = get_function(name());
    00225   identifier_list const& parameters( function.get_parameters() );
    00226   if (parameters.size() != arguments().size())
    00227     throw function_error(name(), parameters.size(), arguments().size());
    00228   else
    00229   {
    00230     // Create a local symbol table by assigning the arguments to the function parameters.
    00231     symbol_table locals;
    00232     identifier_list::const_iterator parm(parameters.begin());
    00233     for (node_list::const_iterator arg(arguments().begin()); arg != arguments().end(); ++arg, ++parm) {
    00234       locals.insert(std::make_pair(*parm, *arg));
    00235     }
    00236     set_symbol_table syms(locals);
    00237     return function.evaluate();
    00238   }
    00239 }

## Member Data Documentation

std::string node_function_call::name_`[private]`

Definition at line 115 of file node_impl.hpp.

Referenced by name().

node_list node_function_call::arguments_`[private]`

Definition at line 116 of file node_impl.hpp.

Referenced by arguments().

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

- node_impl.hpp
- node_impl.cpp