NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
muParserCallback.h
Go to the documentation of this file.
1/*
2 __________
3 _____ __ __\______ \_____ _______ ______ ____ _______
4 / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \
5 | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/
6 |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__|
7 \/ \/ \/ \/
8 Copyright (C) 2004-2011 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_CALLBACK_H
27#define MU_PARSER_CALLBACK_H
28
29#include "muParserDef.h"
30
35namespace mu
36{
37
51{
52public:
53 ParserCallback(fun_type0 a_pFun, bool optimizeAway);
54 ParserCallback(fun_type1 a_pFun, bool optimizeAway, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC);
55 ParserCallback(fun_type2 a_pFun, bool optimizeAway, int a_iPrec, EOprtAssociativity a_eAssociativity);
56 ParserCallback(fun_type2 a_pFun, bool optimizeAway);
57 ParserCallback(fun_type3 a_pFun, bool optimizeAway);
58 ParserCallback(fun_type4 a_pFun, bool optimizeAway);
59 ParserCallback(fun_type5 a_pFun, bool optimizeAway);
60 ParserCallback(fun_type6 a_pFun, bool optimizeAway);
61 ParserCallback(fun_type7 a_pFun, bool optimizeAway);
62 ParserCallback(fun_type8 a_pFun, bool optimizeAway);
63 ParserCallback(fun_type9 a_pFun, bool optimizeAway);
64 ParserCallback(fun_type10 a_pFun, bool optimizeAway);
65
66 ParserCallback(bulkfun_type0 a_pFun, bool optimizeAway);
67 ParserCallback(bulkfun_type1 a_pFun, bool optimizeAway);
68 ParserCallback(bulkfun_type2 a_pFun, bool optimizeAway);
69 ParserCallback(bulkfun_type3 a_pFun, bool optimizeAway);
70 ParserCallback(bulkfun_type4 a_pFun, bool optimizeAway);
71 ParserCallback(bulkfun_type5 a_pFun, bool optimizeAway);
72 ParserCallback(bulkfun_type6 a_pFun, bool optimizeAway);
73 ParserCallback(bulkfun_type7 a_pFun, bool optimizeAway);
74 ParserCallback(bulkfun_type8 a_pFun, bool optimizeAway);
75 ParserCallback(bulkfun_type9 a_pFun, bool optimizeAway);
76 ParserCallback(bulkfun_type10 a_pFun, bool optimizeAway);
77
78 ParserCallback(multfun_type a_pFun, bool optimizeAway);
79 ParserCallback(strfun_type1 a_pFun, bool optimizeAway);
80 ParserCallback(strfun_type2 a_pFun, bool optimizeAway);
81 ParserCallback(strfun_type3 a_pFun, bool optimizeAway);
83 ParserCallback(const ParserCallback &a_Fun);
84
85 ParserCallback* Clone() const;
86
87 bool IsOptimizable() const;
88 void* GetAddr() const;
89 ECmdCode GetCode() const;
90 ETypeCode GetType() const;
91 int GetPri() const;
93 int GetArgc() const;
94
95private:
96 void *m_pFun;
97
104 int m_iPri;
109};
110
111//------------------------------------------------------------------------------
113typedef std::map<string_type, ParserCallback> funmap_type;
114
115} // namespace mu
116
117#endif
118
Encapsulation of prototypes for a numerical parser function.
void * m_pFun
Pointer to the callback function, casted to void.
EOprtAssociativity GetAssociativity() const
Return the operators associativity.
ParserCallback * Clone() const
Clone this instance and return a pointer to the new instance.
ParserCallback()
Default constructor.
int m_iPri
Valid only for binary and infix operators; Operator precedence.
int GetArgc() const
Returns the number of function Arguments.
ETypeCode GetType() const
bool m_bAllowOpti
Flag indication optimizeability.
EOprtAssociativity m_eOprtAsct
Operator associativity; Valid only for binary operators.
int GetPri() const
Return the operator precedence.
int m_iArgc
Number of numeric function arguments.
bool IsOptimizable() const
Return tru if the function is conservative.
void * GetAddr() const
Get the callback address for the parser function.
ECmdCode GetCode() const
Return the callback code.
This file contains standard definitions used by the parser.
Namespace for mathematical applications.
Definition: muParser.cpp:53
value_type(* multfun_type)(const value_type *, int)
Callback type used for functions with a variable argument list.
Definition: muParserDef.h:356
value_type(* fun_type9)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
Definition: muParserDef.h:317
value_type(* fun_type6)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
Definition: muParserDef.h:308
value_type(* bulkfun_type6)(int, int, value_type, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
Definition: muParserDef.h:341
value_type(* strfun_type2)(const char_type *, value_type)
Callback type used for functions taking a string and a value as arguments.
Definition: muParserDef.h:362
value_type(* strfun_type3)(const char_type *, value_type, value_type)
Callback type used for functions taking a string and two values as arguments.
Definition: muParserDef.h:365
value_type(* bulkfun_type1)(int, int, value_type)
Callback type used for functions with a single arguments.
Definition: muParserDef.h:326
value_type(* bulkfun_type3)(int, int, value_type, value_type, value_type)
Callback type used for functions with three arguments.
Definition: muParserDef.h:332
value_type(* fun_type10)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
Definition: muParserDef.h:320
value_type(* bulkfun_type9)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
Definition: muParserDef.h:350
value_type(* strfun_type1)(const char_type *)
Callback type used for functions taking a string as an argument.
Definition: muParserDef.h:359
value_type(* bulkfun_type4)(int, int, value_type, value_type, value_type, value_type)
Callback type used for functions with four arguments.
Definition: muParserDef.h:335
value_type(* fun_type2)(const value_type &, const value_type &)
Callback type used for functions with two arguments.
Definition: muParserDef.h:296
value_type(* fun_type7)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
Definition: muParserDef.h:311
value_type(* bulkfun_type5)(int, int, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
Definition: muParserDef.h:338
value_type(* fun_type5)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
Definition: muParserDef.h:305
value_type(* bulkfun_type7)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
Definition: muParserDef.h:344
value_type(* bulkfun_type2)(int, int, value_type, value_type)
Callback type used for functions with two arguments.
Definition: muParserDef.h:329
std::map< string_type, ParserCallback > funmap_type
Container for Callback objects.
value_type(* bulkfun_type8)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
Definition: muParserDef.h:347
value_type(* fun_type1)(const value_type &)
Callback type used for functions with a single arguments.
Definition: muParserDef.h:293
ECmdCode
Bytecode values.
Definition: muParserDef.h:153
@ cmFUNC
Code for a generic function item.
Definition: muParserDef.h:189
ETypeCode
Types internally used by the parser.
Definition: muParserDef.h:204
value_type(* fun_type8)(const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with five arguments.
Definition: muParserDef.h:314
value_type(* bulkfun_type10)(int, int, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
Definition: muParserDef.h:353
value_type(* fun_type4)(const value_type &, const value_type &, const value_type &, const value_type &)
Callback type used for functions with four arguments.
Definition: muParserDef.h:302
value_type(* fun_type0)()
Callback type used for functions without arguments.
Definition: muParserDef.h:290
value_type(* fun_type3)(const value_type &, const value_type &, const value_type &)
Callback type used for functions with three arguments.
Definition: muParserDef.h:299
EOprtAssociativity
Parser operator precedence values.
Definition: muParserDef.h:220
value_type(* bulkfun_type0)(int, int)
Callback type used for functions without arguments.
Definition: muParserDef.h:323