OPAL (Object Oriented Parallel Accelerator Library) 2022.1
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::typefunctions_
 
client::function::arguments_t evaluation_stack_
 

Detailed Description

Definition at line 27 of file evaluator.hpp.

Member Typedef Documentation

◆ result_type

Definition at line 29 of file evaluator.hpp.

Constructor & Destructor Documentation

◆ StackEvaluator()

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

Definition at line 32 of file evaluator.hpp.

References PyOpal::PyPolynomialPatch::function().

Here is the call graph for this function:

Member Function Documentation

◆ operator()() [1/10]

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.

◆ operator()() [2/10]

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

◆ operator()() [3/10]

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:

◆ operator()() [4/10]

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

Definition at line 67 of file evaluator.hpp.

◆ operator()() [5/10]

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

◆ operator()() [6/10]

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.

◆ operator()() [7/10]

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

◆ operator()() [8/10]

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

Definition at line 23 of file evaluator.cpp.

References evaluation_stack_.

◆ operator()() [9/10]

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

Definition at line 17 of file evaluator.cpp.

References evaluation_stack_.

◆ operator()() [10/10]

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

Definition at line 11 of file evaluator.cpp.

References evaluation_stack_.

◆ registerFunction()

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

Definition at line 51 of file evaluator.hpp.

References functions_, and name.

◆ registerFunctions()

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().

◆ registerVariables()

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().

◆ result()

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

Definition at line 43 of file evaluator.hpp.

References evaluation_stack_, and result().

Referenced by Expression::evaluate(), and result().

Here is the call graph for this function:

Member Data Documentation

◆ error_handler

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

Definition at line 80 of file evaluator.hpp.

◆ evaluation_stack_

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

Definition at line 86 of file evaluator.hpp.

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

◆ functions_

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().

◆ variableDictionary_

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: