Function Definition, used in parse tree and func table. More...
#include <SeExprFunc.h>
Public Types | |
enum | FuncType { NONE = 0, FUNC0, FUNC1, FUNC2, FUNC3, FUNC4, FUNC5, FUNC6, FUNCN, VEC, FUNC1V = VEC, FUNC2V, FUNCNV, VECVEC, FUNC1VV = VECVEC, FUNC2VV, FUNCNVV, FUNCX } |
typedef void(* | Define )(const char *name, SeExprFunc f) |
typedef void(* | Define3 )(const char *name, SeExprFunc f, const char *docString) |
typedef double | Func0 () |
typedef double | Func1 (double) |
typedef double | Func2 (double, double) |
typedef double | Func3 (double, double, double) |
typedef double | Func4 (double, double, double, double) |
typedef double | Func5 (double, double, double, double, double) |
typedef double | Func6 (double, double, double, double, double, double) |
typedef double | Func1v (const SeVec3d &) |
typedef double | Func2v (const SeVec3d &, const SeVec3d &) |
typedef SeVec3d | Func1vv (const SeVec3d &) |
typedef SeVec3d | Func2vv (const SeVec3d &, const SeVec3d &) |
typedef double | Funcn (int n, double *params) |
typedef double | Funcnv (int n, const SeVec3d *params) |
typedef SeVec3d | Funcnvv (int n, const SeVec3d *params) |
Public Member Functions | |
bool | hasVecArgs () const |
bool | isVec () const |
SeExprFunc () | |
SeExprFunc (Func0 *f) | |
No argument function. | |
SeExprFunc (Func1 *f) | |
User defined function with prototype double f(double). | |
SeExprFunc (Func2 *f) | |
User defined function with prototype double f(double,double). | |
SeExprFunc (Func3 *f) | |
User defined function with prototype double f(double,double,double). | |
SeExprFunc (Func4 *f) | |
User defined function with prototype double f(double,double,double,double). | |
SeExprFunc (Func5 *f) | |
User defined function with prototype double f(double,double,double,double,double). | |
SeExprFunc (Func6 *f) | |
User defined function with prototype double f(double,double,double,double,double,double). | |
SeExprFunc (Func1v *f) | |
User defined function with prototype double f(vector). | |
SeExprFunc (Func2v *f) | |
User defined function with prototype double f(vector,vector). | |
SeExprFunc (Func1vv *f) | |
User defined function with prototype vector f(vector). | |
SeExprFunc (Func2vv *f) | |
User defined function with prototype vector f(vector,vector). | |
SeExprFunc (Funcn *f, int minargs, int maxargs) | |
User defined function with arbitrary number of arguments double f(double,...). | |
SeExprFunc (Funcnv *f, int minargs, int maxargs) | |
User defined function with arbitrary number of arguments double f(vector,...). | |
SeExprFunc (Funcnvv *f, int minargs, int maxargs) | |
User defined function with arbitrary number of arguments vector f(vector,...). | |
SeExprFunc (SeExprFuncX &f, int minargs=1, int maxargs=1) | |
User defined function with custom argument parsing. | |
int | type () const |
int | minArgs () const |
int | maxArgs () const |
Func0 * | func0 () const |
Func1 * | func1 () const |
Func2 * | func2 () const |
Func3 * | func3 () const |
Func4 * | func4 () const |
Func5 * | func5 () const |
Func6 * | func6 () const |
Func1v * | func1v () const |
Func2v * | func2v () const |
Func1vv * | func1vv () const |
Func2vv * | func2vv () const |
Funcn * | funcn () const |
Funcnv * | funcnv () const |
Funcnvv * | funcnvv () const |
SeExprFuncX * | funcx () const |
Static Public Member Functions | |
static void | init () |
call to define built-in funcs and load standard plugins | |
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, SeExprFunc f, const char *docString) |
static void | define (const char *name, SeExprFunc f) |
static const SeExprFunc * | 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. | |
Private Attributes | |
FuncType | _type |
void * | _func |
int | _minargs |
int | _maxargs |
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 SeExprFuncX template instead
Note: If you use the convenience prototypes instead of SeExprFuncX, the user defined function will be assumed to be thread safe. If you have a thread unsafe function be sure to use SeExprFuncX and call the base constructor with false.
Definition at line 63 of file SeExprFunc.h.
typedef void(* SeExprFunc::Define)(const char *name, SeExprFunc f) |
Definition at line 80 of file SeExprFunc.h.
typedef void(* SeExprFunc::Define3)(const char *name, SeExprFunc f, const char *docString) |
Definition at line 81 of file SeExprFunc.h.
typedef double SeExprFunc::Func0() |
Definition at line 92 of file SeExprFunc.h.
typedef double SeExprFunc::Func1(double) |
Definition at line 93 of file SeExprFunc.h.
typedef double SeExprFunc::Func1v(const SeVec3d &) |
Definition at line 99 of file SeExprFunc.h.
typedef SeVec3d SeExprFunc::Func1vv(const SeVec3d &) |
Definition at line 101 of file SeExprFunc.h.
typedef double SeExprFunc::Func2(double, double) |
Definition at line 94 of file SeExprFunc.h.
typedef double SeExprFunc::Func2v(const SeVec3d &, const SeVec3d &) |
Definition at line 100 of file SeExprFunc.h.
typedef SeVec3d SeExprFunc::Func2vv(const SeVec3d &, const SeVec3d &) |
Definition at line 102 of file SeExprFunc.h.
typedef double SeExprFunc::Func3(double, double, double) |
Definition at line 95 of file SeExprFunc.h.
typedef double SeExprFunc::Func4(double, double, double, double) |
Definition at line 96 of file SeExprFunc.h.
typedef double SeExprFunc::Func5(double, double, double, double, double) |
Definition at line 97 of file SeExprFunc.h.
typedef double SeExprFunc::Func6(double, double, double, double, double, double) |
Definition at line 98 of file SeExprFunc.h.
typedef double SeExprFunc::Funcn(int n, double *params) |
Definition at line 103 of file SeExprFunc.h.
typedef double SeExprFunc::Funcnv(int n, const SeVec3d *params) |
Definition at line 104 of file SeExprFunc.h.
typedef SeVec3d SeExprFunc::Funcnvv(int n, const SeVec3d *params) |
Definition at line 105 of file SeExprFunc.h.
enum SeExprFunc::FuncType |
NONE | |
FUNC0 | |
FUNC1 | |
FUNC2 | |
FUNC3 | |
FUNC4 | |
FUNC5 | |
FUNC6 | |
FUNCN | |
VEC | |
FUNC1V | |
FUNC2V | |
FUNCNV | |
VECVEC | |
FUNC1VV | |
FUNC2VV | |
FUNCNVV | |
FUNCX |
Definition at line 107 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | ) | [inline] |
Definition at line 121 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func0 * | f | ) | [inline] |
No argument function.
Definition at line 124 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func1 * | f | ) | [inline] |
User defined function with prototype double f(double).
Definition at line 126 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func2 * | f | ) | [inline] |
User defined function with prototype double f(double,double).
Definition at line 128 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func3 * | f | ) | [inline] |
User defined function with prototype double f(double,double,double).
Definition at line 130 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func4 * | f | ) | [inline] |
User defined function with prototype double f(double,double,double,double).
Definition at line 132 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func5 * | f | ) | [inline] |
User defined function with prototype double f(double,double,double,double,double).
Definition at line 134 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func6 * | f | ) | [inline] |
User defined function with prototype double f(double,double,double,double,double,double).
Definition at line 136 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func1v * | f | ) | [inline] |
User defined function with prototype double f(vector).
Definition at line 138 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func2v * | f | ) | [inline] |
User defined function with prototype double f(vector,vector).
Definition at line 140 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func1vv * | f | ) | [inline] |
User defined function with prototype vector f(vector).
Definition at line 142 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Func2vv * | f | ) | [inline] |
User defined function with prototype vector f(vector,vector).
Definition at line 144 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Funcn * | f, | |
int | minargs, | |||
int | maxargs | |||
) | [inline] |
User defined function with arbitrary number of arguments double f(double,...).
Definition at line 146 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Funcnv * | f, | |
int | minargs, | |||
int | maxargs | |||
) | [inline] |
User defined function with arbitrary number of arguments double f(vector,...).
Definition at line 149 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | Funcnvv * | f, | |
int | minargs, | |||
int | maxargs | |||
) | [inline] |
User defined function with arbitrary number of arguments vector f(vector,...).
Definition at line 152 of file SeExprFunc.h.
SeExprFunc::SeExprFunc | ( | SeExprFuncX & | f, | |
int | minargs = 1 , |
|||
int | maxargs = 1 | |||
) | [inline] |
User defined function with custom argument parsing.
Definition at line 155 of file SeExprFunc.h.
void SeExprFunc::define | ( | const char * | name, | |
SeExprFunc | f | |||
) | [static] |
Definition at line 148 of file SeExprFunc.cpp.
References SeExprInternal::DebugLock< T >::lock(), and SeExprInternal::DebugLock< T >::unlock().
void SeExprFunc::define | ( | const char * | name, | |
SeExprFunc | f, | |||
const char * | docString | |||
) | [static] |
Definition at line 157 of file SeExprFunc.cpp.
References SeExprInternal::DebugLock< T >::lock(), and SeExprInternal::DebugLock< T >::unlock().
Func0* SeExprFunc::func0 | ( | ) | const [inline] |
Definition at line 161 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Func1* SeExprFunc::func1 | ( | ) | const [inline] |
Definition at line 162 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Func1v* SeExprFunc::func1v | ( | ) | const [inline] |
Definition at line 168 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Func1vv* SeExprFunc::func1vv | ( | ) | const [inline] |
Definition at line 170 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Func2* SeExprFunc::func2 | ( | ) | const [inline] |
Definition at line 163 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Func2v* SeExprFunc::func2v | ( | ) | const [inline] |
Definition at line 169 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Func2vv* SeExprFunc::func2vv | ( | ) | const [inline] |
Definition at line 171 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Func3* SeExprFunc::func3 | ( | ) | const [inline] |
Definition at line 164 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Func4* SeExprFunc::func4 | ( | ) | const [inline] |
Definition at line 165 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Func5* SeExprFunc::func5 | ( | ) | const [inline] |
Definition at line 166 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Func6* SeExprFunc::func6 | ( | ) | const [inline] |
Definition at line 167 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Funcn* SeExprFunc::funcn | ( | ) | const [inline] |
Definition at line 172 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Funcnv* SeExprFunc::funcnv | ( | ) | const [inline] |
Definition at line 173 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
Funcnvv* SeExprFunc::funcnvv | ( | ) | const [inline] |
Definition at line 174 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval().
SeExprFuncX* SeExprFunc::funcx | ( | ) | const [inline] |
Definition at line 175 of file SeExprFunc.h.
References _func.
Referenced by SeExprFuncNode::eval(), and SeExprFuncNode::prep().
std::string SeExprFunc::getDocString | ( | const char * | functionName | ) | [static] |
Get doc string for a specific function.
Definition at line 175 of file SeExprFunc.cpp.
References SeExprInternal::DebugLock< T >::lock(), and SeExprInternal::DebugLock< T >::unlock().
Referenced by SeExprEdCompletionModel::data().
void SeExprFunc::getFunctionNames | ( | std::vector< std::string > & | names | ) | [static] |
Get a list of registered builtin and DSO generated functions.
Definition at line 166 of file SeExprFunc.cpp.
References SeExprInternal::DebugLock< T >::lock(), and SeExprInternal::DebugLock< T >::unlock().
Referenced by SeExprEdCompletionModel::SeExprEdCompletionModel().
bool SeExprFunc::hasVecArgs | ( | ) | const [inline] |
Definition at line 118 of file SeExprFunc.h.
Referenced by SeExprFuncNode::prep().
void SeExprFunc::init | ( | ) | [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 130 of file SeExprFunc.cpp.
Referenced by SeExpression::SeExpression().
bool SeExprFunc::isVec | ( | ) | const [inline] |
Definition at line 119 of file SeExprFunc.h.
Referenced by SeExprFuncNode::eval(), and SeExprFuncNode::prep().
void SeExprFunc::loadPlugin | ( | const char * | path | ) | [static] |
void SeExprFunc::loadPlugins | ( | const char * | path | ) | [static] |
load all plugins in a given path
Definition at line 202 of file SeExprFunc.cpp.
References loadPlugin(), and MatchPluginName().
const SeExprFunc * SeExprFunc::lookup | ( | const std::string & | name | ) | [static] |
Lookup a builtin function by name.
Definition at line 137 of file SeExprFunc.cpp.
References SeExprInternal::DebugLock< T >::lock(), and SeExprInternal::DebugLock< T >::unlock().
Referenced by SeExprFuncNode::prep(), and SeExprEdExpression::resolveFunc().
int SeExprFunc::maxArgs | ( | ) | const [inline] |
Definition at line 160 of file SeExprFunc.h.
References _maxargs.
Referenced by SeExprFuncNode::prep().
int SeExprFunc::minArgs | ( | ) | const [inline] |
Definition at line 159 of file SeExprFunc.h.
References _minargs.
int SeExprFunc::type | ( | ) | const [inline] |
Definition at line 158 of file SeExprFunc.h.
References _type.
Referenced by SeExprFuncNode::eval(), and SeExprFuncNode::prep().
void* SeExprFunc::_func [private] |
int SeExprFunc::_maxargs [private] |
Definition at line 181 of file SeExprFunc.h.
Referenced by maxArgs().
int SeExprFunc::_minargs [private] |
Definition at line 180 of file SeExprFunc.h.
Referenced by minArgs().
FuncType SeExprFunc::_type [private] |
Definition at line 178 of file SeExprFunc.h.
Referenced by hasVecArgs(), isVec(), and type().