SeExpr

Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Static 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 ExprFuncX * | funcx () 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 ExprFunc * | lookup (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

## Static Private Attributes
static std::vector< void * > | dynlib

## 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

## ◆ Define

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

Definition at line 64 of file ExprFunc.h.

## ◆ Define3

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

Definition at line 65 of file ExprFunc.h.

## Constructor & Destructor Documentation

## ◆ ExprFunc() [1/17]

SeExpr2::ExprFunc::ExprFunc | ( |  | ) |
| inline

Definition at line 84 of file ExprFunc.h.

## ◆ ExprFunc() [2/17]

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.

## ◆ ExprFunc() [3/17]

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

Definition at line 89 of file ExprFunc.h.

## ◆ ExprFunc() [4/17]

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

Definition at line 91 of file ExprFunc.h.

## ◆ ExprFunc() [5/17]

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

Definition at line 93 of file ExprFunc.h.

## ◆ ExprFunc() [6/17]

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

Definition at line 95 of file ExprFunc.h.

## ◆ ExprFunc() [7/17]

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

Definition at line 97 of file ExprFunc.h.

## ◆ ExprFunc() [8/17]

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

Definition at line 99 of file ExprFunc.h.

## ◆ ExprFunc() [9/17]

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

Definition at line 101 of file ExprFunc.h.

## ◆ ExprFunc() [10/17]

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

Definition at line 103 of file ExprFunc.h.

## ◆ ExprFunc() [11/17]

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

Definition at line 105 of file ExprFunc.h.

## ◆ ExprFunc() [12/17]

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

Definition at line 107 of file ExprFunc.h.

## ◆ ExprFunc() [13/17]

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

Definition at line 109 of file ExprFunc.h.

## ◆ ExprFunc() [14/17]

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

Definition at line 111 of file ExprFunc.h.

## ◆ ExprFunc() [15/17]

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

Definition at line 113 of file ExprFunc.h.

## ◆ ExprFunc() [16/17]

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

Definition at line 115 of file ExprFunc.h.

## ◆ ExprFunc() [17/17]

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

Definition at line 117 of file ExprFunc.h.

## Member Function Documentation

## ◆ cleanup()

void SeExpr2::ExprFunc::cleanup | ( |  | ) |
| static

cleanup all functions

Definition at line 117 of file ExprFunc.cpp.

References dynlib, and SeExpr2::mutex.

Referenced by main().

## ◆ define() [1/2]

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

## ◆ define() [2/2]

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

## ◆ funcx()

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().

## ◆ getDocString()

std::string SeExpr2::ExprFunc::getDocString | ( | const char * | functionName | ) |
| 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().

## ◆ getFunctionNames()

void SeExpr2::ExprFunc::getFunctionNames | ( | std::vector< std::string > & | names | ) |
| 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().

Referenced by ExprCompletionModel::ExprCompletionModel().

## ◆ init()

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 112 of file ExprFunc.cpp.

References initInternal(), and SeExpr2::mutex.

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

## ◆ initInternal()

void SeExpr2::ExprFunc::initInternal | ( |  | ) |
| static private

Definition at line 150 of file ExprFunc.cpp.

References SeExpr2::defineBuiltins(), SeExpr2::defineInternal(), SeExpr2::defineInternal3(), and loadPlugins().

Referenced by define(), getDocString(), getFunctionNames(), init(), lookup(), sizeInBytes(), and statistics().

## ◆ loadPlugin()

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

load a given plugin

Definition at line 252 of file ExprFunc.cpp.

References SeExpr2::defineInternal3(), and dynlib.

Referenced by loadPlugins().

## ◆ loadPlugins()

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

load all plugins in a given path

Definition at line 217 of file ExprFunc.cpp.

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

Referenced by initInternal().

## ◆ lookup()

const ExprFunc * SeExpr2::ExprFunc::lookup | ( | const std::string & | name | ) |
| 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().

## ◆ maxArgs()

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().

## ◆ minArgs()

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().

## ◆ sizeInBytes()

size_t SeExpr2::ExprFunc::sizeInBytes | ( |  | ) |
| static

Get the total size estimate of all plugins.

Definition at line 191 of file ExprFunc.cpp.

References initInternal(), and SeExpr2::mutex.

## ◆ statistics()

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

Dump statistics.

Definition at line 197 of file ExprFunc.cpp.

References initInternal(), and SeExpr2::mutex.

## Member Data Documentation

## ◆ _func

ExprFuncX* SeExpr2::ExprFunc::_func
| private

Definition at line 129 of file ExprFunc.h.

Referenced by funcx().

## ◆ _maxargs

int SeExpr2::ExprFunc::_maxargs
| private

Definition at line 131 of file ExprFunc.h.

Referenced by maxArgs().

## ◆ _minargs

int SeExpr2::ExprFunc::_minargs
| private

Definition at line 130 of file ExprFunc.h.

Referenced by minArgs().

## ◆ _standardFunc

ExprFuncStandard SeExpr2::ExprFunc::_standardFunc
| private

Definition at line 128 of file ExprFunc.h.

Referenced by funcx().

## ◆ dynlib

std::vector< void * > SeExpr2::ExprFunc::dynlib
| static private

Definition at line 132 of file ExprFunc.h.

Referenced by cleanup(), and loadPlugin().

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

- /build/seexpr/src/SeExpr/src/SeExpr2/ExprFunc.h
- /build/seexpr/src/SeExpr/src/SeExpr2/ExprFunc.cpp