DUECA/DUSIME
|
Template specialisation of the GenericVarIO. More...
#include <MemberCall2Way.hxx>
Public Member Functions | |
MemberCall2Way (bool(C ::*c)(T &, bool in)) | |
Constructor. | |
bool | poke (void *obj, const T &v) const |
Call the member function with data. | |
bool | peek (void *obj, T &v) const |
Obtain data from the class object. | |
Public Member Functions inherited from dueca::GenericVarIO | |
GenericVarIO () | |
constructor | |
virtual | ~GenericVarIO () |
destructor | |
ProbeType | getType () const |
returns the argument type required | |
DECLARE_IN_GENERICVAR_IO (int) | |
Use handy macro to declare stuff for int. | |
DECLARE_IN_GENERICVAR_IO (uint32_t) | |
Use handy macro to declare stuff for int. | |
DECLARE_IN_GENERICVAR_IO (uint16_t) | |
Use handy macro to declare stuff for int. | |
DECLARE_IN_GENERICVAR_IO (double) | |
Use handy macro to declare stuff for double. | |
DECLARE_IN_GENERICVAR_IO (float) | |
Use handy macro to declare stuff for float. | |
DECLARE_IN_GENERICVAR_IO (bool) | |
Use handy macro to declare stuff for bool. | |
DECLARE_IN_GENERICVAR_IO (TimeSpec) | |
Use handy macro to declare stuff for TimeSpec. | |
DECLARE_IN_GENERICVAR_IO (PeriodicTimeSpec) | |
Use handy macro to declare stuff for PeriodicTimeSpec. | |
DECLARE_IN_GENERICVAR_IO (PrioritySpec) | |
Use handy macro to declare stuff for PrioritySpec. | |
DECLARE_IN_GENERICVAR_IO (vstring) | |
Use handy macro to declare stuff for vstring. | |
DECLARE_IN_GENERICVAR_IO (SCM) | |
Use handy macro to declare stuff for SCM. | |
DECLARE_IN_GENERICVAR_IO (vector_int) | |
Use handy macro to declare stuff for vector<int> | |
DECLARE_IN_GENERICVAR_IO (vector_float) | |
Use handy macro to declare stuff for vector<float> | |
DECLARE_IN_GENERICVAR_IO (vector_double) | |
Use handy macro to declare stuff for vector<double> | |
DECLARE_IN_GENERICVAR_IO (vector_vstring) | |
Use handy macro to declare stuff for vector<vstring> | |
DECLARE_IN_GENERICVAR_IO (ScriptCreatable) | |
Objects creatable from scripts. | |
DECLARE_IN_GENERICVAR_IO (string8) | |
Dstring8. | |
DECLARE_IN_GENERICVAR_IO (string16) | |
Dstring. | |
DECLARE_IN_GENERICVAR_IO (string32) | |
Dstring. | |
DECLARE_IN_GENERICVAR_IO (string64) | |
Dstring. | |
DECLARE_IN_GENERICVAR_IO (string128) | |
Dstring. | |
Additional Inherited Members | |
Protected Attributes inherited from dueca::GenericVarIO | |
ProbeType | ptype |
type of argument passed/inserted/read | |
Template specialisation of the GenericVarIO.
The MemberCall2Way takes a pointer to a member function of simple shape, and with that information and a pointer to an object in that class it can call the member function.
One common use is accepting Scheme or Python (helper) objects in your class. Suppose that you have made a class MyHelper creatable to Scheme, by deriving it from the dueca::ScriptCreatable class. Then in Scheme code you can create the helper, and pass it on to your (module) class:
The same in Python:
To process the setting of the helper, you add an entry to your ParameterTable:
The setHelper call should accept a ScriptCreatable, check whether it is really a MyHelper object, and keep a reference to the MyHelper object.
Note that the helper object has been created in the script language; object ownership is therefore by the script. Any helper objects (also ones you don't use in the end), will be made dependent on the modules you attached them to, so garbage collection will only kick in when both the helper and module objects in the above scripts are cleared.