casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MVDoppler.h
Go to the documentation of this file.
1 //# MVDoppler.h: Internal value for MDoppler
2 //# Copyright (C) 1996,1997,1998,1999,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 CASA_MVDOPPLER_H
29 #define CASA_MVDOPPLER_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
38 #include <casacore/casa/iosfwd.h>
39 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42 //# Forward Declarations
43 
44 // <summary> Internal value for MDoppler </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="tcornwel" date="1996/02/23" tests="tMeasMath" demos="">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> <linkto class=MeasValue>MeasValue</linkto>
53 // </prerequisite>
54 //
55 // <etymology>
56 // From Measure, Value and Doppler
57 // </etymology>
58 //
59 // <synopsis>
60 // An MVDoppler is a simple Double, to be used in the MDoppler measure.
61 // Requirements can be found in the
62 // <linkto class=MeasValue>MeasValue</linkto> base class.<br>
63 // The only reasonable constructor is (but all MeasValue constructors are
64 // present)
65 // <src>MVDoppler(Double)</src>; and an <src>operator Double</src> takes
66 // care of all other possibilities. Its external use is for
67 // <linkto class=MeasConvert>MeasConvert</linkto>, to distinguish between
68 // input in internal Measure units, and values which have to have
69 // units applied.<br>
70 // The MVDoppler(Quantum) constructors recognise the type of representation
71 // characteristics presented from its units. Recognised are:
72 // <ul>
73 // <li> no dimensions: value assumed to be dimensionless as is
74 // <li> velocity: value will be divided by c (light velocity)
75 // </ul>
76 // <br> The Doppler is returned dimensionless with getValue(); or as a Quantity
77 // in m/s with get(); or in one of the related units with get(unit).
78 // </synopsis>
79 //
80 // <example>
81 // See <linkto class=MDoppler>MDoppler</linkto>
82 // </example>
83 //
84 // <motivation>
85 // To aid coordinate transformations possibilities
86 // </motivation>
87 //
88 // <todo asof="1996/04/15">
89 // </todo>
90 
91 class MVDoppler : public MeasValue {
92 
93 public:
94 
95  //# Constructors
96  // Default constructor: generate a zero value
97  MVDoppler();
98  // Copy constructor
99  MVDoppler(const MVDoppler &other);
100  // Copy assignment
101  MVDoppler &operator=(const MVDoppler &other);
102  // Constructor from Double
103  MVDoppler(Double d);
104  // Constructor from Quantum : value taken will be the canonical value
105  // <group>
106  MVDoppler(const Quantity &other);
107  MVDoppler(const Quantum<Vector<Double> > &other);
108  // </group>
109  // Constructor from Vector. A zero value will be taken for an empty vector,
110  // the canonical value for a quantum vector.
111  // <thrown>
112  // <li> AipsError if vector length > 1
113  // </thrown>
114  // <group>
115  MVDoppler(const Vector<Double> &other);
116  MVDoppler(const Vector<Quantity> &other);
117  // </group>
118 
119  // Destructor
120  ~MVDoppler();
121 
122  //# Operators
123  // Conversion operator
124  operator Double() const;
125 
126  // Addition
127  // <group>
128  MVDoppler &operator+=(const MVDoppler &other);
129  MVDoppler &operator-=(const MVDoppler &other);
130  // </group>
131  // Comparisons
132  // <group>
133  Bool operator==(const MVDoppler &other) const;
134  Bool operator!=(const MVDoppler &other) const;
135  Bool near(const MVDoppler &other, Double tol = 1e-13) const;
136  Bool nearAbs(const MVDoppler &other, Double tol = 1e-13) const;
137  // </group>
138 
139  //# General member functions
140 
141  // Tell me your type
142  // <group>
143  virtual uInt type() const;
144  static void assure(const MeasValue &in);
145  // </group>
146 
147  // Print data
148  virtual void print(ostream &os) const;
149  // Clone
150  virtual MeasValue *clone() const;
151  // Adjust value: taken from base class, a NOP.
152  // Get value as ratio
153  Double getValue() const;
154  // Get quantity in m/s
155  Quantity get() const;
156  // Get the Doppler value in (recognised) specified units
157  Quantity get(const Unit &unit) const;
158  // Get the value in internal units
159  virtual Vector<Double> getVector() const;
160  // Set the value from internal units (set 0 for empty vector)
161  virtual void putVector(const Vector<Double> &in);
162  // Get the internal value as a <src>Vector<Quantity></src>. Usable in
163  // records. The getXRecordValue() gets additional information for records.
164  // Note that the Vectors could be empty.
165  // <group>
166  virtual Vector<Quantum<Double> > getRecordValue() const;
167  // </group>
168  // Set the internal value if correct values and dimensions
169  virtual Bool putValue(const Vector<Quantum<Double> > &in);
170 
171 private:
172  //# Data
173  // Value
175 
176  //# Member functions
177  // Get correct data type conversion factor from input Quantum
178  Double makeD(Double v, const Unit &dt, Bool rev=False) const;
179 };
180 
181 
182 } //# NAMESPACE CASACORE - END
183 
184 #endif
Double val
Value.
Definition: MVDoppler.h:174
Bool operator==(const MVDoppler &other) const
Comparisons.
MVDoppler & operator+=(const MVDoppler &other)
Addition.
Double getValue() const
Adjust value: taken from base class, a NOP.
virtual Vector< Double > getVector() const
Get the value in internal units.
Internal value for MDoppler.
Definition: MVDoppler.h:91
MVDoppler()
Default constructor: generate a zero value.
virtual uInt type() const
Tell me your type.
Bool nearAbs(const MVDoppler &other, Double tol=1e-13) const
Bool near(const MVDoppler &other, Double tol=1e-13) const
virtual Bool putValue(const Vector< Quantum< Double > > &in)
Set the internal value if correct values and dimensions.
defines physical units
Definition: Unit.h:189
MVDoppler & operator-=(const MVDoppler &other)
Base class for values in a Measure.
Definition: MeasValue.h:107
MVDoppler & operator=(const MVDoppler &other)
Copy assignment.
double Double
Definition: aipstype.h:55
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual Vector< Quantum< Double > > getRecordValue() const
Get the internal value as a Vector&lt;Quantity&gt;.
const Bool False
Definition: aipstype.h:44
static void assure(const MeasValue &in)
virtual MeasValue * clone() const
Clone.
const Double e
e and functions thereof:
Double makeD(Double v, const Unit &dt, Bool rev=False) const
Get correct data type conversion factor from input Quantum.
virtual void putVector(const Vector< Double > &in)
Set the value from internal units (set 0 for empty vector)
~MVDoppler()
Destructor.
virtual void print(ostream &os) const
Print data.
unsigned int uInt
Definition: aipstype.h:51
Bool operator!=(const MVDoppler &other) const
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42