OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Public Types | Public Member Functions | Private Attributes | List of all members
client::code_gen::StackEvaluator Struct Reference

#include <evaluator.hpp>

Public Types

typedef bool result_type
 

Public Member Functions

template<typename ErrorHandler >
 StackEvaluator (ErrorHandler &error_handler_)
 
double result ()
 
void registerFunction (std::string name, client::function::type callback)
 
void registerFunctions (std::map< std::string, client::function::type > functions)
 
void registerVariables (std::map< std::string, double > variableDictionary)
 
bool operator() (ast::nil)
 
bool operator() (unsigned int x)
 
bool operator() (double x)
 
bool operator() (bool x)
 
bool operator() (ast::quoted_string const &x)
 
bool operator() (ast::identifier const &x)
 
bool operator() (ast::operation const &x)
 
bool operator() (ast::unary const &x)
 
bool operator() (ast::function_call const &x)
 
bool operator() (ast::expression const &x)
 

Private Attributes

boost::function< void(int tag,
std::string const &what)> 
error_handler
 
std::map< std::string, double > variableDictionary_
 
std::map< std::string,
client::function::type
functions_
 
client::function::arguments_t evaluation_stack_
 

Detailed Description

Definition at line 27 of file evaluator.hpp.

Member Typedef Documentation

Definition at line 29 of file evaluator.hpp.

Constructor & Destructor Documentation

template<typename ErrorHandler >
client::code_gen::StackEvaluator::StackEvaluator ( ErrorHandler &  error_handler_)
inline

Definition at line 32 of file evaluator.hpp.

Member Function Documentation

bool client::code_gen::StackEvaluator::operator() ( ast::nil  )
inline

Definition at line 67 of file evaluator.hpp.

bool client::code_gen::StackEvaluator::operator() ( unsigned int  x)

Definition at line 11 of file evaluator.cpp.

References evaluation_stack_.

bool client::code_gen::StackEvaluator::operator() ( double  x)

Definition at line 17 of file evaluator.cpp.

References evaluation_stack_.

bool client::code_gen::StackEvaluator::operator() ( bool  x)

Definition at line 23 of file evaluator.cpp.

References evaluation_stack_.

bool client::code_gen::StackEvaluator::operator() ( ast::quoted_string const &  x)

Definition at line 29 of file evaluator.cpp.

References evaluation_stack_, and client::ast::quoted_string::value.

bool client::code_gen::StackEvaluator::operator() ( ast::identifier const &  x)

Definition at line 35 of file evaluator.cpp.

References endl(), evaluation_stack_, client::ast::identifier::name, and variableDictionary_.

Here is the call graph for this function:

bool client::code_gen::StackEvaluator::operator() ( ast::operation const &  x)
bool client::code_gen::StackEvaluator::operator() ( ast::unary const &  x)
bool client::code_gen::StackEvaluator::operator() ( ast::function_call const &  x)
bool client::code_gen::StackEvaluator::operator() ( ast::expression const &  x)

Definition at line 131 of file evaluator.cpp.

References client::ast::expression::first, and client::ast::expression::rest.

void client::code_gen::StackEvaluator::registerFunction ( std::string  name,
client::function::type  callback 
)
inline

Definition at line 51 of file evaluator.hpp.

References functions_.

void client::code_gen::StackEvaluator::registerFunctions ( std::map< std::string, client::function::type functions)
inline

Definition at line 56 of file evaluator.hpp.

References functions_.

Referenced by Expression::evaluate().

void client::code_gen::StackEvaluator::registerVariables ( std::map< std::string, double >  variableDictionary)
inline

Definition at line 61 of file evaluator.hpp.

References variableDictionary_.

Referenced by Expression::evaluate().

double client::code_gen::StackEvaluator::result ( )
inline

Definition at line 43 of file evaluator.hpp.

References evaluation_stack_.

Referenced by Expression::evaluate().

Member Data Documentation

boost::function<void(int tag, std::string const& what)> client::code_gen::StackEvaluator::error_handler
private

Definition at line 80 of file evaluator.hpp.

client::function::arguments_t client::code_gen::StackEvaluator::evaluation_stack_
private

Definition at line 86 of file evaluator.hpp.

Referenced by operator()(), and result().

std::map<std::string, client::function::type> client::code_gen::StackEvaluator::functions_
private

Definition at line 83 of file evaluator.hpp.

Referenced by operator()(), registerFunction(), and registerFunctions().

std::map<std::string, double> client::code_gen::StackEvaluator::variableDictionary_
private

Definition at line 82 of file evaluator.hpp.

Referenced by operator()(), and registerVariables().


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