Parameter Refactoring
In order to better organizing parameter and be able to write clean code in Application
class we need to re-factor the parameter class and its derived class.
For this it would be wise to follow the dependency inversion principle, for better code improvement and re-use.
The interfaces will be develop in order to improve the efficiency of the application engine. This can be the first step for a more profound refactoring, with use of parameter traits, and even changes in the Application API.
Parameter base class architecture
The new parameter will have the following members:
public:
const string key // parameter key set during construction
string name // parameter name
string description // parameter description
bool enabled // flag telling if the parameter is enabled or not
bool mandatory // flag telling if the parameter is mandatory or not
bool userValue // flag telling if the parameter has a user value
enum userLevel // enum telling if the parameter is advanced or basic
enum role // enum telling if parameter is an output or an input
protected:
ParameterGroup * parent // pointer to be able to know from which parameter group the parameter is coming from
and the following methods :
bool GetActiveRecurse() const // return true if the parameter branch is active
virtual string ToString() const = 0 // return the parameter value as a string
virtual void FromString( string val ) = 0 // set the parameter value from a string
bool IsRoot() const // return true if the parameter has no parent
virtual void Reset() // set the parameter value to its default if it has one and to an empty value otherwise
virtual bool HasValue() const // return true if the parameter has a value
bool HasUserValue() const // return true if parameter value has been set by the user
Edited by Tristan Laurent