Implementing a Parametrizable class

In order to create a class with parameters, you need not implement all functions from the Parametrizable interface. The AbstractParametrizable abstract class offers a basic implementation that should fit a majority of cases. One therefore only need to extend the class by public inheritence:

The AbstractParametrizable class maintains a ParameterList with all parameters. Parameters available for your class can be declared in the construtor of the new class: This will create and add to the list two parameters names "alpha" and "beta", the first one taking only positive values.

Parameter values can be assessed lately by the getParameter method. The AbstractParametrizable class will ensure that parameters are updated when the appropriate methods are called. It uses events to notify the class that a parameter as changed, by calling the fireParameterChanged(ParameterList) virtual method. This method should thus be implemented in the derived class, be it left empty. In the following example, we will use this method to compute a quantity of interest that depends on alpha and beta: And that's it! The "exp_" quantity will be updated every time, and only when at least one of the parameters is modified by calling one of the Parametrizable method.