SeExpr
|
Function Definition, used in parse tree and func table. More...
#include <ExprFunc.h>
Public Types | |
typedef void(*) | Define(const char *name, ExprFunc f) |
typedef void(*) | Define3(const char *name, ExprFunc f, const char *docString) |
Public Member Functions | |
ExprFunc () | |
ExprFunc (ExprFuncX &f, int min=1, int max=1) | |
User defined function with custom argument parsing. | |
ExprFunc (ExprFuncStandard::Func0 *f) | |
ExprFunc (ExprFuncStandard::Func1 *f) | |
ExprFunc (ExprFuncStandard::Func2 *f) | |
ExprFunc (ExprFuncStandard::Func3 *f) | |
ExprFunc (ExprFuncStandard::Func4 *f) | |
ExprFunc (ExprFuncStandard::Func5 *f) | |
ExprFunc (ExprFuncStandard::Func6 *f) | |
ExprFunc (ExprFuncStandard::Funcn *f, int minArgs, int maxArgs) | |
ExprFunc (ExprFuncStandard::Func1v *f) | |
ExprFunc (ExprFuncStandard::Func2v *f) | |
ExprFunc (ExprFuncStandard::Funcnv *f, int minArgs, int maxArgs) | |
ExprFunc (ExprFuncStandard::Func1vv *f) | |
ExprFunc (ExprFuncStandard::Func2vv *f) | |
ExprFunc (ExprFuncStandard::Funcnvv *f) | |
ExprFunc (ExprFuncStandard::Funcnvv *f, int minArgs, int maxArgs) | |
int | minArgs () const |
return the minimum number of acceptable arguments | |
int | maxArgs () const |
return the maximum number of acceptable arguments | |
const ExprFuncX * | funcx () const |
return pointer to the funcx | |
Static Public Member Functions | |
static void | init () |
call to define built-in funcs and load standard plugins | |
static void | cleanup () |
cleanup all functions | |
static void | loadPlugins (const char *path) |
load all plugins in a given path | |
static void | loadPlugin (const char *path) |
load a given plugin | |
static void | define (const char *name, ExprFunc f, const char *docString) |
static void | define (const char *name, ExprFunc f) |
static const ExprFunc * | lookup (const std::string &name) |
Lookup a builtin function by name. | |
static void | getFunctionNames (std::vector< std::string > &names) |
Get a list of registered builtin and DSO generated functions. | |
static std::string | getDocString (const char *functionName) |
Get doc string for a specific function. | |
static size_t | sizeInBytes () |
Get the total size estimate of all plugins. | |
static Statistics | statistics () |
Dump statistics. | |
Static Private Member Functions | |
static void | initInternal () |
Private Attributes | |
ExprFuncStandard | _standardFunc |
ExprFuncX * | _func |
int | _minargs |
int | _maxargs |
Static Private Attributes | |
static std::vector< void * > | dynlib |
Function Definition, used in parse tree and func table.
This class in a static setting manages all builtin functions defined by SeExpr internally or through the use of shared object plugins. These can be queried by name for documentation.
Users can create their own custom functions by creating one of these with the appropriate argument template. Any function that doesn't work within the given templates can be written using a ExprFuncX template instead
Note: If you use the convenience prototypes instead of ExprFuncX, the user defined function will be assumed to be thread safe. If you have a thread unsafe function be sure to use ExprFuncX and call the base constructor with false.
Definition at line 44 of file ExprFunc.h.
Definition at line 64 of file ExprFunc.h.
Definition at line 65 of file ExprFunc.h.
|
inline |
Definition at line 84 of file ExprFunc.h.
|
inline |
User defined function with custom argument parsing.
Definition at line 87 of file ExprFunc.h.
|
inline |
Definition at line 89 of file ExprFunc.h.
|
inline |
Definition at line 91 of file ExprFunc.h.
|
inline |
Definition at line 93 of file ExprFunc.h.
|
inline |
Definition at line 95 of file ExprFunc.h.
|
inline |
Definition at line 97 of file ExprFunc.h.
|
inline |
Definition at line 99 of file ExprFunc.h.
|
inline |
Definition at line 101 of file ExprFunc.h.
|
inline |
Definition at line 103 of file ExprFunc.h.
|
inline |
Definition at line 105 of file ExprFunc.h.
|
inline |
Definition at line 107 of file ExprFunc.h.
|
inline |
Definition at line 109 of file ExprFunc.h.
|
inline |
Definition at line 111 of file ExprFunc.h.
|
inline |
Definition at line 113 of file ExprFunc.h.
|
inline |
Definition at line 115 of file ExprFunc.h.
|
inline |
Definition at line 117 of file ExprFunc.h.
|
static |
cleanup all functions
Definition at line 117 of file ExprFunc.cpp.
References dynlib, and SeExpr2::mutex.
Referenced by main().
|
static |
Definition at line 162 of file ExprFunc.cpp.
References SeExpr2::defineInternal(), f(), initInternal(), SeExprInternal2::DebugLock< T >::lock(), SeExpr2::mutex, and SeExprInternal2::DebugLock< T >::unlock().
|
static |
Definition at line 169 of file ExprFunc.cpp.
References SeExpr2::defineInternal3(), f(), initInternal(), SeExprInternal2::DebugLock< T >::lock(), SeExpr2::mutex, and SeExprInternal2::DebugLock< T >::unlock().
Referenced by SeExpr2::defineInternal(), and main().
|
inline |
return pointer to the funcx
Definition at line 125 of file ExprFunc.h.
References _func, and _standardFunc.
Referenced by SeExpr2::ExprFuncNode::buildInterpreter(), SeExpr2::ExprFuncNode::prep(), and SeExpr2LLVMEvalCustomFunction().
|
static |
Get doc string for a specific function.
Definition at line 183 of file ExprFunc.cpp.
References initInternal(), SeExprInternal2::DebugLock< T >::lock(), SeExpr2::mutex, and SeExprInternal2::DebugLock< T >::unlock().
Referenced by ExprCompletionModel::data(), and ExprCompletionModel::getDocString().
|
static |
Get a list of registered builtin and DSO generated functions.
Definition at line 176 of file ExprFunc.cpp.
References initInternal(), SeExprInternal2::DebugLock< T >::lock(), SeExpr2::mutex, and SeExprInternal2::DebugLock< T >::unlock().
|
static |
call to define built-in funcs and load standard plugins
In addition to initializing all builtins, this loads all plugins given in a a colon delimited SE_EXPR_PLUGINS environment variable
Definition at line 112 of file ExprFunc.cpp.
References initInternal(), and SeExpr2::mutex.
Referenced by SeExpr2::Expression::Expression(), and SeExpr2::Expression::Expression().
|
staticprivate |
Definition at line 150 of file ExprFunc.cpp.
References SeExpr2::defineBuiltins(), SeExpr2::defineInternal(), SeExpr2::defineInternal3(), and loadPlugins().
Referenced by define(), define(), getDocString(), getFunctionNames(), init(), lookup(), sizeInBytes(), and statistics().
|
static |
load a given plugin
Definition at line 252 of file ExprFunc.cpp.
References SeExpr2::defineInternal3(), and dynlib.
Referenced by loadPlugins().
|
static |
load all plugins in a given path
Definition at line 217 of file ExprFunc.cpp.
References loadPlugin(), and SeExpr2::MatchPluginName().
Referenced by initInternal().
|
static |
Lookup a builtin function by name.
Definition at line 130 of file ExprFunc.cpp.
References initInternal(), SeExprInternal2::DebugLock< T >::lock(), lookup(), SeExpr2::mutex, and SeExprInternal2::DebugLock< T >::unlock().
Referenced by lookup(), SeExpr2::ExprFuncNode::prep(), and BasicExpression::resolveFunc().
|
inline |
return the maximum number of acceptable arguments
Definition at line 123 of file ExprFunc.h.
References _maxargs.
Referenced by SeExpr2::ExprFuncNode::prep().
|
inline |
return the minimum number of acceptable arguments
Definition at line 121 of file ExprFunc.h.
References _minargs.
Referenced by SeExpr2::ExprFuncNode::prep().
|
static |
Get the total size estimate of all plugins.
Definition at line 191 of file ExprFunc.cpp.
References initInternal(), and SeExpr2::mutex.
|
static |
Dump statistics.
Definition at line 197 of file ExprFunc.cpp.
References initInternal(), and SeExpr2::mutex.
|
private |
Definition at line 129 of file ExprFunc.h.
Referenced by funcx().
|
private |
Definition at line 131 of file ExprFunc.h.
Referenced by maxArgs().
|
private |
Definition at line 130 of file ExprFunc.h.
Referenced by minArgs().
|
private |
Definition at line 128 of file ExprFunc.h.
Referenced by funcx().
|
staticprivate |
Definition at line 132 of file ExprFunc.h.
Referenced by cleanup(), and loadPlugin().