29 #ifndef GUM_MATH_FORMULA_H 30 #define GUM_MATH_FORMULA_H 63 enum token_type { NUMBER, OPERATOR, PARENTHESIS, NIL, FUNCTION, ARG_SEP };
161 std::string str()
const;
169 bool isLeftAssociative()
const;
177 bool isRightAssociative()
const;
187 int precedence()
const;
211 FormulaPart eval(
const std::vector< FormulaPart >& args)
const;
229 double __operator_eval(
const std::vector< FormulaPart >& args)
const;
244 double __function_eval(
const std::vector< FormulaPart >& args)
const;
252 size_t __operator_argc()
const;
260 size_t __function_argc()
const;
275 friend class gum::formula::Parser;
294 Formula(
unsigned long long ul);
345 explicit operator double()
const {
return result(); }
372 double result()
const;
377 const std::string& formula()
const;
382 std::string& formula();
395 void __push_number(
const double& v);
401 void __push_operator(
char o);
406 void __push_leftParenthesis();
411 void __push_rightParenthesis();
417 void __push_function(
const std::string& func);
422 void __push_variable(
const std::string& var);
427 void __push_identifier(
const std::string& ident);
480 std::stack< FormulaPart >& stack)
const;
486 void __push_unaryOperator(
char o);
498 bool __isUnaryOperator(
char o);
536 #ifndef GUM_NO_INLINE 538 #endif // GUM_NO_INLINE
Formula operator+(const Formula &a, const Formula &b)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::ostream & operator<<(std::ostream &output, const BayesNet< GUM_SCALAR > &bn)
Prints map's DAG in output using the Graphviz-dot format.
Formula operator/(const Formula &a, const Formula &b)
std::string to_string(const Formula &f)
Formula operator*(const Formula &a, const Formula &b)
ListConstIterator< Val >::difference_type operator-(const ListConstIterator< Val > &iter1, const ListConstIterator< Val > &iter2)
For STL compliance, a distance operator.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.