39 funcmap[name] = FuncMapItem(std::string(docString),
f);
41 funcmap[name] = FuncMapItem(name,
f);
45 FuncMap::iterator iter;
46 if ((iter = funcmap.find(name)) != funcmap.end())
return &iter->second.second;
51 void getFunctionNames(std::vector<std::string>& names) {
52 for (FuncMap::iterator i = funcmap.begin(); i != funcmap.end(); ++i) names.push_back(i->first);
55 std::string getDocString(
const char* functionName) {
56 FuncMap::iterator i = funcmap.find(functionName);
57 if (i == funcmap.end())
60 return i->second.first;
63 size_t sizeInBytes()
const {
65 for (FuncMap::const_iterator
it = funcmap.begin();
it != funcmap.end(); ++
it) {
66 totalSize +=
it->first.size() +
sizeof(FuncMapItem);
78 for (FuncMap::const_iterator
it = funcmap.begin();
it != funcmap.end(); ++
it) {
79 totalSize +=
it->first.size() +
sizeof(FuncMapItem);
85 return statisticsDump;
89 typedef std::pair<std::string, SeExpr2::ExprFunc> FuncMapItem;
90 typedef std::map<std::string, FuncMapItem> FuncMap;
94FuncTable* Functions = 0;
158 const char* path =
getenv(
"SE_EXPR_PLUGINS");
205#if defined(__APPLE__) && !defined(__MAC_10_9)
211 const char* name =
dir->d_name;
242 std::cerr <<
"No plugins found matching " << path <<
"/SeExpr*.so" << std::endl;
254 std::cerr <<
"SeExpr: warning Plugins are not supported on windows currently" << std::endl;
258 std::cerr <<
"Error reading expression plugin: " << path << std::endl;
260 if (
err) std::cerr <<
err << std::endl;
271 std::cerr <<
"Error reading expression plugin: " << path << std::endl;
272 std::cerr <<
"No function named SeExpr2PluginInit defined" << std::endl;
Extension function spec, used for complicated argument custom functions.
Function Definition, used in parse tree and func table.
static std::string getDocString(const char *functionName)
Get doc string for a specific function.
static void initInternal()
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
void(* Define3)(const char *name, ExprFunc f, const char *docString)
static void loadPlugin(const char *path)
load a given plugin
const ExprFuncX * funcx() const
return pointer to the funcx
static void cleanup()
cleanup all functions
static void define(const char *name, ExprFunc f, const char *docString)
static const ExprFunc * lookup(const std::string &name)
Lookup a builtin function by name.
static Statistics statistics()
Dump statistics.
static size_t sizeInBytes()
Get the total size estimate of all plugins.
static void getFunctionNames(std::vector< std::string > &names)
Get a list of registered builtin and DSO generated functions.
static std::vector< void * > dynlib
you may not use this file except in compliance with the License and the following modification to it
void defineBuiltins(ExprFunc::Define define, ExprFunc::Define3 define3)
static void defineInternal3(const char *name, ExprFunc f, const char *docString)
std::map< std::string, double > Statistics
static void defineInternal(const char *name, ExprFunc f)
static int MatchPluginName(const struct dirent *dir)
static SeExprInternal2::Mutex mutex
with numParticles numAttributes A variable block contains variable names and types but doesn t care what the values are< pre > void f(const std::string &s, MyParticleData *p, int outputDim=3)