D
Dan Oprisan
I want to modularize an existing simulation software, i.e. different
processing blocks are be loaded as "plugins" and share the data via
the main program. The main program has no idea about the exchanged
data types, so it will only exchange void pointers between the blocks.
So, each of the modules gets an array of void pointers to the
input/output data from the main program, ptr[3]. In order to access
the data I'm doing something like:
// Internal pointers
double* InSignal;
int* Amplification;
float* OutSignal;
// Assignmet of pointers
InSignal = (double*)ptr[0];
Amplification = (int*)ptr[1];
OutSignal = (float*)ptr[2];
// Simulation
(*OutSignal) = (*InSignal) * (*Amplification);
................ etc
Now, I don't like the fact that I need explicit casts to copy the
external pointer to the internal pointer. I would like to automatize
this assignment, i.e. in a loop. (This would allow to store the
relation between external and internal pointers in a common araray,
used also by other member functions.) Any hint hoe to get along?
processing blocks are be loaded as "plugins" and share the data via
the main program. The main program has no idea about the exchanged
data types, so it will only exchange void pointers between the blocks.
So, each of the modules gets an array of void pointers to the
input/output data from the main program, ptr[3]. In order to access
the data I'm doing something like:
// Internal pointers
double* InSignal;
int* Amplification;
float* OutSignal;
// Assignmet of pointers
InSignal = (double*)ptr[0];
Amplification = (int*)ptr[1];
OutSignal = (float*)ptr[2];
// Simulation
(*OutSignal) = (*InSignal) * (*Amplification);
................ etc
Now, I don't like the fact that I need explicit casts to copy the
external pointer to the internal pointer. I would like to automatize
this assignment, i.e. in a loop. (This would allow to store the
relation between external and internal pointers in a common araray,
used also by other member functions.) Any hint hoe to get along?