116 : m_Optype( aOptype ), m_Priority( 0 )
122 std::vector<double> values;
123 std::vector<OP_CODE> optype;
125 double curr_value = 0.0;
126 int extra_priority = 0;
128 for(
unsigned ii = 0; ii < aExp.size(); ii++ )
144 optype.emplace_back( prm );
145 optype.back().m_Priority += extra_priority;
152 if( optype.size() < 2 )
155 OP_CODE& previous_optype = optype[optype.size() - 2];
157 if( optype.back().m_Priority > previous_optype.m_Priority )
161 double op2 = values.back();
170 switch( optype.back().m_Optype )
173 values.push_back( op1+op2 );
177 values.push_back( op1-op2 );
181 values.push_back( op1*op2 );
185 values.push_back( op1/op2 );
200 if( values.size() > optype.size() )
204 optype.insert( optype.begin(), OP_CODE(
POPVALUE ) );
206 wxASSERT( values.size() == optype.size() );
208 for(
unsigned idx = 0; idx < values.size(); idx++ )
210 curr_value = values[idx];
212 switch( optype[idx].m_Optype )
219 result += curr_value;
223 result -= curr_value;
227 result *= curr_value;
231 result /= curr_value;
std::vector< AM_PARAM_EVAL > AM_PARAM_EVAL_STACK
This helper class hold a value or an arithmetic operator to calculate the final value of a aperture m...
parm_item_type GetOperator() const
double Evaluate(AM_PARAM_EVAL_STACK &aExp)
Evaluate an basic arithmetic expression (infix notation) with precedence The expression is a sequence...