#include <muParser.h>
Public Member Functions | |
Parser () | |
Constructor. | |
virtual void | InitCharSets () |
Define the character sets. | |
virtual void | InitFun () |
Initialize the default functions. | |
virtual void | InitConst () |
Initialize constants. | |
virtual void | InitOprt () |
Initialize operators. | |
void | SetDecSep (char_type cDecSep) |
Set the decimal separator. | |
void | SetThousandsSep (char_type cThousandsSep) |
Sets the thousands operator. | |
value_type | Diff (value_type *a_Var, value_type a_fPos, value_type a_fEpsilon=0.00074) const |
Numerically differentiate with regard to a variable. | |
Static Private Member Functions | |
static value_type | Sin (value_type) |
static value_type | Cos (value_type) |
static value_type | Tan (value_type) |
static value_type | ASin (value_type) |
static value_type | ACos (value_type) |
static value_type | ATan (value_type) |
static value_type | Sinh (value_type) |
static value_type | Cosh (value_type) |
static value_type | Tanh (value_type) |
static value_type | ASinh (value_type) |
static value_type | ACosh (value_type) |
static value_type | ATanh (value_type) |
static value_type | Log2 (value_type) |
static value_type | Log10 (value_type) |
static value_type | Ln (value_type) |
static value_type | Exp (value_type) |
static value_type | Abs (value_type) |
static value_type | Sqrt (value_type) |
static value_type | Rint (value_type) |
static value_type | Sign (value_type) |
static value_type | Ite (value_type, value_type, value_type) |
Conditional (if then else). | |
static value_type | UnaryMinus (value_type) |
Callback for the unary minus operator. | |
static value_type | Sum (const value_type *, int) |
Callback for adding multiple values. | |
static value_type | Avg (const value_type *, int) |
Callback for averaging multiple values. | |
static value_type | Min (const value_type *, int) |
Callback for determining the minimum value out of a vector. | |
static value_type | Max (const value_type *, int) |
Callback for determining the maximum value out of a vector. | |
static int | IsVal (const char_type *a_szExpr, int *a_iPos, value_type *a_fVal) |
Default value recognition callback. | |
Static Private Attributes | |
static std::locale | s_locale = std::locale("C") |
The locale used by the parser. | |
Classes | |
class | change_dec_sep |
A facet class used to change decimal and thousands separator. More... |
Standard implementation of the mathematical expressions parser. Can be used as a reference implementation for subclassing the parser.
(C) 2004-2008 Ingo Berg
ingo_berg(at)gmx.de
mu::Parser::Parser | ( | ) |
Constructor.
Call ParserBase class constructor and trigger Function, Operator and Constant initialization.
References InitCharSets(), InitConst(), InitFun(), InitOprt(), and IsVal().
void mu::Parser::InitCharSets | ( | ) | [virtual] |
Define the character sets.
Implements mu::ParserBase.
References mu::ParserBase::DefineInfixOprtChars(), mu::ParserBase::DefineNameChars(), and mu::ParserBase::DefineOprtChars().
Referenced by Parser().
void mu::Parser::InitConst | ( | ) | [virtual] |
Initialize constants.
By default the parser recognizes two constants. Pi ("pi") and the eulerian number ("_e").
Implements mu::ParserBase.
References mu::ParserBase::DefineConst(), PARSER_CONST_E, and PARSER_CONST_PI.
Referenced by Parser().
void mu::Parser::InitOprt | ( | ) | [virtual] |
Initialize operators.
By default only the unary minus operator is added.
Implements mu::ParserBase.
References mu::ParserBase::DefineInfixOprt(), and UnaryMinus().
Referenced by Parser().
void mu::Parser::SetDecSep | ( | char_type | cDecSep | ) |
Set the decimal separator.
cDecSep | Decimal separator as a character value. |
References s_locale.
void mu::Parser::SetThousandsSep | ( | char_type | cThousandsSep | ) |
value_type mu::Parser::Diff | ( | value_type * | a_Var, | |
value_type | a_fPos, | |||
value_type | a_fEpsilon = 0.00074 | |||
) | const |
Numerically differentiate with regard to a variable.
[in] | a_Var | Pointer to the differentiation variable. |
[in] | a_fPos | Position at which the differentiation should take place. |
[in] | a_fEpsilon | Epsilon used for the numerical differentiation. |
http://sourceforge.net/forum/forum.php?thread_id=1994611&forum_id=462843
References mu::ParserBase::Eval().
value_type mu::Parser::Ite | ( | value_type | v1, | |
value_type | v2, | |||
value_type | v3 | |||
) | [static, private] |
Conditional (if then else).
v1 | Condition | |
v2 | First value | |
v3 | Second value |
Referenced by InitFun().
value_type mu::Parser::UnaryMinus | ( | value_type | v | ) | [static, private] |
Callback for the unary minus operator.
v | The value to negate |
Referenced by InitOprt().
value_type mu::Parser::Sum | ( | const value_type * | a_afArg, | |
int | a_iArgc | |||
) | [static, private] |
Callback for adding multiple values.
[in] | a_afArg | Vector with the function arguments |
[in] | a_iArgc | The size of a_afArg |
Referenced by InitFun().
value_type mu::Parser::Avg | ( | const value_type * | a_afArg, | |
int | a_iArgc | |||
) | [static, private] |
Callback for averaging multiple values.
[in] | a_afArg | Vector with the function arguments |
[in] | a_iArgc | The size of a_afArg |
Referenced by InitFun().
value_type mu::Parser::Min | ( | const value_type * | a_afArg, | |
int | a_iArgc | |||
) | [static, private] |
Callback for determining the minimum value out of a vector.
[in] | a_afArg | Vector with the function arguments |
[in] | a_iArgc | The size of a_afArg |
Referenced by InitFun().
value_type mu::Parser::Max | ( | const value_type * | a_afArg, | |
int | a_iArgc | |||
) | [static, private] |
Callback for determining the maximum value out of a vector.
[in] | a_afArg | Vector with the function arguments |
[in] | a_iArgc | The size of a_afArg |
Referenced by InitFun().
int mu::Parser::IsVal | ( | const char_type * | a_szExpr, | |
int * | a_iPos, | |||
value_type * | a_fVal | |||
) | [static, private] |
Default value recognition callback.
[in] | a_szExpr | Pointer to the expression |
[in,out] | a_iPos | Pointer to an index storing the current position within the expression |
[out] | a_fVal | Pointer where the value should be stored in case one is found. |
References s_locale.
Referenced by Parser().