casa
$Rev:20696$
|
Implementation of DisplayParameter to store String parameters. More...
#include <DParameterString.h>
Public Member Functions | |
DParameterString (const String name, const String description, const String help, const String defaultvalue, const String value, const String context="", const Bool editable=True) | |
Constructor taking the name of the parameter, a short description, some help text, a default value, an initial value, and flags indicating whether the parameter can be unset and is editable. | |
DParameterString (const DParameterString &other) | |
(Required) copy constructor. | |
virtual | ~DParameterString () |
Destructor. | |
DParameterString & | operator= (const DParameterString &other) |
(Required) copy assignment. | |
virtual Bool | fromRecord (const RecordInterface &record) |
Parse record , and update this parameter if a field exists whose name matches that of 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. | |
String | defaultValue () |
Return the default for this parameter. | |
String | value () |
Return the current value of this parameter. | |
Protected Member Functions | |
DParameterString () | |
(Required) default constructor. | |
Private Attributes | |
String | itsDefault |
Store for the default of this parameter. | |
String | itsValue |
Store for the value of this parameter. |
Implementation of DisplayParameter to store String parameters.
Public interface
DParameterString is an implementation of a DisplayParameter providing a String parameter type.
This class is derived from DisplayParameter and provides a String-type parameter. String parameters simply have a String value, and a default String value. They cannot be unset.
A DParameterString can easily be used to store and update any parameter which can be expressed as a String. In the following example, a DParameterString is constructed to store some text to be used for axis labelling:
DParameterString pstring("xaxislabel", "X Axis Label", "Enter the text to appear alongside the X Axis"); // ..\. // update the parameter from some Record pstring.fromRecord(rec); // examine the value of the parameter if (pstring.value() == "Four frogs found fabulous frocks") { // ..\. }
Many parameters are naturally Strings, or can be expressed as Strings, hence this class.
Definition at line 96 of file DParameterString.h.
casa::DParameterString::DParameterString | ( | const String | name, |
const String | description, | ||
const String | help, | ||
const String | defaultvalue, | ||
const String | value, | ||
const String | context = "" , |
||
const Bool | editable = True |
||
) |
Constructor taking the name of the parameter, a short description, some help text, a default value, an initial value, and flags indicating whether the parameter can be unset and is editable.
casa::DParameterString::DParameterString | ( | const DParameterString & | other | ) |
(Required) copy constructor.
virtual casa::DParameterString::~DParameterString | ( | ) | [virtual] |
Destructor.
casa::DParameterString::DParameterString | ( | ) | [protected] |
(Required) default constructor.
String casa::DParameterString::defaultValue | ( | ) | [inline] |
Return the default for this parameter.
Definition at line 135 of file DParameterString.h.
References itsDefault.
virtual Bool casa::DParameterString::fromRecord | ( | const RecordInterface & | record | ) | [virtual] |
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
.
Implements casa::DisplayParameter.
DParameterString& casa::DParameterString::operator= | ( | const DParameterString & | other | ) |
(Required) copy assignment.
virtual void casa::DParameterString::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.
String casa::DParameterString::value | ( | ) | [inline] |
Return the current value of this parameter.
Definition at line 139 of file DParameterString.h.
References itsValue.
String casa::DParameterString::itsDefault [private] |
Store for the default of this parameter.
Definition at line 150 of file DParameterString.h.
Referenced by defaultValue().
String casa::DParameterString::itsValue [private] |
Store for the value of this parameter.
Definition at line 153 of file DParameterString.h.
Referenced by value().