OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
Evaluate the Abstract Syntax Tree. More...
#include <matheval.hpp>
Public Types | |
using | result_type = real_t |
Necessary typedef for boost::apply_visitor More... | |
using | symbol_table_t = std::map< std::string, result_type > |
Type of the symbol table. More... | |
Public Member Functions | |
eval_ast (symbol_table_t sym) | |
Constructor. More... | |
result_type | operator() (nil) const |
Empty nodes in the tree evaluate to 0. More... | |
result_type | operator() (result_type n) const |
Numbers evaluate to themselves. More... | |
result_type | operator() (std::string const &c) const |
Variables evaluate to their value in the symbol table. More... | |
result_type | operator() (expr_ast< real_t > const &ast) const |
Recursively evaluate the AST. More... | |
result_type | operator() (binary_op< real_t > const &tree) const |
Evaluate a binary operator and optionally recurse its operands. More... | |
result_type | operator() (unary_op< real_t > const &tree) const |
Evaluate a unary operator and optionally recurse its operand. More... | |
Private Attributes | |
symbol_table_t | st |
Evaluate the Abstract Syntax Tree.
This visits all the variants of the AST and applies the stored operators.
Definition at line 208 of file matheval.hpp.
using matheval::detail::eval_ast< real_t >::result_type = real_t |
Necessary typedef for boost::apply_visitor
Definition at line 212 of file matheval.hpp.
using matheval::detail::eval_ast< real_t >::symbol_table_t = std::map<std::string, result_type> |
Type of the symbol table.
Definition at line 215 of file matheval.hpp.
|
inlineexplicit |
Constructor.
Saves the symbol table to apply variables.
Definition at line 221 of file matheval.hpp.
|
inline |
Evaluate a binary operator and optionally recurse its operands.
Definition at line 246 of file matheval.hpp.
|
inline |
Recursively evaluate the AST.
Definition at line 240 of file matheval.hpp.
References matheval::detail::expr_ast< real_t >::tree.
|
inline |
Empty nodes in the tree evaluate to 0.
Definition at line 224 of file matheval.hpp.
|
inline |
Numbers evaluate to themselves.
Definition at line 227 of file matheval.hpp.
References Hypervolume::n.
|
inline |
Variables evaluate to their value in the symbol table.
Definition at line 230 of file matheval.hpp.
References Physics::c, and matheval::detail::eval_ast< real_t >::st.
|
inline |
Evaluate a unary operator and optionally recurse its operand.
Definition at line 255 of file matheval.hpp.
|
private |
Definition at line 263 of file matheval.hpp.
Referenced by matheval::detail::eval_ast< real_t >::operator()().