FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Core::FMTExpression Class Reference

Mathematical expression evaluated with the shunting yard algorithm, used in yields and outputs. More...

#include <FMTExpression.h>

Public Member Functions

 FMTExpression ()
 Default constructor for FMTExpression.
 
 FMTExpression (const std::vector< std::string > &lsources)
 Construct a FMTExpression from a vector of tokens.
 
 FMTExpression (const FMTExpression &rhs)
 Copy constructor for FMTExpression.
 
FMTExpression simplify (std::map< std::string, double > &values) const
 Return a simplified expression using the given variable values.
 
std::vector< std::string > getVariables () const
 Return the variables of the expression.
 
double shuntingYard (const std::map< std::string, double > &mapping) const
 Evaluate the expression using the shunting yard algorithm.
 
std::vector< std::string > getInFix () const
 Return the infix expression.
 
 operator std::string () const
 Convert the expression to its string representation.
 
FMTExpressionoperator= (const FMTExpression &rhs)
 Copy assignment operator for FMTExpression.
 
 ~FMTExpression ()=default
 Default destructor for FMTExpression.
 

Detailed Description

Mathematical expression evaluated with the shunting yard algorithm, used in yields and outputs.

Constructor & Destructor Documentation

◆ FMTExpression() [1/3]

Core::FMTExpression::FMTExpression ( )

Default constructor for FMTExpression.

◆ FMTExpression() [2/3]

Core::FMTExpression::FMTExpression ( const std::vector< std::string > &  lsources)

Construct a FMTExpression from a vector of tokens.

Parameters
[in]lsourcesthe tokens of the expression.

◆ FMTExpression() [3/3]

Core::FMTExpression::FMTExpression ( const FMTExpression rhs)

Copy constructor for FMTExpression.

Parameters
[in]rhsthe FMTExpression to copy.

◆ ~FMTExpression()

Core::FMTExpression::~FMTExpression ( )
default

Default destructor for FMTExpression.

Member Function Documentation

◆ getInFix()

std::vector< std::string > Core::FMTExpression::getInFix ( ) const

Return the infix expression.

Returns
the infix expression.

◆ getVariables()

std::vector< std::string > Core::FMTExpression::getVariables ( ) const

Return the variables of the expression.

Returns
the variables of the expression.

◆ operator std::string()

Core::FMTExpression::operator std::string ( ) const

Convert the expression to its string representation.

Returns
the string representation of the expression.

◆ operator=()

FMTExpression & Core::FMTExpression::operator= ( const FMTExpression rhs)

Copy assignment operator for FMTExpression.

Parameters
[in]rhsthe FMTExpression to copy.
Returns
a reference to this FMTExpression.

◆ shuntingYard()

double Core::FMTExpression::shuntingYard ( const std::map< std::string, double > &  mapping) const

Evaluate the expression using the shunting yard algorithm.

Parameters
[in]mappingthe values of the variables.
Returns
the value of the expression.

◆ simplify()

FMTExpression Core::FMTExpression::simplify ( std::map< std::string, double > &  values) const

Return a simplified expression using the given variable values.

Parameters
[in,out]valuesthe values of the variables.
Returns
the simplified expression.

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