![]() |
GemaLuaCoreLib
The GeMA Lua Core library
|
Declaration of utilitary functions for working with Lua. More...
#include "gmLuaEnv.h"
#include <luaEnv.h>
#include <luaTable.h>
#include <gmVector.h>
#include <gmModelData.h>
#include <gmTaskManager.h>
#include <gmCellGroupSet.h>
#include <gmLuaCellGroupSet.h>
#include <gmTrace.h>
#include <assert.h>
#include <luaProxy.h>
Go to the source code of this file.
Namespaces | |
GmLuaUtils | |
Groups utilitary routines for working with Lua. | |
Functions | |
void | GmLuaUtils::fillVectorFromLua (lua_State *L, int stackPos, QString fname, GmVector &v) |
Resizes and fills the vector v to receive the data stored in a lua table. | |
void | GmLuaUtils::checkAndLoadIntOption (LuaTable &optionsTable, const char *fieldName, int *option) |
An auxiliary function used to check the existance and validity of an integer option. If the field doesn't exists, does nothing (keep default value). Otherwise, if the field is an integer, fills option with its value. Otherwise (invalid value), raises an error. | |
void | GmLuaUtils::checkAndLoadUnsignedOption (LuaTable &optionsTable, const char *fieldName, unsigned *option) |
An auxiliary function used to check the existance and validity of a unsigned integer option. If the field doesn't exists, does nothing (keep default value). Otherwise, if the field is an unsigned, fills option with its value. Otherwise (invalid value), raises an error. | |
void | GmLuaUtils::checkAndLoadDoubleOption (LuaTable &optionsTable, const char *fieldName, double *option) |
An auxiliary function used to check the existance and validity of a double option. If the field doesn't exists, does nothing (keep default value). Otherwise, if the field is a number, fills option with its value. Otherwise (invalid value), raises an error. | |
void | GmLuaUtils::checkAndLoadTaskOptions (LuaTable &optionsTable, int *nworkers, int *ntasks, GmTaskManager::NodePartitionStrategy *nodeStrategy, GmTaskManager::CellPartitionStrategy *cellStrategy) |
An auxiliary function used to load task manager options from optionsTable, filling nworkers, ntasks, nodeStrategy and cellStrategy. If any of the parameters is NULL, the option will be ignored. More... | |
int | GmLuaUtils::stringOptionIndex (QString value, const char **optionNames, lua_State *L, const char *fieldName) |
Looks for value in optionNames. If found returns the index. If not found raises a lua error for field fieldName. | |
template<class T , class M > | |
void | GmLuaUtils::checkAndLoadStringOption (LuaTable &optionsTable, const char *fieldName, const char **optionNames, T *optionsObj, M method) |
An auxiliary function to check the existance and validity of a string option. If the field given by "fieldName" doesn't exists in optionsTable, does nothing (keep default value). Otherwise, if the field is a known string (exists in the NULL terminated array pointed by optionNames), fills option with its value by calling the given method from optionsObj. The method must be a function that receives as parameter the index of the option on optionNames and sets it on the object (possibly converting the index into an enumerated value). If the value is not known, raises an error (including information about the avialable options). | |
template<class T , class P > | |
T * | GmLuaUtils::parseMesh (lua_State *L, int index, const GmModelData *mdata, QString fname) |
Auxiliary routine to help processes that can accept from the Lua stack either a mesh object or a mesh name as a parameter to grab the corresponding mesh object. More... | |
template<class T , class P > | |
void | GmLuaUtils::parseMeshOrGroup (lua_State *L, int index, const GmModelData *mdata, QString fname, T **mesh, GmCellGroupSet **group) |
Auxiliary routine to help processes that can accept from the Lua stack either a mesh object, a mesh name or a cell group objecct as a parameter to grab the corresponding mesh and group objects. More... | |
template<const char * typeName> | |
void | GmLuaUtils::pushGroupDumpItemProxy (lua_State *L, GmGroupDumpItem *ptr) |
Pushes a pointer inheriting from GmGroupDumpItem as a Lua proxy. The pointer will be deleted when the returned Lua proxy is GCed. More... | |
template<class T > | |
T * | GmLuaUtils::getGroupDumpItemPtr (lua_State *L, int pos, QString tmsg, QString fmsg) |
Returns the parameter at Lua stack position 'pos' as a T*. More... | |
Declaration of utilitary functions for working with Lua.