The base for classes that can be configured/saved using a ConfigurationParameters object. More...
Classes | |
class | BoolDescriptor |
Utility Class for customize the description of Boolean parameter. More... | |
class | Descriptor |
Utility Class for describe the parameters of a ParameterSettable. More... | |
class | EnumDescriptor |
Utility Class for customize the description of Enum-like parameter. More... | |
class | IntDescriptor |
Utility Class for customize the description of Integer parameter. More... | |
class | ObjectDescriptor |
Utility Class for customize the description of an object parameter. More... | |
class | RealDescriptor |
Utility Class for customize the description of Real valued parameter. More... | |
class | StringDescriptor |
Utility Class for customize the description of String parameter. More... | |
class | SubgroupDescriptor |
Utility Class for customize the description of a subgroup. More... | |
Public Types | |
enum | Property { Default = 0x0000, IsList = 0x0001, IsMandatory = 0x0002, AllowMultiple = 0x0004 } |
this enum is used to describe the properties of a parameter or a subgroup in a type description More... | |
Public Member Functions | |
ParameterSettable () | |
Constructor. | |
virtual | ~ParameterSettable () |
Destructor. | |
void | addObserver (RuntimeParameterObserver *obs) |
add a RuntimeParameterObserver to this object | |
template<class T > | |
T | getRuntimeParameter (QString paramName) |
return the value of the object's parameter previously marked as runtime modifiable | |
virtual ParameterSettableUI * | getUIManager () |
Return an instance of the ParameterSettableUI class that handle the viewers for the GUI. | |
virtual void | postConfigureInitialization () |
This function is called after all linked objects have been configured. | |
void | removeObserver (RuntimeParameterObserver *obs) |
remove the RuntimeParameterObserver to this object | |
virtual void | save (ConfigurationParameters ¶ms, QString prefix)=0 |
Saves the actual status of parameters into the ConfigurationParameters object passed. | |
template<class T > | |
void | setRuntimeParameter (QString paramName, T newvalue) |
set the value of the object's parameter previously marked as runtime modifiable | |
QString | typeName () const |
return the type name of this object | |
Static Public Member Functions | |
static void | describe (QString type) |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups. | |
static QString | fullParameterDescriptionPath (QString type, QString param) |
helper function for creating the full path to a parameter description | |
static QString | fullSubgroupDescriptionPath (QString type, QString sub) |
helper function for creating the full path to a subgroup description | |
Static Public Attributes | |
static const double | Infinity = std::numeric_limits<double>::infinity() |
Shortcut variable for indicate an infinity double number. | |
static const int | MaxInteger = std::numeric_limits<int>::max() |
Shortcut variable for indicate the maximum int value allowed. | |
static const int | MinInteger = std::numeric_limits<int>::min() |
Shortcut variable for indicate the minimum int value allowed. | |
Protected Member Functions | |
void | notifyChangesToParam (QString paramName) |
notify observers about a changing to a runtime parameter | |
Static Protected Member Functions | |
static Descriptor | addTypeDescription (QString type, QString shortHelp, QString longHelp=QString("")) |
Add an entry for the type into the descriptions of all available types. | |
template<class EditorType > | |
static void | setGraphicalEditor (QString type) |
Sets the graphical editor for this ParameterSettable This method sets the editor (a subclass of ConfigurationWidget) to use to modify the values of the parameters of this group (and possibly of subgroups, if the editor supports this) | |
Friends | |
class | RealFactory |
Detailed Description
The base for classes that can be configured/saved using a ConfigurationParameters object.
This is also the abstract product of the factory methods.
- Note
- This lacks any method to configure the object. ALWAYS use one of the two subclasses below.
- Warning
- All classes that have ParameterSettable as an ancestor should be only created and configured using ConfigurationParameters. Calling configure() or postConfigureInitialization() by hand is highly discouraged (you could experience strange problems...)
Definition at line 51 of file parametersettable.h.
Member Enumeration Documentation
enum Property |
this enum is used to describe the properties of a parameter or a subgroup in a type description
The properties of a parameter of a subgroup are specified using one or ORing two or more descriptionProperties enumeration. For example: AllowMultiple | isMandatory correspond a flag that specify a parameter that is a list of values and that is mandatory
- Enumerator:
Definition at line 60 of file parametersettable.h.
Constructor & Destructor Documentation
Constructor.
Definition at line 53 of file parametersettable.cpp.
|
virtual |
Destructor.
Definition at line 57 of file parametersettable.cpp.
References RuntimeParameterObserver::onObjectDestruction().
Member Function Documentation
void addObserver | ( | RuntimeParameterObserver * | obs | ) |
add a RuntimeParameterObserver to this object
- Parameters
-
obs the RuntimeParameterObserver to add
Definition at line 64 of file parametersettable.cpp.
|
staticprotected |
Add an entry for the type into the descriptions of all available types.
This method will return an instance of Descriptor for describe the parameters and subgroups of the type. Use the methods Descriptor::describeXxx to declare the parameters and subgroups available for configuring the type
- Returns
- an instance of Descriptor to use for adding description of the parameters of the type to describe
- Parameters
-
type is the name of the type shortHelp is the short comment (rich text here is not allowed) longHelp is the long help (rich text here is allowed); if not specified the longHelp will be the same of the shortHelp
- Note
- always add the type description with a shortHelp (and possibly a longer help) even in the case the type has no parameters or subgroups
Definition at line 103 of file parametersettable.cpp.
|
inlinestatic |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
It's mandatory in all subclasses where configure and save methods have been re-implemented for dealing with new parameters and subgroups to also implement the describe method
- Parameters
-
type is the name of the type regarding the description. The type is used when a subclass reuse the description of its parent calling the parent describe method passing the type of the subclass. In this way, the result of the method describe of the parent will be the addition of the description of the parameters of the parent class into the type of the subclass
Definition at line 114 of file parametersettable.h.
|
static |
helper function for creating the full path to a parameter description
It handles also the case of subgrouped parameters like PID/k
Definition at line 80 of file parametersettable.cpp.
Referenced by ConfigurationHelper::getParameterEnumValues(), ConfigurationHelper::getParameterTypeName(), ConfigurationHelper::isRuntimeParameter(), and ConfigurationHelper::parameterIsDouble().
|
static |
helper function for creating the full path to a subgroup description
It handles also the nested subgroups like Subgroup1/Subgroup2
Definition at line 90 of file parametersettable.cpp.
Referenced by ConfigurationHelper::getDescribedParameterNames(), and ConfigurationHelper::getDescribedSubgroupNames().
|
inline |
return the value of the object's parameter previously marked as runtime modifiable
- Parameters
-
paramName is the name of the parameter of the object; in case the parameter is in a subgroup of the object description you has to specify also the subgroup: PID/k for a parameter k of the object that belongs to the subgroup PID
- Returns
- the actual value of the parameter
- Warning
- this method will raise an exception if the parameter is not marked as runtime modifiable
- this method will raise an exception if the type mismatch
Definition at line 166 of file parametersettable.h.
References RuntimeParameterSetter::get().
|
inlinevirtual |
Return an instance of the ParameterSettableUI class that handle the viewers for the GUI.
- Warning
- it return a NULL pointer if there is no ParameterSettableUI associated with the object
Definition at line 130 of file parametersettable.h.
|
protected |
notify observers about a changing to a runtime parameter
This method should to be used anytime a parameter marked as runtime has been changed by another means that setRuntimeParameter
- Parameters
-
paramName is the name of the paramenter changed
Definition at line 74 of file parametersettable.cpp.
References RuntimeParameterObserver::onParameterChanges().
|
inlinevirtual |
This function is called after all linked objects have been configured.
See the description of the ConfigurationParameters class for more information. The default implementation does nothing
Definition at line 123 of file parametersettable.h.
void removeObserver | ( | RuntimeParameterObserver * | obs | ) |
remove the RuntimeParameterObserver to this object
It does nothing if the RuntimeParameterObserver is not present to the current observers list
- Parameters
-
obs the RuntimeParameterObserver to remove
Definition at line 70 of file parametersettable.cpp.
|
pure virtual |
Saves the actual status of parameters into the ConfigurationParameters object passed.
- Parameters
-
params the configuration parameters object on which save actual parameters prefix the prefix to use to access the object configuration parameters.
|
staticprotected |
Sets the graphical editor for this ParameterSettable This method sets the editor (a subclass of ConfigurationWidget) to use to modify the values of the parameters of this group (and possibly of subgroups, if the editor supports this)
- Parameters
-
type is the name of the type
Definition at line 407 of file factory.h.
References Factory::getInstance(), and Factory::registerEditorForType().
|
inline |
set the value of the object's parameter previously marked as runtime modifiable
- Parameters
-
paramName is the name of the parameter of the object; in case the parameter is in a subgroup of the object description you has to specify also the subgroup: PID/k for a parameter k of the object that belongs to the subgroup PID newvalue is the new value to assign to the parameter
- Note
- the actual value of the parameter after the change might be different from newvalue
- the changes made by this method are never reflected to any ConfigurationParameters used during the call of configure method
- Warning
- this method will raise an exception if the parameter is not marked as runtime modifiable
- this method will raise an exception if the type mismatch
Definition at line 145 of file parametersettable.h.
References RuntimeParameterObserver::onParameterChanges(), and RuntimeParameterSetter::set().
|
inline |
return the type name of this object
It return the name which the object has been registered into the factory; it is the name you has to specify in parameter type on configuration file in order to create the object.
- Note
- It may not correspond to the C++ class name of the object; this happens when the class is registered into the factory with a different name respect to the C++ class name. Possible but discouraged
Definition at line 197 of file parametersettable.h.
Member Data Documentation
|
static |
Shortcut variable for indicate an infinity double number.
Definition at line 76 of file parametersettable.h.
Referenced by ParameterSettable::RealDescriptor::limits().
|
static |
Shortcut variable for indicate the maximum int value allowed.
Definition at line 78 of file parametersettable.h.
Referenced by ParameterSettable::IntDescriptor::limits().
|
static |
Shortcut variable for indicate the minimum int value allowed.
Definition at line 80 of file parametersettable.h.
Referenced by ParameterSettable::IntDescriptor::limits().
The documentation for this class was generated from the following files:
- configuration/include/parametersettable.h
- configuration/src/parametersettable.cpp
- configuration/include/factory.h