A DParameterChoice can easily be used to store and update any parameter which can be expressed as a selection from two or more options. In the following example, a DParameterChoice is constructed to provide the name of the font to use in axis labelling:
Vector<String> fonts(4); fonts(0) = "roman"; // ... DParameterChoice pchoice("font", "Label font", "Select the font to use for axis labelling", fonts, fonts(0), fonts(0)); // ... // update the parameter from some Record pchoice.fromRecord(rec); // examine the value of the parameter if (pchoice.value() == "italic") { // ... }
(Required) copy constructor.
Destructor.
(Required) copy assignment.
Parse record, and update this parameter if a field exists whose name matches that of this parameter. Return True if the parameter is changed, otherwise return False.
Place a record describing this parameter in a sub-field of record with name matching that of this parameter. If overwrite is True, then any existing field with matching name will be overwritten. If fullrecord is True, then a complete description of the parameter is given, otherwise just its current value is stored in record. Presently fullrecord is ignored.
Return the list of allowed options for this parameter.
Return the default for this parameter.
Return the current value of this parameter.
Set or change if this parameter is editable (determines wether choice or userchoice is returned in the record
Set or change the list of allowed options for this parameter.
Set or change the default value for this parameter.
Set or change the current value.
Convenient syntax to set (only) the value.
Determine whether this value exists in the list of options.