SeExpr
Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
SeExpr2::ExprFunc Class Reference

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. More...
 
 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 More...
 
int maxArgs () const
 return the maximum number of acceptable arguments More...
 
const ExprFuncXfuncx () const
 return pointer to the funcx More...
 

Static Public Member Functions

static void init ()
 call to define built-in funcs and load standard plugins More...
 
static void cleanup ()
 cleanup all functions More...
 
static void loadPlugins (const char *path)
 load all plugins in a given path More...
 
static void loadPlugin (const char *path)
 load a given plugin More...
 
static void define (const char *name, ExprFunc f, const char *docString)
 
static void define (const char *name, ExprFunc f)
 
static const ExprFunclookup (const std::string &name)
 Lookup a builtin function by name. More...
 
static void getFunctionNames (std::vector< std::string > &names)
 Get a list of registered builtin and DSO generated functions. More...
 
static std::string getDocString (const char *functionName)
 Get doc string for a specific function. More...
 
static size_t sizeInBytes ()
 Get the total size estimate of all plugins. More...
 
static Statistics statistics ()
 Dump statistics. More...
 

Static Private Member Functions

static void initInternal ()
 

Private Attributes

ExprFuncStandard _standardFunc
 
ExprFuncX_func
 
int _minargs
 
int _maxargs
 

Detailed Description

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.

Member Typedef Documentation

typedef void(* SeExpr2::ExprFunc::Define)(const char *name, ExprFunc f)

Definition at line 64 of file ExprFunc.h.

typedef void(* SeExpr2::ExprFunc::Define3)(const char *name, ExprFunc f, const char *docString)

Definition at line 65 of file ExprFunc.h.

Constructor & Destructor Documentation

SeExpr2::ExprFunc::ExprFunc ( )
inline

Definition at line 84 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncX f,
int  min = 1,
int  max = 1 
)
inline

User defined function with custom argument parsing.

Definition at line 87 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func0 f)
inline

Definition at line 89 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func1 f)
inline

Definition at line 91 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func2 f)
inline

Definition at line 93 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func3 f)
inline

Definition at line 95 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func4 f)
inline

Definition at line 97 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func5 f)
inline

Definition at line 99 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func6 f)
inline

Definition at line 101 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Funcn f,
int  minArgs,
int  maxArgs 
)
inline

Definition at line 103 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func1v f)
inline

Definition at line 105 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func2v f)
inline

Definition at line 107 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Funcnv f,
int  minArgs,
int  maxArgs 
)
inline

Definition at line 109 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func1vv f)
inline

Definition at line 111 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Func2vv f)
inline

Definition at line 113 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Funcnvv f)
inline

Definition at line 115 of file ExprFunc.h.

SeExpr2::ExprFunc::ExprFunc ( ExprFuncStandard::Funcnvv f,
int  minArgs,
int  maxArgs 
)
inline

Definition at line 117 of file ExprFunc.h.

Member Function Documentation

void SeExpr2::ExprFunc::cleanup ( )
static

cleanup all functions

Definition at line 115 of file ExprFunc.cpp.

References SeExpr2::mutex.

Referenced by main().

void SeExpr2::ExprFunc::define ( const char *  name,
ExprFunc  f,
const char *  docString 
)
static
void SeExpr2::ExprFunc::define ( const char *  name,
ExprFunc  f 
)
static
const ExprFuncX* SeExpr2::ExprFunc::funcx ( ) const
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().

std::string SeExpr2::ExprFunc::getDocString ( const char *  functionName)
static
void SeExpr2::ExprFunc::getFunctionNames ( std::vector< std::string > &  names)
static

Get a list of registered builtin and DSO generated functions.

Definition at line 167 of file ExprFunc.cpp.

References initInternal(), SeExprInternal2::DebugLock< T >::lock(), SeExpr2::mutex, and SeExprInternal2::DebugLock< T >::unlock().

Referenced by ExprCompletionModel::ExprCompletionModel().

void SeExpr2::ExprFunc::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 110 of file ExprFunc.cpp.

References initInternal(), and SeExpr2::mutex.

Referenced by SeExpr2::Expression::Expression().

void SeExpr2::ExprFunc::initInternal ( )
staticprivate
void SeExpr2::ExprFunc::loadPlugin ( const char *  path)
static

load a given plugin

Definition at line 243 of file ExprFunc.cpp.

References SeExpr2::defineInternal3().

Referenced by loadPlugins().

void SeExpr2::ExprFunc::loadPlugins ( const char *  path)
static

load all plugins in a given path

Definition at line 208 of file ExprFunc.cpp.

References loadPlugin(), and SeExpr2::MatchPluginName().

Referenced by initInternal().

const ExprFunc * SeExpr2::ExprFunc::lookup ( const std::string &  name)
static
int SeExpr2::ExprFunc::maxArgs ( ) const
inline

return the maximum number of acceptable arguments

Definition at line 123 of file ExprFunc.h.

References _maxargs.

Referenced by SeExpr2::ExprFuncNode::prep().

int SeExpr2::ExprFunc::minArgs ( ) const
inline

return the minimum number of acceptable arguments

Definition at line 121 of file ExprFunc.h.

References _minargs.

Referenced by SeExpr2::ExprFuncNode::prep().

size_t SeExpr2::ExprFunc::sizeInBytes ( )
static

Get the total size estimate of all plugins.

Definition at line 182 of file ExprFunc.cpp.

References initInternal(), and SeExpr2::mutex.

SeExpr2::Statistics SeExpr2::ExprFunc::statistics ( )
static

Dump statistics.

Definition at line 188 of file ExprFunc.cpp.

References initInternal(), and SeExpr2::mutex.

Member Data Documentation

ExprFuncX* SeExpr2::ExprFunc::_func
private

Definition at line 129 of file ExprFunc.h.

Referenced by funcx().

int SeExpr2::ExprFunc::_maxargs
private

Definition at line 131 of file ExprFunc.h.

Referenced by maxArgs().

int SeExpr2::ExprFunc::_minargs
private

Definition at line 130 of file ExprFunc.h.

Referenced by minArgs().

ExprFuncStandard SeExpr2::ExprFunc::_standardFunc
private

Definition at line 128 of file ExprFunc.h.

Referenced by funcx().


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