I am faced with the following conundrum: Our software has an abstract base class for algorithm objects. All these objects have a common execute() method, e.g.:
class Algorithm
{
public:
// [...]
virtual void execute() = 0;
// [...]
};
For each algorithm that we want to implement, we simply inherit from the base class and store all loaded algorithm objects in a central location. So far, so good.
The problem now lies in the parameters of an algorithm. We want to be able to describe for each algorithm the parameters that need to be set (by an external class). To this end, we gave each algorithm a ParameterList object that contains its parameters. I should clarify that for us, a parameter consists of some kind of type (such as int) and a label (such as "Number of iterations).
The problem now begins when we want to connect the ParameterList to some kind of GUI. Obviously, our algorithms should have no "knowledge" of the graphical API (Qt, GTK, etc.) that we are using. Yet, on the same side, we want to be able to describe algorithm paramters semantically, for example by specifying that the algorithm requires a filename. How this filename is then displayed is up to the GUI.
Is there a way to combine this ParameterList with some kind of semantic type knowledge?
I realize that this question sounds very vague. However, I am not permitted to post any non-trivial code examples (for NDA reasons). So, has anyone been faced with a similar problem in the past?
To wrap it up: We want our objects to describe the parameters they require to a GUI, without knowing the exact details of the GUI.