MADNESS  version 0.9
muParserInt.h
Go to the documentation of this file.
1 /*
2  __________
3  _____ __ __\______ \_____ _______ ______ ____ _______
4  / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
5  | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
6  |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
7  \/ \/ \/ \/
8  Copyright (C) 2004-2008 Ingo Berg
9 
10  Permission is hereby granted, free of charge, to any person obtaining a copy of this
11  software and associated documentation files (the "Software"), to deal in the Software
12  without restriction, including without limitation the rights to use, copy, modify,
13  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
14  permit persons to whom the Software is furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in all copies or
17  substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
20  NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25 
26 #ifndef MU_PARSER_INT_H
27 #define MU_PARSER_INT_H
28 
29 #include "muParserBase.h"
30 #include <vector>
31 
37 namespace mu
38 {
39 
45 class ParserInt : public ParserBase
46 {
47 private:
48  static int Round(value_type v) { return (int)(v + ((v>=0) ? 0.5 : -0.5) ); };
49 
50  static value_type Abs(value_type);
51  static value_type Sign(value_type);
53  // !! The unary Minus is a MUST, otherwise you cant use negative signs !!
54  static value_type UnaryMinus(value_type);
55  // Functions with variable number of arguments
56  static value_type Sum(const value_type* a_afArg, int a_iArgc); // sum
57  static value_type Min(const value_type* a_afArg, int a_iArgc); // minimum
58  static value_type Max(const value_type* a_afArg, int a_iArgc); // maximum
59  // binary operator callbacks
60  static value_type Add(value_type v1, value_type v2);
61  static value_type Sub(value_type v1, value_type v2);
62  static value_type Mul(value_type v1, value_type v2);
63  static value_type Div(value_type v1, value_type v2);
64  static value_type Mod(value_type v1, value_type v2);
65  static value_type Shr(value_type v1, value_type v2);
66  static value_type Shl(value_type v1, value_type v2);
67  static value_type LogAnd(value_type v1, value_type v2);
68  static value_type LogOr(value_type v1, value_type v2);
69  static value_type LogXor(value_type v1, value_type v2);
70  static value_type And(value_type v1, value_type v2);
71  static value_type Or(value_type v1, value_type v2);
72  static value_type Xor(value_type v1, value_type v2);
73  static value_type Less(value_type v1, value_type v2);
74  static value_type Greater(value_type v1, value_type v2);
75  static value_type LessEq(value_type v1, value_type v2);
76  static value_type GreaterEq(value_type v1, value_type v2);
77  static value_type Equal(value_type v1, value_type v2);
78  static value_type NotEqual(value_type v1, value_type v2);
79  static value_type Not(value_type v1);
80 
81  static int IsHexVal(const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
82  static int IsBinVal(const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
83  static int IsVal (const char_type* a_szExpr, int *a_iPos, value_type *a_iVal);
84 
85 public:
86  ParserInt();
87 
88  virtual void InitFun();
89  virtual void InitOprt();
90  virtual void InitConst();
91  virtual void InitCharSets();
92 };
93 
94 } // namespace mu
95 
96 #endif
97 
virtual void InitConst()
virtual void InitCharSets()
This file contains the class definition of the muparser engine.
MUP_BASETYPE value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:222
Mathematical expressions parser.
Definition: muParserInt.h:45
const muChar_t * a_szExpr
Definition: muParserDLL.h:78
Namespace for mathematical applications.
Definition: muParser.cpp:47
string_type::value_type char_type
The character type used by the parser.
Definition: muParserDef.h:240
virtual void InitFun()
virtual void InitOprt()
Mathematical expressions parser (base parser engine).
Definition: muParserBase.h:63