ʻOhana
Population structure, admixture history, and selection using learning methods.
|
A template for a class that implements the shunting-yard algorithm. The implementation supports '+', '-', '*', and '/' operators; the '(' and ')' parentheses; floating-point numbers; and variables. After parsing an expression, the instance can evaluate the expression if given a table of variable values. More...
#include <jade.shunting_yard.hpp>
Public Types | |
typedef TFloat | float_type |
The floating-point type. More... | |
typedef std::map< std::string, float_type > | args_type |
A map of strings to floating-point values. The string represent the variable names parsed from the expression passed to the constructor, and the floating-point values are used to evaluate the expression. More... | |
Public Member Functions | |
basic_shunting_yard (std::istream &in) | |
Initializes a new instance of the class. The specified input stream provides tokens for the expression. More... | |
basic_shunting_yard (const std::string &expression) | |
Initializes a new instance of the class. The specified string provides tokens for the expression. More... | |
const args_type & | get_args () const |
Returns a table of arguments that maps variables to values. The table reference returned has all values set to zero. The table can be used to evaluate the expression. More... | |
float_type | evaluate (const args_type &args=args_type()) const |
Evaluates the expression using values from the specified table. More... | |
float_type | operator() (const args_type &args=args_type()) const |
Evaluates the expression using values from the specified table. More... | |
A template for a class that implements the shunting-yard algorithm. The implementation supports '+', '-', '*', and '/' operators; the '(' and ')' parentheses; floating-point numbers; and variables. After parsing an expression, the instance can evaluate the expression if given a table of variable values.
Definition at line 22 of file jade.shunting_yard.hpp.
typedef std::map<std::string, float_type> jade::basic_shunting_yard< TFloat >::args_type |
A map of strings to floating-point values. The string represent the variable names parsed from the expression passed to the constructor, and the floating-point values are used to evaluate the expression.
Definition at line 33 of file jade.shunting_yard.hpp.
typedef TFloat jade::basic_shunting_yard< TFloat >::float_type |
The floating-point type.
Definition at line 25 of file jade.shunting_yard.hpp.
|
inlineexplicit |
Initializes a new instance of the class. The specified input stream provides tokens for the expression.
in | The input stream providing tokens. |
Definition at line 40 of file jade.shunting_yard.hpp.
|
inlineexplicit |
Initializes a new instance of the class. The specified string provides tokens for the expression.
expression | The string providing tokens. |
Definition at line 60 of file jade.shunting_yard.hpp.
|
inline |
Evaluates the expression using values from the specified table.
args | The table of variable values. |
Definition at line 84 of file jade.shunting_yard.hpp.
|
inline |
Returns a table of arguments that maps variables to values. The table reference returned has all values set to zero. The table can be used to evaluate the expression.
Definition at line 74 of file jade.shunting_yard.hpp.
|
inline |
Evaluates the expression using values from the specified table.
args | The table of variable values. |
Definition at line 135 of file jade.shunting_yard.hpp.