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

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

#include <DParameterString.h>

Inheritance diagram for casa::DParameterString:
casa::DisplayParameter

List of all members.

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

Detailed Description

Implementation of DisplayParameter to store String parameters.

Intended use:

Public interface

Prerequisite

Etymology

DParameterString is an implementation of a DisplayParameter providing a String parameter type.

Synopsis

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.

Example

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

Motivation

Many parameters are naturally Strings, or can be expressed as Strings, hence this class.

Thrown Exceptions

To Do

Definition at line 96 of file DParameterString.h.


Constructor & Destructor Documentation

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.

(Required) copy constructor.

Destructor.

(Required) default constructor.


Member Function Documentation

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.

Return the current value of this parameter.

Definition at line 139 of file DParameterString.h.

References itsValue.


Member Data Documentation

Store for the default of this parameter.

Definition at line 150 of file DParameterString.h.

Referenced by defaultValue().

Store for the value of this parameter.

Definition at line 153 of file DParameterString.h.

Referenced by value().


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