casacore
Loading...
Searching...
No Matches
MVFrequency.h
Go to the documentation of this file.
1// # MVFrequency.h: Internal value for MFrequency
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: casa-feedback@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#ifndef CASA_MVFREQUENCY_H
27#define CASA_MVFREQUENCY_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32#include <casacore/casa/Quanta/QC.h>
33#include <casacore/casa/Quanta/Quantum.h>
34#include <casacore/casa/Quanta/MeasValue.h>
35#include <casacore/casa/iosfwd.h>
36
37namespace casacore { // # NAMESPACE CASACORE - BEGIN
38
39// # Forward Declarations
40
41// <summary> Internal value for MFrequency </summary>
42
43// <use visibility=export>
44
45// <reviewed reviewer="tcornwel" date="1996/02/23" tests="tMeasMath" demos="">
46// </reviewed>
47
48// <prerequisite>
49// <li> <linkto class=MeasValue>MeasValue</linkto>
50// </prerequisite>
51//
52// <etymology>
53// From Measure, Value and Frequency
54// </etymology>
55//
56// <synopsis>
57// An MVFrequency is a simple Double, to be used in the MFrequency measure.
58// Requirements can be found in the
59// <linkto class=MeasValue>MeasValue</linkto> base class.<br>
60// The only reasonable constructor is (but all MeasValue constructors are
61// present)
62// <src>MVFrequency(Double)</src> (with assumed Hz units);
63// and an <src>operator Double</src> takes
64// care of all other possibilities. Its external use is for
65// <linkto class=MeasConvert>MeasConvert</linkto>, to distinguish between
66// input in internal Measure units, and values which have to have
67// units applied.<br>
68// The MVFrequency(Quantum) constructors recognise the type of wave
69// characteristics presented from its units. Recognised are:
70// <ul>
71// <li> frequency (1/time)
72// <li> time
73// <li> angle/time
74// <li> wavelength
75// <li> 1/wavelength (in 2pi units)
76// <li> energy (h.nu)
77// <li> impulse
78// </ul>
79// <br> The frequency is returned in Hz with getValue(); or as a Quantity
80// in Hz with get(); or in one of the above units with get(unit).
81// </synopsis>
82//
83// <example>
84// See <linkto class=MFrequency>MFrequency</linkto>
85// </example>
86//
87// <motivation>
88// To aid coordinate transformations possibilities
89// </motivation>
90//
91// <todo asof="1996/04/15">
92// </todo>
93
94class MVFrequency : public MeasValue {
95 public:
96 // # Constructors
97 // Default constructor: generate a zero value
99 // Copy constructor
101 // Copy assignment
103 // Constructor from Double, assuming Hz
105 // Constructor from Quantum : value taken will be the canonical value
106 // <group>
107 MVFrequency(const Quantity &other);
109 // </group>
110 // Constructor from Vector. A zero value will be taken for an empty vector,
111 // the canonical value for a quantum vector.
112 // <thrown>
113 // <li> AipsError if vector length > 1
114 // </thrown>
115 // <group>
118 // </group>
119
120 // Destructor
122
123 // # Operators
124 // Conversion operator
125 operator Double() const;
126
127 // Addition
128 // <group>
131 // </group>
132 // Comparisons
133 // <group>
134 Bool operator==(const MVFrequency &other) const;
135 Bool operator!=(const MVFrequency &other) const;
136 Bool near(const MVFrequency &other, Double tol = 1e-13) const;
137 Bool nearAbs(const MVFrequency &other, Double tol = 1e-13) const;
138 // </group>
139
140 // # General member functions
141
142 // Tell me your type
143 // <group>
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 in Hz
154 // Get quantity in Hz
155 Quantity get() const;
156 // Get the wave characteristics 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>
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 makeF(Double v, const Unit &dt, Bool rev = False) const;
179};
180
181} // namespace casacore
182
183#endif
virtual Vector< Quantum< Double > > getRecordValue() const
Get the internal value as a Vector<Quantity>.
Double getValue() const
Adjust value: taken from base class, a NOP.
virtual void putVector(const Vector< Double > &in)
Set the value from internal units (set 0 for empty vector).
virtual Vector< Double > getVector() const
Get the value in internal units.
virtual MeasValue * clone() const
Clone.
MVFrequency & operator-=(const MVFrequency &other)
Bool operator==(const MVFrequency &other) const
Comparisons.
Quantity get() const
Get quantity in Hz.
virtual Bool putValue(const Vector< Quantum< Double > > &in)
Set the internal value if correct values and dimensions.
MVFrequency()
Default constructor: generate a zero value.
Bool operator!=(const MVFrequency &other) const
~MVFrequency()
Destructor.
MVFrequency(const MVFrequency &other)
Copy constructor.
MVFrequency(const Quantum< Vector< Double > > &other)
MVFrequency(const Quantity &other)
Constructor from Quantum : value taken will be the canonical value.
virtual void print(ostream &os) const
Print data.
static void assure(const MeasValue &in)
Tell me your type.
MVFrequency & operator+=(const MVFrequency &other)
Addition.
MVFrequency & operator=(const MVFrequency &other)
Copy assignment.
MVFrequency(const Vector< Quantity > &other)
Bool nearAbs(const MVFrequency &other, Double tol=1e-13) const
Bool near(const MVFrequency &other, Double tol=1e-13) const
MVFrequency(Double d)
Constructor from Double, assuming Hz.
Quantity get(const Unit &unit) const
Get the wave characteristics in (recognised) specified units.
MVFrequency(const Vector< Double > &other)
Constructor from Vector.
Double makeF(Double v, const Unit &dt, Bool rev=False) const
Get correct data type conversion factor from input Quantum.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Quantum< Double > Quantity
Definition Quantum.h:40
double Double
Definition aipstype.h:53