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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Arrays/Vector.h>
33#include <casacore/casa/Quanta/QC.h>
34#include <casacore/casa/Quanta/Quantum.h>
35#include <casacore/casa/Quanta/MeasValue.h>
36#include <casacore/casa/iosfwd.h>
37
38namespace casacore { //# NAMESPACE CASACORE - BEGIN
39
40//# Forward Declarations
41
42// <summary> Internal value for MFrequency </summary>
43
44// <use visibility=export>
45
46// <reviewed reviewer="tcornwel" date="1996/02/23" tests="tMeasMath" demos="">
47// </reviewed>
48
49// <prerequisite>
50// <li> <linkto class=MeasValue>MeasValue</linkto>
51// </prerequisite>
52//
53// <etymology>
54// From Measure, Value and Frequency
55// </etymology>
56//
57// <synopsis>
58// An MVFrequency is a simple Double, to be used in the MFrequency measure.
59// Requirements can be found in the
60// <linkto class=MeasValue>MeasValue</linkto> base class.<br>
61// The only reasonable constructor is (but all MeasValue constructors are
62// present)
63// <src>MVFrequency(Double)</src> (with assumed Hz units);
64// and an <src>operator Double</src> takes
65// care of all other possibilities. Its external use is for
66// <linkto class=MeasConvert>MeasConvert</linkto>, to distinguish between
67// input in internal Measure units, and values which have to have
68// units applied.<br>
69// The MVFrequency(Quantum) constructors recognise the type of wave
70// characteristics presented from its units. Recognised are:
71// <ul>
72// <li> frequency (1/time)
73// <li> time
74// <li> angle/time
75// <li> wavelength
76// <li> 1/wavelength (in 2pi units)
77// <li> energy (h.nu)
78// <li> impulse
79// </ul>
80// <br> The frequency is returned in Hz with getValue(); or as a Quantity
81// in Hz with get(); or in one of the above units with get(unit).
82// </synopsis>
83//
84// <example>
85// See <linkto class=MFrequency>MFrequency</linkto>
86// </example>
87//
88// <motivation>
89// To aid coordinate transformations possibilities
90// </motivation>
91//
92// <todo asof="1996/04/15">
93// </todo>
94
95class MVFrequency : public MeasValue {
96
97public:
98
99 //# Constructors
100 // Default constructor: generate a zero value
102 // Copy constructor
104 // Copy assignment
106 // Constructor from Double, assuming Hz
108 // Constructor from Quantum : value taken will be the canonical value
109 // <group>
110 MVFrequency(const Quantity &other);
112 // </group>
113 // Constructor from Vector. A zero value will be taken for an empty vector,
114 // the canonical value for a quantum vector.
115 // <thrown>
116 // <li> AipsError if vector length > 1
117 // </thrown>
118 // <group>
121 // </group>
122
123 // Destructor
125
126 //# Operators
127 // Conversion operator
128 operator Double() const;
129
130 // Addition
131 // <group>
134 // </group>
135 // Comparisons
136 // <group>
137 Bool operator==(const MVFrequency &other) const;
138 Bool operator!=(const MVFrequency &other) const;
139 Bool near(const MVFrequency &other, Double tol = 1e-13) const;
140 Bool nearAbs(const MVFrequency &other, Double tol = 1e-13) const;
141 // </group>
142
143 //# General member functions
144
145 // Tell me your type
146 // <group>
147 static void assure(const MeasValue &in);
148 // </group>
149
150 // Print data
151 virtual void print(ostream &os) const;
152 // Clone
153 virtual MeasValue *clone() const;
154 // Adjust value: taken from base class, a NOP.
155 // Get value in Hz
157 // Get quantity in Hz
158 Quantity get() const;
159 // Get the wave characteristics in (recognised) specified units
160 Quantity get(const Unit &unit) const;
161 // Get the value in internal units
162 virtual Vector<Double> getVector() const;
163 // Set the value from internal units (set 0 for empty vector)
164 virtual void putVector(const Vector<Double> &in);
165 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
166 // records. The getXRecordValue() gets additional information for records.
167 // Note that the Vectors could be empty.
168 // <group>
170 // </group>
171 // Set the internal value if correct values and dimensions
172 virtual Bool putValue(const Vector<Quantum<Double> > &in);
173
174private:
175 //# Data
176 // Value
178
179 //# Member functions
180 // Get correct data type conversion factor from input Quantum
181 Double makeF(Double v, const Unit &dt, Bool rev=False) const;
182};
183
184
185} //# NAMESPACE CASACORE - END
186
187#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.
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53