|
#include <lbp_function.h>
|
| LuaFunction (const LuaFunctionDefinition *fdef) |
|
| ~LuaFunction (void) |
|
virtual LuaFunction * | New () const |
|
void | Definition (const FunctionDefinition *fdef) |
|
const LuaFunctionDefinition * | Definition (void) const |
|
void | SyntaxCheck (void) |
|
void | Evaluate (void) |
|
void | L (LuaState *l) |
|
LuaState * | L (void) |
|
| Function (const FunctionDefinition *fdef) |
|
| ~Function () |
|
const FunctionDefinition * | Definition (void) const |
|
int | VariantsSize (void) const |
|
void | Variant (int n) |
|
void | Variant (const std::string &rVariantName) |
|
const Signature * | Variant (void) const |
|
int | ParamsSize (void) const |
|
void | ParamValue (int n, Type *param) |
|
Type * | ParamValue (int n) const |
|
void | AllocateValues (void) |
|
void | AllocateValue (int i) |
|
void | FreeValues (void) |
|
bool | TypeCheck (int n) |
|
bool | TypeCheck (void) |
|
void | Execute (void) |
|
Type & | operator= (const Type &rSrc) |
|
| Type (void) |
|
| Type (const Type &rType) |
|
virtual | ~Type (void) |
|
virtual Type * | Copy (void) const |
|
virtual const Type * | Cast (const Type *pOther) const |
|
virtual void | Clear (void) |
|
virtual Type & | Assign (const Type &rSrc) |
|
Type & | operator= (const Type &rSrc) |
|
virtual bool | Equal (const Type &rOther) const |
|
bool | operator== (const Type &rOther) const |
|
bool | operator!= (const Type &rOther) const |
|
virtual void | Name (const std::string &rName) |
|
virtual const std::string & | Name (void) const |
|
virtual const std::string & | TypeName (void) const |
|
void | Write (const Type *pContext=0) const |
|
void | Write (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const |
|
void | Write (const std::string &pFileName, std::ios::openmode openmode) const |
|
void | Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
|
virtual void | XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const |
|
void | XWrite (const Type *pContext=0) const |
|
void | XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
|
std::string | ToString (const std::string &rLabel="", const Type *pContext=0) const |
|
std::string | ToText (const std::string &rLabel="", const Type *pContext=0) const |
|
void | DWrite (const Type *pContext=0) const |
|
void | DWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const |
|
void | DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
|
void | SWrite (TokenWriter &rTw) const |
|
void | SWrite (void) const |
|
std::string | ToSText (void) const |
|
void | Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0) |
|
void | FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0) |
|
void | Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
|
|
virtual void | DoVariant (int n) |
|
virtual bool | DoTypeCheck (int n) |
|
virtual void | DoExecute () |
|
virtual void | DoExecuteA () |
|
virtual void | DoExecuteB () |
|
virtual void | DoExecuteC () |
|
virtual void | DoExecuteD () |
|
virtual void | DoExecuteE () |
|
template<class T > |
bool | DoTypeCast (int n, T *&rTypedRef) |
|
void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
|
void | DoAssign (const Type &rSrc) |
|
bool | DoEqual (const Type &rOther) const |
|
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
|
virtual void | DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
|
virtual void | DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
|
virtual void | DoSWrite (TokenWriter &rTw) const |
|
virtual const TypeDefinition * | TypeDefinitionp (void) const |
|
virtual Token | XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const |
|
A LuaFunction is a faudes-function that executes a luafaudes script.
LuaFunction is derived from Function and implements the DoTypeCheck and DoExecute interface to run the lua code as supplied by the corresponding function defintion. Thus, it is considered an error to set the function definition to an object that does not cast to a LuaFunctionDefinition.
Definition at line 677 of file lbp_function.h.
◆ LuaFunction()
Constructor. For the function to be operational, a valid reference to the corresponding LuaFunctionDefinition is required. The only exception is the prototype function object used in the LuaFunctionDefinition itself.
◆ ~LuaFunction()
faudes::LuaFunction::~LuaFunction |
( |
void |
| ) |
|
|
inline |
◆ Definition() [1/2]
Set function definition. Normally, functions are provided with a function definition on construction. The only exception are prototype objects used in function definitions themselfs and in the function registry.
- Parameters
-
Reimplemented from faudes::Function.
◆ Definition() [2/2]
Get function definition.
- Returns
- Function definition used by this function.
◆ DoExecute()
virtual void faudes::LuaFunction::DoExecute |
( |
| ) |
|
|
protectedvirtual |
◆ DoExecuteA()
virtual void faudes::LuaFunction::DoExecuteA |
( |
| ) |
|
|
protectedvirtual |
Execute stages
- Exceptions
-
◆ DoExecuteB()
virtual void faudes::LuaFunction::DoExecuteB |
( |
| ) |
|
|
protectedvirtual |
Execute stages
- Exceptions
-
◆ DoExecuteC()
virtual void faudes::LuaFunction::DoExecuteC |
( |
| ) |
|
|
protectedvirtual |
Execute stages
- Exceptions
-
◆ DoExecuteD()
virtual void faudes::LuaFunction::DoExecuteD |
( |
| ) |
|
|
protectedvirtual |
Execute stages
- Exceptions
-
◆ DoExecuteE()
virtual void faudes::LuaFunction::DoExecuteE |
( |
| ) |
|
|
protectedvirtual |
Execute stages
- Exceptions
-
◆ DoTypeCheck()
virtual bool faudes::LuaFunction::DoTypeCheck |
( |
int |
n | ) |
|
|
protectedvirtual |
Method to test the type of an assigned parameter with the specified faudes::Signature (i.e. their TypeDefinition label).
Note: this method is called by Function::Execute() before actual function execution via DoExecute(). It may be used to perform a dynamic cast in preparation of DoExecute(). The latter is only called, if all types match.
- Parameters
-
n | Position of parameter to check |
- Returns
- True if type matches signature.
- Exceptions
-
Implements faudes::Function.
◆ DoVariant()
virtual void faudes::LuaFunction::DoVariant |
( |
int |
n | ) |
|
|
protectedvirtual |
◆ Evaluate()
void faudes::LuaFunction::Evaluate |
( |
void |
| ) |
|
Evaluate lua code.
This routine avaluates the associated Lua code literally, i.e. no arguments are passed, no specific function is invoked. See also Execute().
- Exceptions
-
◆ L() [1/2]
void faudes::LuaFunction::L |
( |
LuaState * |
l | ) |
|
Set lua state
Sets the lua state which this function will use for execution. If set to NULL (e.g. on consruction), the function definition's default state will be used. If this is not set either, the global state is used.
- Parameters
-
◆ L() [2/2]
LuaState* faudes::LuaFunction::L |
( |
void |
| ) |
|
Get default lua state
- Returns
- Lua state
◆ New()
virtual LuaFunction* faudes::LuaFunction::New |
( |
| ) |
const |
|
virtual |
Construct on heap. Create a new instance of this function class and return pointer. The new instance will use the same function definition as this instance.
- Returns
- Pointer to faudes::Function instance.
Implements faudes::Function.
◆ SyntaxCheck()
void faudes::LuaFunction::SyntaxCheck |
( |
void |
| ) |
|
Syntax check lua code.
This routine does all it needs to run the script, except to invoke the specified function. The reasoning is, that the script may hang and, thus, never return. A consequence is, that you must set a variant and you must supply parameter values befor checking. You may use AllocateValues() and FreeValues() for this purpose. Errors are indicated by an exception.
Note that the LuaFunctionDefinition provides a convenience wrapper that runs the check on all variants and cares about value allocation.
- Exceptions
-
Exception |
- No such variant (id 47)
- Error in Lua script (id 49)
|
◆ mEntryStack
int faudes::LuaFunction::mEntryStack |
|
protected |
◆ mFtable
int faudes::LuaFunction::mFtable |
|
protected |
◆ mFType
void* faudes::LuaFunction::mFType |
|
protected |
◆ mLParameter
std::vector<bool> faudes::LuaFunction::mLParameter |
|
protected |
◆ mLParameterCount
int faudes::LuaFunction::mLParameterCount |
|
protected |
◆ mLReturn
std::vector<bool> faudes::LuaFunction::mLReturn |
|
protected |
◆ mLReturnCount
int faudes::LuaFunction::mLReturnCount |
|
protected |
◆ pL
◆ pLL
lua_State* faudes::LuaFunction::pLL |
|
protected |
◆ pLuaFuncDef
The documentation for this class was generated from the following file:
libFAUDES 2.33c
--- 2025.05.15
--- c++ api documentaion by doxygen
|