FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTExpression.h
Go to the documentation of this file.
1/*
2Copyright (c) 2019 Gouvernement du Québec
3
4SPDX-License-Identifier: LiLiQ-R-1.1
5License-Filename: LICENSES/EN/LiLiQ-R11unicode.txt
6*/
7
8#ifndef FMTEXPRESSION_Hm_included
9#define FMTEXPRESSION_Hm_included
10
11#include <string>
12#include <vector>
13#include <map>
14#include <stack>
15
16namespace Core
17{
18 // DocString: FMTExpression
23 {
24 public:
25 // DocString: FMTExpression()
30 // DocString: FMTExpression(const std::vector<std::string>&)
35 FMTExpression(const std::vector<std::string>& lsources);
36 // DocString: FMTExpression(const FMTExpression&)
42 // DocString: FMTExpression::simplify
48 FMTExpression simplify(std::map<std::string,double>& values) const;
49 // DocString: FMTExpression::getVariables
54 std::vector<std::string>getVariables() const;
55 // DocString: FMTExpression::shuntingYard
61 double shuntingYard(const std::map<std::string, double>& mapping) const;
62 // DocString: FMTExpression::getInFix
67 std::vector<std::string>getInFix() const;
68 // DocString: FMTExpression::operator std::string
73 operator std::string() const;
74 // DocString: FMTExpression::operator=
81 // DocString: ~FMTExpression()
85 ~FMTExpression() = default;
86
87 private:
88 std::vector<std::string>m_infix;
89 // DocString: FMTExpression::_getPostFix
95 std::vector<std::string> _getPostFix(const std::vector<std::string>& localinfix) const;
96 // DocString: FMTExpression::_replaceVariables
102 std::vector<std::string> _replaceVariables(const std::map<std::string, double>& mapping) const;
103 // DocString: FMTExpression::_evaluatePostFix
109 double _evaluatePostFix(const std::vector<std::string>& postfix) const;
110 // DocString: FMTExpression::_isNumber
116 bool _isNumber(const std::string& s) const;
117 };
118}
119
120#endif
Mathematical expression evaluated with the shunting yard algorithm, used in yields and outputs.
Definition: FMTExpression.h:23
FMTExpression simplify(std::map< std::string, double > &values) const
Return a simplified expression using the given variable values.
~FMTExpression()=default
Default destructor for FMTExpression.
FMTExpression()
Default constructor for FMTExpression.
std::vector< std::string > getInFix() const
Return the infix expression.
FMTExpression(const FMTExpression &rhs)
Copy constructor for FMTExpression.
FMTExpression(const std::vector< std::string > &lsources)
Construct a FMTExpression from a vector of tokens.
FMTExpression & operator=(const FMTExpression &rhs)
Copy assignment operator for FMTExpression.
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.
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34