casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DParameterRange.h
Go to the documentation of this file.
1 //# DParameterRange.h: class to store and retrieve range parameters
2 //# Copyright (C) 2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef TRIALDISPLAY_DPARAMETERRANGE_H
29 #define TRIALDISPLAY_DPARAMETERRANGE_H
30 
31 #include <casa/aips.h>
33 namespace casa { //# NAMESPACE CASA - BEGIN
34 
35 // <summary>
36 // A helper class to deal with data ranges to support options
37 // </summary>
38 //
39 // <use visibility=export>
40 //
41 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
42 // </reviewed>
43 //
44 // <prerequisite>
45 // <li> DisplayParameter
46 // </prerequisite>
47 //
48 // <etymology>
49 // </etymology>
50 //
51 // <synopsis>
52 //
53 // </synopsis>
54 //
55 // <example>
56 // </example>
57 //
58 // <motivation>
59 // Making things easier
60 // </motivation>
61 //
62 // <todo>
63 // </todo>
64 //
65 
66  template <class T> class DParameterRange : public DisplayParameter {
67 
68  public:
69 
70  // Constructor taking the name of the parameter, a short
71  // description, some help text, a minimum value, a maximum value, a
72  // default value, a current value, and flags indicating whether the
73  // parameter is editable.
75  const casacore::String help, const T minimum, const T maximum,
76  const T resolution, const T defaultvalue, const T value,
77  const casacore::String context = "", const casacore::Bool editable = true,
78  const casacore::Bool provideentry = false, const casacore::Bool onrelease=false );
79 
80  // (Required) default constructor.
82 
83  // (Required) copy constructor.
84  DParameterRange(const DParameterRange<T> &other);
85 
86  // Destructor.
87  virtual ~DParameterRange();
88 
89  // (Required) copy assignment.
90  DParameterRange<T> &operator=(const DParameterRange<T> &other);
91 
92  // Parse <src>record</src>, and update this parameter if a field
93  // exists whose name matches that of this parameter. Return
94  // <src>true</src> if the parameter is changed, otherwise return
95  // <src>false</src>.
97 
98  // Place a record describing this parameter in a sub-field of
99  // <src>record</src> with name matching that of this parameter. If
100  // <src>overwrite</src> is <src>true</src>, then any existing field
101  // with matching name will be overwritten. If <src>fullrecord</src>
102  // is <src>true</src>, then a complete description of the parameter
103  // is given, otherwise just its current value is stored in
104  // <src>record</src>. Presently <src>fullrecord</src> is ignored.
105  virtual void toRecord(casacore::RecordInterface &record, const casacore::Bool fullrecord = true,
106  const casacore::Bool overwrite = false);
107 
108  // Return the minimum for this parameter.
109  T minimum() {
110  return itsMinimum;
111  }
112 
113  // Return the maximum for this parameter.
114  T maximum() {
115  return itsMaximum;
116  }
117 
118  // Return the resolution of this parameter.
120  return itsResolution;
121  }
122 
123  // Return the default for this parameter.
125  return itsDefault;
126  }
127 
128  // Return the current value of this parameter.
129  T value() {
130  return itsValue;
131  }
132 
133  // Return whether there should be a text box beside the slider.
134  // See 'intrange' in the autogui tool documentation for more information.
136  return itsProvideEntry;
137  }
138 
139  // Return whether the slider event should occur when the user releases the
140  // slider, i.e. at the end of setting the value, rather than in real time
141  // as the user moves the slider (good for operations which take a long time)
143  return itsOnRelease;
144  }
145 
146 
147  // Set or change the minimum for this parameter.
148  void setMinimum(const T minimum) {
150  }
151 
152  // Set or change the maximum for this parameter.
153  void setMaximum(const T maximum) {
155  }
156 
157  // Set or change the resolution for this parameter.
158  void setResolution(const T resolution) {
160  }
161 
162  // Set or change the default for this parameter.
165  }
166 
167  // Set or change the current value for this parameter.
168  void setValue(const T value) {
169  itsValue = value;
170  }
171 
172  // Convenient syntax to set (only) the value.
173  const T& operator=(const T &value) {
174  itsValue = value;
175  return value;
176  }
177 
178  // Set or change the provideentry state for this parameter.
179  void setProvideEntry(const casacore::Bool provideentry) {
180  itsProvideEntry = provideentry;
181  }
182 
183  // Set or change the onrelease state for this parameter.
184  void setOnRelease(const casacore::Bool onrelease) {
185  itsOnRelease = onrelease;
186  }
187 
188  private:
189 
190  // Store for the minimum of this parameter.
192 
193  // Store for the maximum of this parameter.
195 
196  // Store for the resolution of this parameter.
198 
199  // Store for the default of this parameter.
201 
202  // Store for the value of this parameter.
204 
205  // Store for the 'provideentry' state of this parameter.
207 
208  // Store for the 'onrelease' state of this parameter
210 
211  };
212 
213 } //# NAMESPACE CASA - END
214 
215 #ifndef AIPS_NO_TEMPLATE_SRC
216 #include <display/Display/DParameterRange.tcc>
217 #endif
218 
219 #endif
casacore::String name() const
Return the name of this parameter.
casacore::Bool provideEntry()
Return whether there should be a text box beside the slider.
T maximum()
Return the maximum for this parameter.
DParameterRange< T > & operator=(const DParameterRange< T > &other)
(Required) copy assignment.
DParameterRange()
(Required) default constructor.
casacore::String help() const
Return the help for this parameter.
T itsResolution
Store for the resolution of this parameter.
void setValue(const T value)
Set or change the current value for this parameter.
casacore::Bool itsOnRelease
Store for the &#39;onrelease&#39; state of this parameter.
casacore::String description() const
Return the description of this parameter.
void setMaximum(const T maximum)
Set or change the maximum for this parameter.
void setOnRelease(const casacore::Bool onrelease)
Set or change the onrelease state for this parameter.
void setDefaultValue(const T defaultValue)
Set or change the default for this parameter.
void setProvideEntry(const casacore::Bool provideentry)
Set or change the provideentry state for this parameter.
casacore::Bool editable() const
Return whether this parameter is editable.
void setResolution(const T resolution)
Set or change the resolution for this parameter.
T minimum()
Return the minimum for this parameter.
virtual ~DParameterRange()
Destructor.
casacore::String context() const
Return the context of this parameter.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void toRecord(casacore::RecordInterface &record, const casacore::Bool fullrecord=true, const casacore::Bool overwrite=false)
Place a record describing this parameter in a sub-field of record with name matching that of this par...
T itsMaximum
Store for the maximum of this parameter.
virtual casacore::Bool fromRecord(const casacore::RecordInterface &record)
Parse record, and update this parameter if a field exists whose name matches that of this parameter...
casacore::Bool itsProvideEntry
Store for the &#39;provideentry&#39; state of this parameter.
void setMinimum(const T minimum)
Set or change the minimum for this parameter.
T value()
Return the current value of this parameter.
T itsValue
Store for the value of this parameter.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
const T & operator=(const T &value)
Convenient syntax to set (only) the value.
casacore::Bool onRelease()
Return whether the slider event should occur when the user releases the slider, i.e.
T defaultValue()
Return the default for this parameter.
Abstract base class for Record classes.
T resolution()
Return the resolution of this parameter.
T itsDefault
Store for the default of this parameter.
T itsMinimum
Store for the minimum of this parameter.