casa::DParameterSwitch Class Reference

Implementation of DisplayParameter to store choice parameters. More...

#include <DParameterSwitch.h>

Inheritance diagram for casa::DParameterSwitch:
casa::DisplayParameter

List of all members.

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.
DParameterSwitchoperator= (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.

Detailed Description

Implementation of DisplayParameter to store choice parameters.

Intended use:

Public interface

Prerequisite

Etymology

DParameterSwitch is an implementation of a DisplayParameter providing a boolean (switch) parameter type.

Synopsis

This class is derived from DisplayParameter and provides a boolean switch parameter. Parameters can be True or False. They cannot be unset.

Example

 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()) {
 // ..\.
 }

Motivation

Switches are common.

Thrown Exceptions

To Do

Definition at line 94 of file DParameterSwitch.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Reimplemented from casa::DisplayParameter.

void casa::DParameterSwitch::setDefaultValue ( const Bool  defaultvalue  )  [inline]

Set or change the default value for this parameter.

Definition at line 141 of file DParameterSwitch.h.

References itsDefaultValue.

void casa::DParameterSwitch::setValue ( const Bool  value  )  [inline]

Set or change the current value.

Definition at line 146 of file DParameterSwitch.h.

References itsValue.

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 ( void   )  const [inline]

Return the current value of this parameter.

Definition at line 136 of file DParameterSwitch.h.

References itsValue.

Referenced by casa::Profile2dDD::profileAutoscale(), and casa::Profile2dDD::showRestFrequency().


Member Data Documentation

Store for the default of this parameter.

Definition at line 158 of file DParameterSwitch.h.

Referenced by defaultValue(), and setDefaultValue().

Store for the value of this parameter.

Definition at line 161 of file DParameterSwitch.h.

Referenced by setValue(), and value().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1