DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
dueca::CoreCreator< T, B, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 > Class Template Reference

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>

Inheritance diagram for dueca::CoreCreator< T, B, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 >:
Inheritance graph
[legend]
Collaboration diagram for dueca::CoreCreator< T, B, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 >:
Collaboration graph
[legend]

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 charcallName () 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.
 

Detailed Description

template<class T, typename B = ScriptCreatable, class P1 = NOOP, class P2 = NOOP, class P3 = NOOP, class P4 = NOOP, class P5 = NOOP, class P6 = NOOP, class P7 = NOOP, class P8 = NOOP, class P9 = NOOP, class P10 = NOOP>
class dueca::CoreCreator< T, B, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 >

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:

static CoreCreator<MyHelperClass> a(MyHelperClass::getParameterTable(),
"object_name_in_script");
This is a "light weight object" that enables you to read the latest set of data on a StreamChannelEnd...
Definition StreamReaderLatest.hxx:43

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:

a(MyHelperClass::getParameterTable(),
"object_name_in_script");

The Python scripting interface needs the name for the parent. Add the following to your code:

#include <dueca/PythonCorrectedName.hxx>
// A template specialization that gives the name of my parent class
template<>
const char* core_creator_name<MyHelperParent>(const char*)
{ return "MyHelperParent"; }

If the constructor takes arguments, add the classes of the arguments, here is an example with three arguments:

a(MyHelperClass::getParameterTable(),
"object_name_in_script");

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:

#if defined(SCRIPT_PYTHON)
bpy::optional<std::string,int> >
a(MyHelperClass::getParameterTable(),
"object_name_in_script");
#endif
A start-up mechanism for declaring new objects available to the scripting language(s) used in DUECA (...
Definition CoreCreator.hxx:141

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.

Template Parameters
TClass to create
BParent class, default ScriptCreatable
P1First argument parameter
P2Second argument parameter
P3Third argument parameter
P4Fourth argument parameter
P5Fifth argument parameter
P6Sixth argument parameter
P7Seventh argument parameter
P8Eighth argument parameter
P9Ninth argument parameter
P10Tenth argument parameter

Constructor & Destructor Documentation

◆ CoreCreator() [1/3]

template<class T , typename B = ScriptCreatable, class P1 = NOOP, class P2 = NOOP, class P3 = NOOP, class P4 = NOOP, class P5 = NOOP, class P6 = NOOP, class P7 = NOOP, class P8 = NOOP, class P9 = NOOP, class P10 = NOOP>
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.

Parameters
tablePointer to the parameter table. May be NULL, in this case there are no parameters to be given in the module creation.
nameName for the class as it will be known in the script
extraAdditional function to be called if table creation is not flexible enough (e.g. for creating additional calls/interfaces).

◆ CoreCreator() [2/3]

template<class T , typename B = ScriptCreatable, class P1 = NOOP, class P2 = NOOP, class P3 = NOOP, class P4 = NOOP, class P5 = NOOP, class P6 = NOOP, class P7 = NOOP, class P8 = NOOP, class P9 = NOOP, class P10 = NOOP>
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.

Parameters
nameName for the class as it will be known in the script
extraAdditional function to be called if table creation is not flexible enough (e.g. for creating additional calls/interfaces).

◆ CoreCreator() [3/3]

template<class T , typename B = ScriptCreatable, class P1 = NOOP, class P2 = NOOP, class P3 = NOOP, class P4 = NOOP, class P5 = NOOP, class P6 = NOOP, class P7 = NOOP, class P8 = NOOP, class P9 = NOOP, class P10 = NOOP>
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.

Parameters
tablePointer to the parameter table. May be NULL, in this case there are no parameters to be given in the module creation.
strategyInterpretation of the table. Determines whether old-style lists are also allowed.
extraAdditional function to be called if table creation is not flexible enough (e.g. for creating additional calls).
nameName for the class, automatically derived for scheme

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