casa
5.7.0-16
|
Base class for storing and parsing of parameters for display classes. More...
#include <DisplayParameter.h>
Public Member Functions | |
virtual | ~DisplayParameter () |
Destructor. More... | |
virtual casacore::Bool | fromRecord (const casacore::RecordInterface &record)=0 |
Parse record , and update this parameter if a field exists whose name matches that of this parameter. More... | |
virtual void | toRecord (casacore::RecordInterface &record, const casacore::Bool fullrecord=true, const casacore::Bool overwrite=false)=0 |
Place a record describing this parameter in a sub-field of record with name matching that of this parameter. More... | |
casacore::String | name () const |
Return the name of this parameter. More... | |
casacore::String | description () const |
Return the description of this parameter. More... | |
casacore::String | help () const |
Return the help for this parameter. More... | |
casacore::String | context () const |
Return the context of this parameter. More... | |
casacore::Bool | allowUnset () const |
Return whether this parameter can be unset. More... | |
casacore::Bool | editable () const |
Return whether this parameter is editable. More... | |
void | setName (const casacore::String name) |
Set or change the name of this parameter to that specified. More... | |
void | setDescription (const casacore::String description) |
Set or change the description of this parameter to what is specified. More... | |
void | setHelp (const casacore::String help) |
Set or change the help for this parameter to what is specified. More... | |
void | setContext (const casacore::String context) |
Set or change the context of this parameter to what is specified. More... | |
void | setAllowUnset (const casacore::Bool allowunset) |
Set or change whether this parameter may be unset, according to the function argument value. More... | |
void | setEditable (const casacore::Bool editable) |
Set or change whether this parameter is editable according to the function argument. More... | |
Protected Member Functions | |
DisplayParameter (const casacore::String name, const casacore::String description, const casacore::String help, const casacore::String context="", const casacore::Bool allowunset=false, const casacore::Bool editable=true) | |
Constructor taking the name of the parameter, a short description, some help text, and flags indicating whether the parameter can be unset and is editable. More... | |
DisplayParameter (const DisplayParameter &other) | |
Copy constructor using copy semantics. More... | |
DisplayParameter () | |
Default constructor yielding a useless DisplayParameter. More... | |
DisplayParameter & | operator= (const DisplayParameter &other) |
Copy assignment. More... | |
casacore::Record | baseDescription () |
Return a basic description of this parameter; used by virtual implementations of toRecord method to fill out a casacore::Record describing this DisplayParameter. More... | |
const DisplayOptions & | displayOptions () const |
Return the DisplayOptions to use for parsing Records. More... | |
Private Attributes | |
casacore::String | itsName |
Store for the name of this parameter. More... | |
casacore::String | itsDescription |
Store for the description of this parameter. More... | |
casacore::String | itsHelp |
Store for the help for this parameter. More... | |
casacore::String | itsContext |
Store for the context of this parameter. More... | |
casacore::Bool | itsAllowUnset |
Store for whether this parameter can be unset. More... | |
casacore::Bool | itsEditable |
Store for whether this parameter is editable. More... | |
DisplayOptions | itsDisplayOptions |
Store for a DisplayOptions object for parsing Records. More... | |
Base class for storing and parsing of parameters for display classes.
Internal
DisplayParameter is a base class which provides services for conveniently storing and parsing parameters relevant to the display classes.
DisplayParameter defines a relatively simple interface for writing small containers for the various types of parameters used throughout the display classes. The required interface consists of methods to update the parameter value from an incoming casacore::RecordInterface
-type object, and to add the description of the parameter to a provided casacore::RecordInterface
object.
Other than this, all parameters share these common elements:
name
, a short casacore::String
uniquely identifiying the parameter.
description
, a slightly longer casacore::String
which offers a description of the parameter, suitably short for display in a graphical user interface, for example.
help
, an even longer casacore::String
(!) which should be filled in with text describing the option in more detail than can be given in description
context
, which if provided (ie. context != casacore::String("")
) gives a category name for this parameter, and is used, for example, by the autogui to place the parameter in an appropriately named roll-up.
allowunset
, which indicates whether this parameter can be "unset" or not. An "unset" parameter is one for which a sensible (perhaps context sensitive) default can be determined and used. Derived classes need not provide this option in their constructor.
editable
, which indicates whether this parameter is allowed to be modified by the user.
DisplayParameter makes use of the DisplayOptions class to parse Records containing parameter descriptions. Derived classes must implement the two virtual methods toRecord
and fromRecord
, which respectively store a description of the DisplayParameter in a sub-field of the provided casacore::RecordInterface, and extract the value of the DisplayParameter from a sub-field in the provided record. The sub-field is identified by the name
of the DisplayParameter.
Derived classes should also add utility functions which return the various aspects of the DisplayParameter to the programmer. Most importantly, a value()
function should be provided to enable the user to easily retrieve the current value of the parameter.
To avoid littering many of the display classes with code fragments for constructing and parsing Records.
Definition at line 121 of file DisplayParameter.h.
|
virtual |
Destructor.
|
protected |
Constructor taking the name of the parameter, a short description, some help text, and flags indicating whether the parameter can be unset and is editable.
|
protected |
Copy constructor using copy semantics.
|
protected |
Default constructor yielding a useless DisplayParameter.
|
inline |
Return whether this parameter can be unset.
Definition at line 165 of file DisplayParameter.h.
References itsAllowUnset.
|
protected |
Return a basic description of this parameter; used by virtual implementations of toRecord
method to fill out a casacore::Record describing this DisplayParameter.
|
inline |
Return the context of this parameter.
Definition at line 160 of file DisplayParameter.h.
References itsContext.
Referenced by setContext().
|
inline |
Return the description of this parameter.
Definition at line 150 of file DisplayParameter.h.
References itsDescription.
Referenced by setDescription().
|
inlineprotected |
Return the DisplayOptions to use for parsing Records.
Definition at line 232 of file DisplayParameter.h.
References itsDisplayOptions.
|
inline |
Return whether this parameter is editable.
Definition at line 170 of file DisplayParameter.h.
References itsEditable.
Referenced by casa::DParameterChoice::setEditable(), and setEditable().
|
pure 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
.
Implemented in casa::DParameterChoice, casa::DParameterString, casa::DParameterSwitch, casa::DParameterButton, casa::DParameterRange< T >, casa::DParameterRange< float >, casa::DParameterRange< casacore::Float >, and casa::DParameterRange< casacore::Int >.
|
inline |
Return the help for this parameter.
Definition at line 155 of file DisplayParameter.h.
References itsHelp.
Referenced by setHelp().
|
inline |
Return the name of this parameter.
Definition at line 145 of file DisplayParameter.h.
References itsName.
Referenced by setName().
|
protected |
Copy assignment.
|
inline |
Set or change whether this parameter may be unset, according to the function argument value.
Definition at line 197 of file DisplayParameter.h.
References itsAllowUnset.
|
inline |
Set or change the context of this parameter to what is specified.
Definition at line 191 of file DisplayParameter.h.
References context(), and itsContext.
|
inline |
Set or change the description of this parameter to what is specified.
Definition at line 181 of file DisplayParameter.h.
References description(), and itsDescription.
|
inline |
Set or change whether this parameter is editable according to the function argument.
Definition at line 203 of file DisplayParameter.h.
References editable(), and itsEditable.
|
inline |
Set or change the help for this parameter to what is specified.
Definition at line 186 of file DisplayParameter.h.
|
inline |
Set or change the name of this parameter to that specified.
Definition at line 175 of file DisplayParameter.h.
|
pure 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
.
Implemented in casa::DParameterChoice, casa::DParameterString, casa::DParameterSwitch, casa::DParameterButton, casa::DParameterRange< T >, casa::DParameterRange< float >, casa::DParameterRange< casacore::Float >, and casa::DParameterRange< casacore::Int >.
|
private |
Store for whether this parameter can be unset.
Definition at line 251 of file DisplayParameter.h.
Referenced by allowUnset(), and setAllowUnset().
|
private |
Store for the context of this parameter.
Definition at line 248 of file DisplayParameter.h.
Referenced by context(), and setContext().
|
private |
Store for the description of this parameter.
Definition at line 242 of file DisplayParameter.h.
Referenced by description(), and setDescription().
|
private |
Store for a DisplayOptions object for parsing Records.
Definition at line 257 of file DisplayParameter.h.
Referenced by displayOptions().
|
private |
Store for whether this parameter is editable.
Definition at line 254 of file DisplayParameter.h.
Referenced by editable(), and setEditable().
|
private |
Store for the help for this parameter.
Definition at line 245 of file DisplayParameter.h.
|
private |
Store for the name of this parameter.
Definition at line 239 of file DisplayParameter.h.