casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
casa::DisplayParameter Class Referenceabstract

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::DParameterRange< casacore::Float > casa::DParameterRange< casacore::Int > casa::DParameterRange< float >

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...
 
DisplayParameteroperator= (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 DisplayOptionsdisplayOptions () 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...
 

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 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.

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

virtual casa::DisplayParameter::~DisplayParameter ( )
virtual

Destructor.

casa::DisplayParameter::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 
)
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.

casa::DisplayParameter::DisplayParameter ( const DisplayParameter other)
protected

Copy constructor using copy semantics.

casa::DisplayParameter::DisplayParameter ( )
protected

Default constructor yielding a useless DisplayParameter.

Member Function Documentation

casacore::Bool casa::DisplayParameter::allowUnset ( ) const
inline

Return whether this parameter can be unset.

Definition at line 165 of file DisplayParameter.h.

References itsAllowUnset.

casacore::Record casa::DisplayParameter::baseDescription ( )
protected

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

casacore::String casa::DisplayParameter::context ( ) const
inline

Return the context of this parameter.

Definition at line 160 of file DisplayParameter.h.

References itsContext.

Referenced by setContext().

casacore::String casa::DisplayParameter::description ( ) const
inline

Return the description of this parameter.

Definition at line 150 of file DisplayParameter.h.

References itsDescription.

Referenced by setDescription().

const DisplayOptions& casa::DisplayParameter::displayOptions ( ) const
inlineprotected

Return the DisplayOptions to use for parsing Records.

Definition at line 232 of file DisplayParameter.h.

References itsDisplayOptions.

casacore::Bool casa::DisplayParameter::editable ( ) const
inline

Return whether this parameter is editable.

Definition at line 170 of file DisplayParameter.h.

References itsEditable.

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

virtual casacore::Bool casa::DisplayParameter::fromRecord ( const casacore::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 >, casa::DParameterRange< casacore::Float >, and casa::DParameterRange< casacore::Int >.

casacore::String casa::DisplayParameter::help ( ) const
inline

Return the help for this parameter.

Definition at line 155 of file DisplayParameter.h.

References itsHelp.

Referenced by setHelp().

casacore::String casa::DisplayParameter::name ( ) const
inline

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 casacore::Bool  allowunset)
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.

void casa::DisplayParameter::setContext ( const casacore::String  context)
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.

void casa::DisplayParameter::setDescription ( const casacore::String  description)
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.

void casa::DisplayParameter::setEditable ( const casacore::Bool  editable)
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.

void casa::DisplayParameter::setHelp ( const casacore::String  help)
inline

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

Definition at line 186 of file DisplayParameter.h.

References help(), and itsHelp.

void casa::DisplayParameter::setName ( const casacore::String  name)
inline

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

Definition at line 175 of file DisplayParameter.h.

References itsName, and name().

virtual void casa::DisplayParameter::toRecord ( casacore::RecordInterface record,
const casacore::Bool  fullrecord = true,
const casacore::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::DParameterSwitch, casa::DParameterButton, casa::DParameterRange< T >, casa::DParameterRange< float >, casa::DParameterRange< casacore::Float >, and casa::DParameterRange< casacore::Int >.

Member Data Documentation

casacore::Bool casa::DisplayParameter::itsAllowUnset
private

Store for whether this parameter can be unset.

Definition at line 251 of file DisplayParameter.h.

Referenced by allowUnset(), and setAllowUnset().

casacore::String casa::DisplayParameter::itsContext
private

Store for the context of this parameter.

Definition at line 248 of file DisplayParameter.h.

Referenced by context(), and setContext().

casacore::String casa::DisplayParameter::itsDescription
private

Store for the description of this parameter.

Definition at line 242 of file DisplayParameter.h.

Referenced by description(), and setDescription().

DisplayOptions casa::DisplayParameter::itsDisplayOptions
private

Store for a DisplayOptions object for parsing Records.

Definition at line 257 of file DisplayParameter.h.

Referenced by displayOptions().

casacore::Bool casa::DisplayParameter::itsEditable
private

Store for whether this parameter is editable.

Definition at line 254 of file DisplayParameter.h.

Referenced by editable(), and setEditable().

casacore::String casa::DisplayParameter::itsHelp
private

Store for the help for this parameter.

Definition at line 245 of file DisplayParameter.h.

Referenced by help(), and setHelp().

casacore::String casa::DisplayParameter::itsName
private

Store for the name of this parameter.

Definition at line 239 of file DisplayParameter.h.

Referenced by name(), and setName().


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