Int64MathParser.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2006 by Basler Vision Technologies
3 // Section: Vision Components
4 // Project: GenApi
5 // Author: Margret Albrecht
6 // $Header$
7 //
8 // License: Derived from Kirill Zaborski's MathParser library (http://kirya.narod.ru/mathparser.html ).
9 // This library comes under LGPL license (see http://www.gnu.org/licenses/lgpl.html).
10 // Kirill's implementation is a C++ port of the CCalc library from Walery Studennikov (http://www.sama.ru/~despair/ccalc/)
11 // which also comes under the LGPL.
12 //-----------------------------------------------------------------------------
22 #ifndef _INT64MATHPARSER_H_
23 #define _INT64MATHPARSER_H_
24 
25 #include "GenApi/Types.h"
26 #include "GenApi/GenApiDll.h"
27 
28 #include "MathParserDll.h"
29 #include "StrMap.h"
30 #include "Int64Lexer.h"
31 
32 #include <vector>
33 
34 #ifdef _MSC_VER // *JS*
35 # pragma warning(push)
36 # pragma warning(disable: 4251) // class 'xxx' needs to have dll-interface to be used by clients of class 'yyy'
37 #endif
38 
39 #define ORIGINAL_STACK_SIZE 64
40 
41 extern const double DblErR;
42 
43 
52 {
53  typedef int64_t ( *OneArgFunc ) ( int64_t arg );
54  typedef char* ( *MultiArgFunc ) ( int paramcnt, int64_t* args,
55  CStrMap* strparams, int64_t* result );
56  typedef int ( *PrmSrchFunc ) ( const char* str, size_t len, int64_t* value,
57  void* param );
58  typedef enum
59  {
60  // Binary
61  OP_SHL, OP_SHR, OP_POW,
62  OP_LOGIC_NEQ, OP_LOGIC_GEQ, OP_LOGIC_LEQ,
63  OP_LOGIC_AND, OP_LOGIC_OR, // Logical
64  OP_COMSTART, OP_ASSIGN, // For internal needs
65  OP_OBR, // Special
66  OP_ADD, OP_SUB, OP_MUL, OP_DIV, OP_MOD, OP_UNK, // Arithmetic
67  OP_XOR, OP_NOT, OP_AND, OP_OR, // Bitwise
68  OP_EQU, OP_GREATER, OP_LESS,
69  OP_LOGIC, OP_LOGIC_SEP, OP_CBR, OP_COMMA, // Logical
70  OP_FORMULAEND, // For script
71  OP_INDEX_TO_VAR, OP_FUNC_ONEARG, OP_FUNC_MULTIARG // Special
72  } OperType_t;
73  static const signed char OpPriorities[OP_FUNC_MULTIARG + 1];
74  typedef struct Operation
75  {
76  OperType_t OperType;
77  const void* Func;
78  signed char PrevValTop;
80  explicit Operation() : Func( 0 ), PrevValTop( 0 ), StrParams( 0 ) {}
81  explicit Operation( OperType_t op ) : OperType( op ), Func( 0 ), PrevValTop( 0 ), StrParams( 0 ) {}
82  explicit Operation( OperType_t op, const void* p, signed char a, CStrMap* pM ) : OperType( op ), Func( p ), PrevValTop( a ), StrParams( pM ) {}
83  } Operation;
84  static const Operation BrOp;
85  static const Operation CbrOp;
86  static const Operation NegOp;
87  static const Operation ItvOp;
88  static const Operation CommaOp;
89  std::vector<Operation> OpStack;
90  std::vector<Operation> OpStackEval;
91  std::vector<int64_t> ValStack;
92  std::vector<int64_t> ValStackEval;
93  int OpTop, ValTop;
94  int ObrDist;
99  std::vector<char> errbuf;
100  const char* ParseFormula( bool ConvertUpperCase );
101  const char* PrepareFormula();
102  const char* Calc();
103  const char* CalcToObr();
104 public:
109  CInt64MathParser( void );
110  ~CInt64MathParser();
111  const char* Parse( const char* Formula, bool ConvertUpperCase );
112  const char* Eval( int64_t* result );
113 };
114 
115 #ifdef _MSC_VER // *JS*
116 # pragma warning(pop)
117 #endif
118 
119 #endif // _INT64MATHPARSER_H_
Map for variables in swissknife expression.
Definition: StrMap.h:27
Parser and evaluator for CIntSwissKnife.
CStrMap * ExtFunctions
std::vector< int64_t > ValStack
Common types used in the public GenApi interface.
Operation(OperType_t op, const void *p, signed char a, CStrMap *pM)
static const Operation CbrOp
#define MATHPARSERDLL_API
Definition: MathParserDll.h:46
static const Operation CommaOp
Export Macros.
CInt64Lexer Lexer
__int64 int64_t
Definition: config-win32.h:21
std::vector< char > errbuf
std::vector< Operation > OpStack
static CStaticFuncMapInt64 IntFunctions
std::vector< int64_t > ValStackEval
int(* PrmSrchFunc)(const char *str, size_t len, double *value, void *param)
Definition: MathParser.h:44
static const Operation NegOp
Lexical analyzer for CIntSwissKnife.
Definition: Int64Lexer.h:34
PrmSrchFunc MoreParams
static const Operation ItvOp
static const Operation BrOp
static CSymTable MathSymTable
std::vector< Operation > OpStackEval
declspec&#39;s to be used for GenApi Windows dll
Definition of CStrMap.
const double DblErR
double(* OneArgFunc)(double arg)
Definition: MathParser.h:41
Definition of CInt64Lexer.


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 19:10:54