muParser API -  1.35
Public Member Functions | List of all members
mu::ParserCallback Class Referencefinal

Encapsulation of prototypes for a numerical parser function. More...

#include <muParserCallback.h>

Public Member Functions

 ParserCallback (fun_type0 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec, ECmdCode a_iCode)
 
 ParserCallback (fun_type1 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eAssociativity)
 Constructor for constructing binary operator callbacks. More...
 
 ParserCallback (fun_type2 a_pFun, bool a_bAllowOpti)
 Constructor for constructing function callbacks taking two arguments. More...
 
 ParserCallback (fun_type3 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (fun_type4 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (fun_type5 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (fun_type6 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (fun_type7 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (fun_type8 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (fun_type9 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (fun_type10 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_type0 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_type1 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_type2 a_pFun, bool a_bAllowOpti)
 Constructor for constructing function callbacks taking two arguments. More...
 
 ParserCallback (bulkfun_type3 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_type4 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_type5 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_type6 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_type7 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_type8 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_type9 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_type10 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (multfun_type a_pFun, bool a_bAllowOpti)
 
 ParserCallback (strfun_type1 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (strfun_type2 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (strfun_type3 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (strfun_type4 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (strfun_type5 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (strfun_type6 a_pFun, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type0 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type1 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type2 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type3 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type4 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type5 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type6 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type7 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type8 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type9 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (fun_userdata_type10 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type0 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type1 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type2 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type3 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type4 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type5 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type6 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type7 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type8 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type9 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (bulkfun_userdata_type10 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (multfun_userdata_type a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (strfun_userdata_type1 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (strfun_userdata_type2 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (strfun_userdata_type3 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (strfun_userdata_type4 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (strfun_userdata_type5 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback (strfun_userdata_type6 a_pFun, void *a_pUserData, bool a_bAllowOpti)
 
 ParserCallback ()
 Default constructor. More...
 
 ParserCallback (const ParserCallback &a_Fun)
 Copy constructor. More...
 
ParserCallbackoperator= (const ParserCallback &a_Fun)
 
ParserCallbackClone () const
 Clone this instance and return a pointer to the new instance.
 
bool IsOptimizable () const
 Return tru if the function is conservative. More...
 
bool IsValid () const
 Check that the callback looks valid. More...
 
void * GetAddr () const
 Get the callback address for the parser function. More...
 
void * GetUserData () const
 Get the user data if present, else nullptr. More...
 
ECmdCode GetCode () const
 Return the callback code.
 
ETypeCode GetType () const
 
int GetPri () const
 Return the operator precedence. More...
 
EOprtAssociativity GetAssociativity () const
 Return the operators associativity. More...
 
int GetArgc () const
 Returns the number of numeric function Arguments. More...
 

Detailed Description

Encapsulation of prototypes for a numerical parser function.

Encapsulates the prototyp for numerical parser functions. The class stores the number of arguments for parser functions as well as additional flags indication the function is non optimizeable. The pointer to the callback function pointer is stored as void* and needs to be casted according to the argument count. Negative argument counts indicate a parser function with a variable number of arguments.

Definition at line 52 of file muParserCallback.h.

Constructor & Destructor Documentation

mu::ParserCallback::ParserCallback ( fun_type2  a_pFun,
bool  a_bAllowOpti,
int  a_iPrec,
EOprtAssociativity  a_eOprtAsct 
)

Constructor for constructing binary operator callbacks.

Parameters
a_pFunPointer to a static function taking two arguments
a_bAllowOptiA flag indicating this function can be optimized
a_iPrecThe operator precedence
a_eOprtAsctThe operators associativity
Exceptions
nothrow

Definition at line 102 of file muParserCallback.cpp.

106  :m_pFun((void*)a_pFun)
107  , m_iArgc(2)
108  , m_iPri(a_iPrec)
109  , m_eOprtAsct(a_eOprtAsct)
110  , m_iCode(cmOPRT_BIN)
111  , m_iType(tpDBL)
112  , m_bAllowOpti(a_bAllowOpti)
113  {}
user defined binary operator
Definition: muParserDef.h:174
Floating point variables.
Definition: muParserDef.h:186
mu::ParserCallback::ParserCallback ( fun_type2  a_pFun,
bool  a_bAllowOpti 
)

Constructor for constructing function callbacks taking two arguments.

Exceptions
nothrow

Definition at line 84 of file muParserCallback.cpp.

85  :m_pFun((void*)a_pFun)
86  , m_iArgc(2)
87  , m_iPri(-1)
88  , m_eOprtAsct(oaNONE)
89  , m_iCode(cmFUNC)
90  , m_iType(tpDBL)
91  , m_bAllowOpti(a_bAllowOpti)
92  {}
Code for a generic function item.
Definition: muParserDef.h:170
Floating point variables.
Definition: muParserDef.h:186
mu::ParserCallback::ParserCallback ( bulkfun_type2  a_pFun,
bool  a_bAllowOpti 
)

Constructor for constructing function callbacks taking two arguments.

Exceptions
nothrow

Definition at line 350 of file muParserCallback.cpp.

351  :m_pFun((void*)a_pFun)
352  , m_iArgc(2)
353  , m_iPri(-1)
354  , m_eOprtAsct(oaNONE)
355  , m_iCode(cmFUNC_BULK)
356  , m_iType(tpDBL)
357  , m_bAllowOpti(a_bAllowOpti)
358  {}
Special callbacks for Bulk mode with an additional parameter for the bulk index.
Definition: muParserDef.h:172
Floating point variables.
Definition: muParserDef.h:186
mu::ParserCallback::ParserCallback ( )

Default constructor.

Exceptions
nothrow

Definition at line 725 of file muParserCallback.cpp.

Referenced by Clone().

726  :m_pFun(0)
727  , m_iArgc(0)
728  , m_iPri(-1)
729  , m_eOprtAsct(oaNONE)
730  , m_iCode(cmUNKNOWN)
731  , m_iType(tpVOID)
732  , m_bAllowOpti(0)
733  {}
Undefined type.
Definition: muParserDef.h:187
uninitialized item
Definition: muParserDef.h:178
mu::ParserCallback::ParserCallback ( const ParserCallback ref)

Copy constructor.

Exceptions
nothrow

Definition at line 739 of file muParserCallback.cpp.

740  :ParserCallback()
741  {
742  Assign(ref);
743  }
ParserCallback()
Default constructor.

Member Function Documentation

void * mu::ParserCallback::GetAddr ( ) const

Get the callback address for the parser function.

The type of the address is void. It needs to be recasted according to the argument number to the right type.

Exceptions
nothrow

Definition at line 811 of file muParserCallback.cpp.

Referenced by IsValid().

812  {
813  if (m_iArgc & CALLBACK_INTERNAL_WITH_USER_DATA)
814  return reinterpret_cast<CbWithUserData*>(m_pFun)->pFun;
815  else
816  return m_pFun;
817  }
int mu::ParserCallback::GetArgc ( ) const

Returns the number of numeric function Arguments.

This number is negative for functions with variable number of arguments.

Definition at line 886 of file muParserCallback.cpp.

887  {
888  return (m_iArgc & CALLBACK_INTERNAL_VAR_ARGS) ? -1 : (m_iArgc & CALLBACK_INTERNAL_FIXED_ARGS_MASK);
889  }
EOprtAssociativity mu::ParserCallback::GetAssociativity ( ) const

Return the operators associativity.

Exceptions
nothrownOnly valid if the callback token is a binary operator token.

Definition at line 876 of file muParserCallback.cpp.

877  {
878  return m_eOprtAsct;
879  }
int mu::ParserCallback::GetPri ( ) const

Return the operator precedence.

Exceptions
nothrownOnly valid if the callback token is an operator token (binary or infix).

Definition at line 865 of file muParserCallback.cpp.

866  {
867  return m_iPri;
868  }
void * mu::ParserCallback::GetUserData ( ) const

Get the user data if present, else nullptr.

Exceptions
nothrow

Definition at line 824 of file muParserCallback.cpp.

Referenced by IsValid().

825  {
826  if (m_iArgc & CALLBACK_INTERNAL_WITH_USER_DATA)
827  return reinterpret_cast<CbWithUserData*>(m_pFun)->pUserData;
828  else
829  return nullptr;
830  }
bool mu::ParserCallback::IsOptimizable ( ) const

Return tru if the function is conservative.

Conservative functions return always the same result for the same argument.

Exceptions
nothrow

Definition at line 798 of file muParserCallback.cpp.

799  {
800  return m_bAllowOpti;
801  }
bool mu::ParserCallback::IsValid ( ) const

Check that the callback looks valid.

Exceptions
nothrowCheck that the function pointer is not null, and if there are user data that they are not null.

Definition at line 839 of file muParserCallback.cpp.

Referenced by mu::ParserToken< value_type, string_type >::Set().

840  {
841  return GetAddr() != nullptr
842  && !((m_iArgc & CALLBACK_INTERNAL_WITH_USER_DATA)
843  && GetUserData() == nullptr);
844  }
void * GetAddr() const
Get the callback address for the parser function.
void * GetUserData() const
Get the user data if present, else nullptr.

The documentation for this class was generated from the following files: