DParameterRange.h

Go to the documentation of this file.
00001 //# DParameterRange.h: class to store and retrieve range parameters
00002 //# Copyright (C) 2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TRIALDISPLAY_DPARAMETERRANGE_H
00029 #define TRIALDISPLAY_DPARAMETERRANGE_H
00030 
00031 #include <casa/aips.h>
00032 #include <display/Display/DisplayParameter.h>
00033 namespace casa { //# NAMESPACE CASA - BEGIN
00034 
00035 // <summary>
00036 // A helper class to deal with data ranges to support options
00037 // </summary>
00038 //
00039 // <use visibility=export>
00040 //
00041 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00042 // </reviewed>
00043 //
00044 // <prerequisite>
00045 //   <li> DisplayParameter
00046 // </prerequisite>
00047 //
00048 // <etymology>
00049 // </etymology>
00050 //
00051 // <synopsis>
00052 //
00053 // </synopsis>
00054 //
00055 // <example>
00056 // </example>
00057 //
00058 // <motivation>
00059 // Making things easier
00060 // </motivation>
00061 //
00062 // <todo>
00063 // </todo>
00064 //
00065 
00066         template <class T> class DParameterRange : public DisplayParameter {
00067 
00068         public:
00069 
00070                 // Constructor taking the name of the parameter, a short
00071                 // description, some help text, a minimum value, a maximum value, a
00072                 // default value, a current value, and flags indicating whether the
00073                 // parameter is editable.
00074                 DParameterRange(const String name, const String description,
00075                                 const String help, const T minimum, const T maximum,
00076                                 const T resolution, const T defaultvalue, const T value,
00077                                 const String context = "", const Bool editable = True,
00078                                 const Bool provideentry = False, const Bool onrelease=False );
00079 
00080                 // (Required) default constructor.
00081                 DParameterRange();
00082 
00083                 // (Required) copy constructor.
00084                 DParameterRange(const DParameterRange<T> &other);
00085 
00086                 // Destructor.
00087                 virtual ~DParameterRange();
00088 
00089                 // (Required) copy assignment.
00090                 DParameterRange<T> &operator=(const DParameterRange<T> &other);
00091 
00092                 // Parse <src>record</src>, and update this parameter if a field
00093                 // exists whose name matches that of this parameter.  Return
00094                 // <src>True</src> if the parameter is changed, otherwise return
00095                 // <src>False</src>.
00096                 virtual Bool fromRecord(const RecordInterface &record);
00097 
00098                 // Place a record describing this parameter in a sub-field of
00099                 // <src>record</src> with name matching that of this parameter.  If
00100                 // <src>overwrite</src> is <src>True</src>, then any existing field
00101                 // with matching name will be overwritten.  If <src>fullrecord</src>
00102                 // is <src>True</src>, then a complete description of the parameter
00103                 // is given, otherwise just its current value is stored in
00104                 // <src>record</src>.  Presently <src>fullrecord</src> is ignored.
00105                 virtual void toRecord(RecordInterface &record, const Bool fullrecord = True,
00106                                       const Bool overwrite = False);
00107 
00108                 // Return the minimum for this parameter.
00109                 T minimum() {
00110                         return itsMinimum;
00111                 }
00112 
00113                 // Return the maximum for this parameter.
00114                 T maximum() {
00115                         return itsMaximum;
00116                 }
00117 
00118                 // Return the resolution of this parameter.
00119                 T resolution() {
00120                         return itsResolution;
00121                 }
00122 
00123                 // Return the default for this parameter.
00124                 T defaultValue() {
00125                         return itsDefault;
00126                 }
00127 
00128                 // Return the current value of this parameter.
00129                 T value() {
00130                         return itsValue;
00131                 }
00132 
00133                 // Return whether there should be a text box beside the slider.
00134                 // See 'intrange' in the autogui tool documentation for more information.
00135                 Bool provideEntry() {
00136                         return itsProvideEntry;
00137                 }
00138 
00139                 // Return whether the slider event should occur when the user releases the
00140                 // slider, i.e. at the end of setting the value, rather than in real time
00141                 // as the user moves the slider (good for operations which take a long time)
00142                 Bool onRelease( ) {
00143                         return itsOnRelease;
00144                 }
00145 
00146 
00147                 // Set or change the minimum for this parameter.
00148                 void setMinimum(const T minimum) {
00149                         itsMinimum = minimum;
00150                 }
00151 
00152                 // Set or change the maximum for this parameter.
00153                 void setMaximum(const T maximum) {
00154                         itsMaximum = maximum;
00155                 }
00156 
00157                 // Set or change the resolution for this parameter.
00158                 void setResolution(const T resolution) {
00159                         itsResolution = resolution;
00160                 }
00161 
00162                 // Set or change the default for this parameter.
00163                 void setDefaultValue(const T defaultValue) {
00164                         itsDefault = defaultValue;
00165                 }
00166 
00167                 // Set or change the current value for this parameter.
00168                 void setValue(const T value) {
00169                         itsValue = value;
00170                 }
00171 
00172                 // Convenient syntax to set (only) the value.
00173                 const T& operator=(const T &value) {
00174                         itsValue = value;
00175                         return value;
00176                 }
00177 
00178                 // Set or change the provideentry state for this parameter.
00179                 void setProvideEntry(const Bool provideentry) {
00180                         itsProvideEntry = provideentry;
00181                 }
00182 
00183                 // Set or change the onrelease state for this parameter.
00184                 void setOnRelease(const Bool onrelease) {
00185                         itsOnRelease = onrelease;
00186                 }
00187 
00188         private:
00189 
00190                 // Store for the minimum of this parameter.
00191                 T itsMinimum;
00192 
00193                 // Store for the maximum of this parameter.
00194                 T itsMaximum;
00195 
00196                 // Store for the resolution of this parameter.
00197                 T itsResolution;
00198 
00199                 // Store for the default of this parameter.
00200                 T itsDefault;
00201 
00202                 // Store for the value of this parameter.
00203                 T itsValue;
00204 
00205                 // Store for the 'provideentry' state of this parameter.
00206                 Bool itsProvideEntry;
00207 
00208                 // Store for the 'onrelease' state of this parameter
00209                 Bool itsOnRelease;
00210 
00211         };
00212 
00213 } //# NAMESPACE CASA - END
00214 
00215 #ifndef AIPS_NO_TEMPLATE_SRC
00216 #include <display/Display/DParameterRange.tcc>
00217 #endif
00218 
00219 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1