MADNESS  version 0.9
muParserCallback.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_CALLBACK_H
27 #define MU_PARSER_CALLBACK_H
28 
29 #include "muParserDef.h"
30 
35 namespace mu
36 {
37 
52 {
53 public:
54  ParserCallback(fun_type0 a_pFun, bool a_bAllowOpti);
55  ParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC);
56  ParserCallback(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC);
57  ParserCallback(fun_type3 a_pFun, bool a_bAllowOpti);
58  ParserCallback(fun_type4 a_pFun, bool a_bAllowOpti);
59  ParserCallback(fun_type5 a_pFun, bool a_bAllowOpti);
60  ParserCallback(multfun_type a_pFun, bool a_bAllowOpti);
61  ParserCallback(strfun_type1 a_pFun, bool a_bAllowOpti);
62  ParserCallback(strfun_type2 a_pFun, bool a_bAllowOpti);
63  ParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti);
65  ParserCallback(const ParserCallback &a_Fun);
66 
67  ParserCallback* Clone() const;
68 
69  bool IsOptimizable() const;
70  void* GetAddr() const;
71  ECmdCode GetCode() const;
72  ETypeCode GetType() const;
73  int GetPri() const;
74  int GetArgc() const;
75 
76 private:
77  void *m_pFun;
78 
84  int m_iArgc;
85  int m_iPri;
86  ECmdCode m_iCode;
87  ETypeCode m_iType;
88  bool m_bAllowOpti;
89 };
90 
91 //------------------------------------------------------------------------------
93 typedef std::map<string_type, ParserCallback> funmap_type;
94 
95 } // namespace mu
96 
97 #endif
98 
ParserCallback()
Default constructor.
Definition: muParserCallback.cpp:149
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:288
value_type(* fun_type3)(value_type, value_type, value_type)
Callback type used for functions with three arguments.
Definition: muParserDef.h:270
std::map< string_type, ParserCallback > funmap_type
Container for Callback objects.
Definition: muParserCallback.h:93
const muChar_t muFun0_t a_pFun
Definition: muParserDLL.h:84
ETypeCode GetType() const
Definition: muParserCallback.cpp:218
ECmdCode GetCode() const
Return the callback code.
Definition: muParserCallback.cpp:211
bool IsOptimizable() const
Return tru if the function is conservative.
Definition: muParserCallback.cpp:188
Code for a function item.
Definition: muParserDef.h:179
ParserCallback * Clone() const
Clone this instance and return a pointer to the new instance.
Definition: muParserCallback.cpp:176
value_type(* strfun_type1)(const char_type *)
Callback type used for functions taking a string as an argument.
Definition: muParserDef.h:282
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:285
ETypeCode
Types internally used by the parser.
Definition: muParserDef.h:192
ECmdCode
Bytecode values.
Definition: muParserDef.h:154
Namespace for mathematical applications.
Definition: muParser.cpp:47
value_type(* fun_type0)()
Callback type used for functions without arguments.
Definition: muParserDef.h:261
void * GetAddr() const
Get the callback address for the parser function.
Definition: muParserCallback.cpp:203
value_type(* fun_type4)(value_type, value_type, value_type, value_type)
Callback type used for functions with four arguments.
Definition: muParserDef.h:273
value_type(* fun_type1)(value_type)
Callback type used for functions with a single arguments.
Definition: muParserDef.h:264
int GetArgc() const
Returns the number of function Arguments.
Definition: muParserCallback.cpp:237
value_type(* fun_type5)(value_type, value_type, value_type, value_type, value_type)
Callback type used for functions with five arguments.
Definition: muParserDef.h:276
value_type(* fun_type2)(value_type, value_type)
Callback type used for functions with two arguments.
Definition: muParserDef.h:267
Encapsulation of prototypes for a numerical parser function.
Definition: muParserCallback.h:51
int GetPri() const
Return the operator priority.
Definition: muParserCallback.cpp:229
value_type(* multfun_type)(const value_type *, int)
Callback type used for functions with a variable argument list.
Definition: muParserDef.h:279
This file contains standard definitions used by the parser.