casa
$Rev:20696$
|
Implementation of DisplayParameter to store choice parameters. More...
#include <DParameterSwitch.h>
Public Member Functions | |
DParameterSwitch (const String name, const String description, const String help, const Bool defaultvalue, const Bool value, const String context="") | |
Constructor taking the name of the parameter, a short description, some help text, a default value, an initial value, the context of the parameter. | |
DParameterSwitch (const DParameterSwitch &other) | |
(Required) copy constructor. | |
virtual | ~DParameterSwitch () |
Destructor. | |
DParameterSwitch & | operator= (const DParameterSwitch &other) |
(Required) copy assignment. | |
virtual Bool | fromRecord (const RecordInterface &record) |
Parse record , and update this parameter. | |
virtual void | toRecord (RecordInterface &record, const Bool fullrecord=True, const Bool overwrite=False) |
Place a record describing this parameter in a sub-field of record with name matching that of this parameter. | |
Bool | defaultValue () const |
Return the default for this parameter. | |
Bool | value () const |
Return the current value of this parameter. | |
void | setDefaultValue (const Bool defaultvalue) |
Set or change the default value for this parameter. | |
void | setValue (const Bool value) |
Set or change the current value. | |
Protected Member Functions | |
DParameterSwitch () | |
(Required) default constructor. | |
Private Attributes | |
Bool | itsDefaultValue |
Store for the default of this parameter. | |
Bool | itsValue |
Store for the value of this parameter. |
Implementation of DisplayParameter to store choice parameters.
Public interface
DParameterSwitch is an implementation of a DisplayParameter providing a boolean (switch) parameter type.
This class is derived from DisplayParameter and provides a boolean switch parameter. Parameters can be True or False. They cannot be unset.
DParameterSwitch pswitch("myswitch", "Axis labels", "Do you want to draw axis labels?", True,True); // ..\. // update the parameter from some Record pswitch.fromRecord(rec); // examine the value of the parameter if (pswitch.value()) { // ..\. }
Switches are common.
Definition at line 94 of file DParameterSwitch.h.
casa::DParameterSwitch::DParameterSwitch | ( | const String | name, |
const String | description, | ||
const String | help, | ||
const Bool | defaultvalue, | ||
const Bool | value, | ||
const String | context = "" |
||
) |
Constructor taking the name of the parameter, a short description, some help text, a default value, an initial value, the context of the parameter.
casa::DParameterSwitch::DParameterSwitch | ( | const DParameterSwitch & | other | ) |
(Required) copy constructor.
virtual casa::DParameterSwitch::~DParameterSwitch | ( | ) | [virtual] |
Destructor.
casa::DParameterSwitch::DParameterSwitch | ( | ) | [protected] |
(Required) default constructor.
Bool casa::DParameterSwitch::defaultValue | ( | ) | const [inline] |
Return the default for this parameter.
Definition at line 131 of file DParameterSwitch.h.
References itsDefaultValue.
virtual Bool casa::DParameterSwitch::fromRecord | ( | const RecordInterface & | record | ) | [virtual] |
Parse record
, and update this parameter.
Return True
if the parameter is changed, otherwise return False
.
Implements casa::DisplayParameter.
DParameterSwitch& casa::DParameterSwitch::operator= | ( | const DParameterSwitch & | other | ) |
(Required) copy assignment.
void casa::DParameterSwitch::setDefaultValue | ( | const Bool | defaultvalue | ) | [inline] |
Set or change the default value for this parameter.
Definition at line 139 of file DParameterSwitch.h.
References itsDefaultValue.
void casa::DParameterSwitch::setValue | ( | const Bool | value | ) | [inline] |
Set or change the current value.
Definition at line 143 of file DParameterSwitch.h.
virtual void casa::DParameterSwitch::toRecord | ( | RecordInterface & | record, |
const Bool | fullrecord = True , |
||
const Bool | overwrite = False |
||
) | [virtual] |
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.
Implements casa::DisplayParameter.
Bool casa::DParameterSwitch::value | ( | ) | const [inline] |
Return the current value of this parameter.
Definition at line 135 of file DParameterSwitch.h.
References itsValue.
Referenced by casa::Profile2dDD::profileAutoscale(), setValue(), and casa::Profile2dDD::showRestFrequency().
Bool casa::DParameterSwitch::itsDefaultValue [private] |
Store for the default of this parameter.
Definition at line 154 of file DParameterSwitch.h.
Referenced by defaultValue(), and setDefaultValue().
Bool casa::DParameterSwitch::itsValue [private] |
Store for the value of this parameter.
Definition at line 157 of file DParameterSwitch.h.
Referenced by setValue(), and value().