DUECA/DUSIME
|
A start-up mechanism for declaring new objects available to the scripting language(s) used in DUECA (currently Scheme and Python). More...
#include <CoreCreator.hxx>
Public Member Functions | |
CoreCreator (const ParameterTable *table, const char *name=NULL, voidfunc extra=NULL) | |
Constructor, with class name as argument. | |
CoreCreator (const char *name, voidfunc extra) | |
Constructor, for a virtual base class. | |
CoreCreator (const ParameterTable *table, ArgListProcessor::Strategy strategy, voidfunc extra, const char *name) | |
Constructor. | |
~CoreCreator () | |
Destructor. | |
const char * | callName () const |
Print name of the make call. | |
Static Public Member Functions | |
static void | ifunct () |
Function called when actual script work can be done. | |
static void | ifunct0 () |
Function called when actual script work can be done, no args. | |
A start-up mechanism for declaring new objects available to the scripting language(s) used in DUECA (currently Scheme and Python).
If you want to add a new class (not a Module, normally a "helper" class) to the scripting language, that class needs the following properties:
In an object file, normally the file with the implementation of the class, create one (and only one) CoreCreator object:
If your class derives from another class than directly from ScriptCreatable, specify that class as the parent in the second template parameter.
You will also see instances without the object name given. These are compatible with older code, which uses the macros SCM_FEATURES_NOIMPINH and SCM_FEATURES_IMPINH to indicate the class inheritance structure and script-side names.
If your object does not directly derive from ScriptCreatable, indicate the parent:
The Python scripting interface needs the name for the parent. Add the following to your code:
If the constructor takes arguments, add the classes of the arguments, here is an example with three arguments:
In this case, always 3 arguments have to be supplied. Python interfaces can be configured with default arguments, this example makes the last 2 arguments optional:
Use the ParameterTable of your class to provide help text for all parameters in the table (note these are different from your constructor parameters again), and overall help text for the object.
Template parameters; note that the last template parameter can be replaced by a bpy::optional with another set of template parameters, but only for Python scripting, not for Scheme.
T | Class to create |
B | Parent class, default ScriptCreatable |
P1 | First argument parameter |
P2 | Second argument parameter |
P3 | Third argument parameter |
P4 | Fourth argument parameter |
P5 | Fifth argument parameter |
P6 | Sixth argument parameter |
P7 | Seventh argument parameter |
P8 | Eighth argument parameter |
P9 | Ninth argument parameter |
P10 | Tenth argument parameter |
dueca::CoreCreator< T, B, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 >::CoreCreator | ( | const ParameterTable * | table, |
const char * | name = NULL, | ||
voidfunc | extra = NULL ) |
Constructor, with class name as argument.
This constructor is primarily targeted for the new Python interface, script class name and parameters are supplied. Compatibility with older Scheme interface (where class name is extracted from class template parameter) is maintained.
table | Pointer to the parameter table. May be NULL, in this case there are no parameters to be given in the module creation. |
name | Name for the class as it will be known in the script |
extra | Additional function to be called if table creation is not flexible enough (e.g. for creating additional calls/interfaces). |
dueca::CoreCreator< T, B, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 >::CoreCreator | ( | const char * | name, |
voidfunc | extra ) |
Constructor, for a virtual base class.
This constructor is primarily targeted for the new Python interface, script class name and parameters are supplied. Compatibility with older Scheme interface (where class name is extracted from class template parameter) is maintained.
name | Name for the class as it will be known in the script |
extra | Additional function to be called if table creation is not flexible enough (e.g. for creating additional calls/interfaces). |
dueca::CoreCreator< T, B, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 >::CoreCreator | ( | const ParameterTable * | table, |
ArgListProcessor::Strategy | strategy, | ||
voidfunc | extra, | ||
const char * | name ) |
Constructor.
With the template parameter and a pointer to the table, this enables access to module creation from Scheme.
table | Pointer to the parameter table. May be NULL, in this case there are no parameters to be given in the module creation. |
strategy | Interpretation of the table. Determines whether old-style lists are also allowed. |
extra | Additional function to be called if table creation is not flexible enough (e.g. for creating additional calls). |
name | Name for the class, automatically derived for scheme |