casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Private Attributes
casa::DisplayParameter Class Reference

Base class for storing and parsing of parameters for display classes. More...

#include <DisplayParameter.h>

Inheritance diagram for casa::DisplayParameter:
casa::DParameterButton casa::DParameterChoice casa::DParameterRange< T > casa::DParameterString casa::DParameterSwitch casa::DParameterColorChoice casa::DParameterFontChoice casa::DParameterMapKeyChoice

List of all members.

Public Member Functions

virtual ~DisplayParameter ()
 Destructor.
virtual Bool fromRecord (const RecordInterface &record)=0
 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)=0
 Place a record describing this parameter in a sub-field of record with name matching that of this parameter.
String name () const
 Return the name of this parameter.
String description () const
 Return the description of this parameter.
String help () const
 Return the help for this parameter.
String context () const
 Return the context of this parameter.
Bool allowUnset () const
 Return whether this parameter can be unset.
Bool editable () const
 Return whether this parameter is editable.
void setName (const String name)
 Set or change the name of this parameter to that specified.
void setDescription (const String description)
 Set or change the description of this parameter to what is specified.
void setHelp (const String help)
 Set or change the help for this parameter to what is specified.
void setContext (const String context)
 Set or change the context of this parameter to what is specified.
void setAllowUnset (const Bool allowunset)
 Set or change whether this parameter may be unset, according to the function argument value.
void setEditable (const Bool editable)
 Set or change whether this parameter is editable according to the function argument.

Protected Member Functions

 DisplayParameter (const String name, const String description, const String help, const String context="", const Bool allowunset=False, const 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.
 DisplayParameter (const DisplayParameter &other)
 Copy constructor using copy semantics.
 DisplayParameter ()
 Default constructor yielding a useless DisplayParameter.
DisplayParameteroperator= (const DisplayParameter &other)
 Copy assignment.
Record baseDescription ()
 Return a basic description of this parameter; used by virtual implementations of toRecord method to fill out a Record describing this DisplayParameter.
const DisplayOptionsdisplayOptions () const
 Return the DisplayOptions to use for parsing Records.

Private Attributes

String itsName
 Store for the name of this parameter.
String itsDescription
 Store for the description of this parameter.
String itsHelp
 Store for the help for this parameter.
String itsContext
 Store for the context of this parameter.
Bool itsAllowUnset
 Store for whether this parameter can be unset.
Bool itsEditable
 Store for whether this parameter is editable.
DisplayOptions itsDisplayOptions
 Store for a DisplayOptions object for parsing Records.

Detailed Description

Base class for storing and parsing of parameters for display classes.

Intended use:

Internal

Prerequisite

Etymology

DisplayParameter is a base class which provides services for conveniently storing and parsing parameters relevant to the display classes.

Synopsis

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 RecordInterface-type object, and to add the description of the parameter to a provided RecordInterface object.

Other than this, all parameters share these common elements:

name, a short String uniquely identifiying the parameter.

description, a slightly longer String which offers a description of the parameter, suitably short for display in a graphical user interface, for example.

help, an even longer 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 != 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 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.

Motivation

To avoid littering many of the display classes with code fragments for constructing and parsing Records.

Thrown Exceptions

To Do

Definition at line 121 of file DisplayParameter.h.


Constructor & Destructor Documentation

Destructor.

casa::DisplayParameter::DisplayParameter ( const String  name,
const String  description,
const String  help,
const String  context = "",
const Bool  allowunset = False,
const Bool  editable = True 
) [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.

Copy constructor using copy semantics.

Default constructor yielding a useless DisplayParameter.


Member Function Documentation

Return whether this parameter can be unset.

Definition at line 161 of file DisplayParameter.h.

References itsAllowUnset.

Return a basic description of this parameter; used by virtual implementations of toRecord method to fill out a Record describing this DisplayParameter.

Return the context of this parameter.

Definition at line 157 of file DisplayParameter.h.

References itsContext.

Referenced by setContext().

Return the description of this parameter.

Definition at line 149 of file DisplayParameter.h.

References itsDescription.

Referenced by setDescription().

const DisplayOptions& casa::DisplayParameter::displayOptions ( ) const [inline, protected]

Return the DisplayOptions to use for parsing Records.

Definition at line 220 of file DisplayParameter.h.

References itsDisplayOptions.

Return whether this parameter is editable.

Definition at line 165 of file DisplayParameter.h.

References itsEditable.

Referenced by casa::DParameterChoice::setEditable(), and setEditable().

virtual Bool casa::DisplayParameter::fromRecord ( const RecordInterface record) [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 >, and casa::DParameterRange< Int >.

Return the help for this parameter.

Definition at line 153 of file DisplayParameter.h.

References itsHelp.

Referenced by setHelp().

Return the name of this parameter.

Definition at line 145 of file DisplayParameter.h.

References itsName.

Referenced by setName().

DisplayParameter& casa::DisplayParameter::operator= ( const DisplayParameter other) [protected]

Copy assignment.

void casa::DisplayParameter::setAllowUnset ( const Bool  allowunset) [inline]

Set or change whether this parameter may be unset, according to the function argument value.

Definition at line 187 of file DisplayParameter.h.

References itsAllowUnset.

void casa::DisplayParameter::setContext ( const String  context) [inline]

Set or change the context of this parameter to what is specified.

Definition at line 182 of file DisplayParameter.h.

References context(), and itsContext.

void casa::DisplayParameter::setDescription ( const String  description) [inline]

Set or change the description of this parameter to what is specified.

Definition at line 174 of file DisplayParameter.h.

References description(), and itsDescription.

void casa::DisplayParameter::setEditable ( const Bool  editable) [inline]

Set or change whether this parameter is editable according to the function argument.

Reimplemented in casa::DParameterChoice.

Definition at line 192 of file DisplayParameter.h.

References editable(), and itsEditable.

void casa::DisplayParameter::setHelp ( const String  help) [inline]

Set or change the help for this parameter to what is specified.

Definition at line 178 of file DisplayParameter.h.

References help(), and itsHelp.

void casa::DisplayParameter::setName ( const String  name) [inline]

Set or change the name of this parameter to that specified.

Definition at line 169 of file DisplayParameter.h.

References itsName, and name().

virtual void casa::DisplayParameter::toRecord ( RecordInterface record,
const Bool  fullrecord = True,
const Bool  overwrite = False 
) [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::DParameterButton, casa::DParameterSwitch, casa::DParameterRange< T >, casa::DParameterRange< Float >, and casa::DParameterRange< Int >.


Member Data Documentation

Store for whether this parameter can be unset.

Definition at line 238 of file DisplayParameter.h.

Referenced by allowUnset(), and setAllowUnset().

Store for the context of this parameter.

Definition at line 235 of file DisplayParameter.h.

Referenced by context(), and setContext().

Store for the description of this parameter.

Definition at line 229 of file DisplayParameter.h.

Referenced by description(), and setDescription().

Store for a DisplayOptions object for parsing Records.

Definition at line 244 of file DisplayParameter.h.

Referenced by displayOptions().

Store for whether this parameter is editable.

Reimplemented in casa::DParameterChoice.

Definition at line 241 of file DisplayParameter.h.

Referenced by editable(), and setEditable().

Store for the help for this parameter.

Definition at line 232 of file DisplayParameter.h.

Referenced by help(), and setHelp().

Store for the name of this parameter.

Definition at line 226 of file DisplayParameter.h.

Referenced by name(), and setName().


The documentation for this class was generated from the following file: