AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Aqua::Tokenizer_muparser Class Reference

#include <Tokenizer_muparser.hpp>

Public Member Functions

 Tokenizer_muparser ()
 Constructor.
 ~Tokenizer_muparser ()
 Destructor.
template<typename T>
bool registerVariable (const std::string name, T value)
 Register a variable.
std::vector< std::string > exprVariables (const std::string eq)
 Get the list of variables used on an mathematical expression.
template<typename T = float>
T solve (const std::string eq)
 Solve a math expression.

Protected Member Functions

bool isVariable (const std::string name)
 Checks if a variable has been registered.
template<typename T = float>
T variable (const std::string name)
 Returns a variable value.

Constructor & Destructor Documentation

◆ Tokenizer_muparser()

Aqua::Tokenizer_muparser::Tokenizer_muparser ( )

Constructor.

Here is the call graph for this function:

◆ ~Tokenizer_muparser()

Aqua::Tokenizer_muparser::~Tokenizer_muparser ( )

Destructor.

Member Function Documentation

◆ exprVariables()

std::vector< std::string > Aqua::Tokenizer_muparser::exprVariables ( const std::string eq)

Get the list of variables used on an mathematical expression.

Parameters
eqMath expression to solve.
Returns
List of variable names

◆ isVariable()

bool Aqua::Tokenizer_muparser::isVariable ( const std::string name)
protected

Checks if a variable has been registered.

Parameters
nameName of the variable
Returns
true if already exist a variable with the given name, false otherwise.

◆ registerVariable()

template<typename T>
bool Aqua::Tokenizer_muparser::registerVariable ( const std::string name,
T value )
inline

Register a variable.

In case that the variable already exist, it will be modified.

The registered variables can be used later in the expression to be evaluated.

Parameters
nameName of the variable.
valueValue of the variable.
Returns
true if the variable already exists, false otherwise.
Here is the call graph for this function:

◆ solve()

template<typename T = float>
T Aqua::Tokenizer_muparser::solve ( const std::string eq)
inline

Solve a math expression.

Parameters
eqMath expression to solve.
Returns
Expression value, 0.0 if the evaluation failed (it will be reported by terminal).
Here is the call graph for this function:

◆ variable()

template<typename T = float>
T Aqua::Tokenizer_muparser::variable ( const std::string name)
inlineprotected

Returns a variable value.

Parameters
nameName of the variable
Returns
The Value of the variable, or 0.0 if the variable cannot be found.
Here is the call graph for this function:

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