libFAUDES

Sections

Index

faudes::LuaFunction Class Reference
[Lua Bindings PlugIn]

A LuaFunction is a faudes-function that executes a luafaudes script. More...

#include <lbp_function.h>

List of all members.

Public Member Functions

 LuaFunction (const LuaFunctionDefinition *fdef)
 Constructor.
 ~LuaFunction (void)
 Destructor.
virtual LuaFunctionNew () const
 Construct on heap.
void Definition (const FunctionDefinition *fdef)
 Set function definition.
const LuaFunctionDefinitionDefinition (void) const
 Get function definition.
void SyntaxCheck (void)
 Syntax check lua code.

Protected Member Functions

virtual bool DoTypeCheck (int n)
 Method to test the type of an assigned parameter with the specified faudes::Signature (i.e.
virtual void DoExecute ()
 Executes code as supplied by FunctionDefinition.
virtual void DoExecuteA ()
 Execute stages.
virtual void DoExecuteB ()
 Execute stages.
virtual void DoExecuteC ()
 Execute stages.
virtual void DoExecuteD ()
 Execute stages.

Protected Attributes

const LuaFunctionDefinitionpLuaFuncDef
 Typed reference to definition.
lua_State * mpL
 State of Lua interpreter.
int mFtable
void * mFType

Detailed Description

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 303 of file lbp_function.h.


Constructor & Destructor Documentation

faudes::LuaFunction::LuaFunction ( const LuaFunctionDefinition fdef  ) 

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.

Definition at line 238 of file lbp_function.cpp.

faudes::LuaFunction::~LuaFunction ( void   )  [inline]

Destructor.

Definition at line 315 of file lbp_function.h.


Member Function Documentation

const LuaFunctionDefinition * faudes::LuaFunction::Definition ( void   )  const

Get function definition.

Returns:
Function definition used by this function.

Reimplemented from faudes::Function.

Definition at line 258 of file lbp_function.cpp.

void faudes::LuaFunction::Definition ( const FunctionDefinition fdef  )  [virtual]

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:
fdef Function definition to set.

Reimplemented from faudes::Function.

Definition at line 251 of file lbp_function.cpp.

void faudes::LuaFunction::DoExecute ( void   )  [protected, virtual]

Executes code as supplied by FunctionDefinition.

Exceptions:
Exception 
  • Exception during lua setup (id 49)
  • Any exception during execution of script

Implements faudes::Function.

Definition at line 334 of file lbp_function.cpp.

void faudes::LuaFunction::DoExecuteA ( void   )  [protected, virtual]

Execute stages.

Exceptions:
Exception 

Definition at line 375 of file lbp_function.cpp.

void faudes::LuaFunction::DoExecuteB ( void   )  [protected, virtual]

Execute stages.

Exceptions:
Exception 

Definition at line 472 of file lbp_function.cpp.

void faudes::LuaFunction::DoExecuteC ( void   )  [protected, virtual]

Execute stages.

Exceptions:
Exception 
  • Exception during lua setup (id 49)
  • Any exception during execution of script

Definition at line 542 of file lbp_function.cpp.

void faudes::LuaFunction::DoExecuteD ( void   )  [protected, virtual]

Execute stages.

Exceptions:
Exception 

Definition at line 578 of file lbp_function.cpp.

bool faudes::LuaFunction::DoTypeCheck ( int  n  )  [protected, virtual]

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:
Exception 

Implements faudes::Function.

Definition at line 263 of file lbp_function.cpp.

LuaFunction * faudes::LuaFunction::New ( void   )  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.

Definition at line 246 of file lbp_function.cpp.

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 
  • Error in Lua script (id 49)

Definition at line 358 of file lbp_function.cpp.


Member Data Documentation

Definition at line 439 of file lbp_function.h.

void* faudes::LuaFunction::mFType [protected]

Definition at line 440 of file lbp_function.h.

lua_State* faudes::LuaFunction::mpL [protected]

State of Lua interpreter.

Definition at line 438 of file lbp_function.h.

Typed reference to definition.

Definition at line 435 of file lbp_function.h.


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

libFAUDES 2.18b --- 2010-12-17 --- c++ source docu by doxygen 1.6.3