I have a C module which is created by the Real-time Workshop based on a Simulink Model. This modules provides three public functions:
int init();
int calc(double *inputarray, double *outputarray);
int term();
Based on the contents of the outputarray, I can model a class called OutputThing.
I want to integrate those functions in a wrapper class called WrapperModule. Right now I have a class that looks like this:
class WrapperModule {
public:
int initialize();
OutputThing calc(...);
int terminate();
};
My problem is, how to properly design a wrapper method for the calc() Function. I want to avoid to create a method with an array/vector as its single argument. But identifying the correct arguments from the vector is tricky and I dislike the idea of having a method with 6 or more arguments.
Bertrand Meyer in his OOSC book suggests the use of setter methods. Something like:
class WrapperModule {
public:
int initialize();
void set_foo(double f);
void set_bar(double b);
OutputThing calc();
int terminate();
};
Any ideas? I'm not sure which approach would be better.