DUECA/DUSIME
|
If defined, a hack is implemented that avoids some problems with templates. More...
#include <VarProbe.hxx>
Public Member Functions | |
VarProbe (T C ::*d) | |
Constructor. | |
bool | poke (void *obj, const T &v) const |
Change a member variable in a class. | |
bool | peek (void *obj, T &v) const |
Read a data member in a class. | |
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 | |
If defined, a hack is implemented that avoids some problems with templates.
I tried using a double template, with 1st template for the class being probed, and the second template for the type of variable being probed. (gcc 2.95.2) Somehow this does not work:
(VarProbe.cc:69: common_type called with uncommon member types (compiler error)
Solved this with a hack, casting the member reference to (void*), and re-casting it in the code
Another problem showed up when trying to write arrays directly declard in a class (class A { int[5] i;}). The pointer address (&A::i) cannot be combined with a class pointer to get a valid int pointer address. Therefore skipped trying to read/write array members
These problems both appear to have been solved in RedHat's gcc-2.96 (redhat 7.0, do install the updated rpm) Template specialization of the GenericVarIO.
The VarProbe takes a pointer to a member variable in a class, and with that information and a pointer to an object in that class it can insert data directly into the member. Seems dirty, but provides a really useful service. For neater IO, use the MemberCall objects.