casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCFrequency.h
Go to the documentation of this file.
1 //# MCFrequency.h: MFrequency conversion routines
2 //# Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2003
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 //#
27 //# $Id$
28 
29 #ifndef MEASURES_MCFREQUENCY_H
30 #define MEASURES_MCFREQUENCY_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
39 #include <casacore/casa/OS/Mutex.h>
40 
41 namespace casacore { //# NAMESPACE CASACORE - BEGIN
42 
43 //# Forward Declarations
44 class MCFrequency;
45 class MDoppler;
46 class MVPosition;
47 class MVDirection;
48 class Aberration;
49 class String;
50 
51 //# Typedefs
52 
53 // <summary> MFrequency conversion routines </summary>
54 
55 // <use visibility=local>
56 
57 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
58 // </reviewed>
59 
60 // <prerequisite>
61 // <li> <linkto class=Measure>Measure</linkto> class
62 // <li> <linkto class=MCBase>MCBase</linkto> base class
63 // <li> <linkto class=MConvertBase>overall conversion</linkto> class
64 // </prerequisite>
65 //
66 // <etymology>
67 // Measure, Convert and Frequency
68 // </etymology>
69 //
70 // <synopsis>
71 // Contains state machinery and caching for actual conversions
72 // </synopsis>
73 //
74 // <example>
75 // Get the Doppler shift for an oberved HI frequency of 1380 MHz
76 // <srcblock>
77 // #include <casacore/measures/Measures.h>
78 // #include <casacore/measures/Measures/MDoppler.h>
79 // #include <casacore/measures/Measures/MFrequency.h>
80 // cout << "Redshift for 1380 MHz: " <<
81 // MDoppler::Convert( MFrequency( Quantity(1380., "MHz"),
82 // MFrequency::TOPO).toDoppler(QC::HI),
83 // MDoppler::Z)() << endl;
84 // </srcblock>
85 // </example>
86 //
87 // <motivation>
88 // </motivation>
89 //
90 // <todo asof="2003/03/03">
91 // </todo>
92 
93 class MCFrequency : public MCBase {
94 
95 public:
96  //# Friends
97  // Conversion of data
98  friend class MeasConvert<MFrequency>;
99 
100  //# Constructors
101  // Default constructor
102  MCFrequency();
103 
104  //# Destructor
105  ~MCFrequency();
106 
107  //# Member functions
108  // Show the state of the conversion engine (mainly for debugging purposes)
109  static String showState();
110 
111 private:
112  //# Enumerations
113  // The list of actual routines provided.
114  // <note role=warning> Each <src>AA_BB</src> in the list points to routine
115  // that can be used in the FromTo list in the getConvert routine.
116  // In addition the type to which each is converted should be in the
117  // ToRef array, again in the proper order. </note>
118  enum Routes {
136 
137  //# Typedefs
138 
139  //# Operators
140 
141  //# General Member Functions
142 
143  //# Enumerations
144 
145  //# Cached Data
150 
151  //# State machine data
152  // Transition list
153  static uInt ToRef_p[N_Routes][3];
154  // Transition matrix
156  // Object to ensure safe multi-threaded lazy single initialization
158 
159  //# Constructors
160  // Copy constructor (not implemented)
161  MCFrequency(const MCFrequency &other);
162  // Assignment (not implemented)
163  MCFrequency &operator=(const MCFrequency &other);
164 
165  //# Member functions
166  // Create conversion function pointer
167  virtual void getConvert(MConvertBase &mc,
168  const MRBase &inref,
169  const MRBase &outref);
170 
171  // Create help structures for Measure conversion routines
172  virtual void initConvert(uInt which, MConvertBase &mc);
173 
174  // Delete the pointers used in the MeasConvert help structure cache
175  virtual void clearConvert();
176 
177  // Routine to convert frequency from one reference frame to another
178  virtual void doConvert(MeasValue &in,
179  MRBase &inref,
180  MRBase &outref,
181  const MConvertBase &mc);
182  // Conversion routine to cater for inheritance question
183  void doConvert(MVFrequency &in,
184  MRBase &inref,
185  MRBase &outref,
186  const MConvertBase &mc);
187 
188 private:
189  // Fill the global state. Called using theirInitOnce.
190  static void doFillState();
191 };
192 
193 
194 } //# NAMESPACE CASACORE - END
195 
196 #endif
Wrapper around std::call_once.
Definition: Mutex.h:214
virtual void clearConvert()
Delete the pointers used in the MeasConvert help structure cache.
Conversion of Measures.
Definition: MDirection.h:43
Base for Reference frame for physical measures.
Definition: MRBase.h:103
Internal value for MFrequency.
Definition: MVFrequency.h:97
MVPosition * MVPOS1
Definition: MCFrequency.h:146
Base for specific measure conversions.
Definition: MCBase.h:119
virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)
Routine to convert frequency from one reference frame to another.
Aberration * ABERTO
Definition: MCFrequency.h:149
virtual void initConvert(uInt which, MConvertBase &mc)
Create help structures for Measure conversion routines.
Routes
The list of actual routines provided.
Definition: MCFrequency.h:118
A Measure: wave characteristics.
Definition: MFrequency.h:161
virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref)
Create conversion function pointer.
static uInt FromTo_p[MFrequency::N_Types][MFrequency::N_Types]
Transition matrix.
Definition: MCFrequency.h:155
Aberration * ABERFROM
Definition: MCFrequency.h:148
Base class for values in a Measure.
Definition: MeasValue.h:107
static uInt ToRef_p[N_Routes][3]
Transition list.
Definition: MCFrequency.h:153
MVDirection * MVDIR1
Definition: MCFrequency.h:147
static CallOnce0 theirInitOnce
Object to ensure safe multi-threaded lazy single initialization.
Definition: MCFrequency.h:157
MCFrequency & operator=(const MCFrequency &other)
Assignment (not implemented)
A 3D vector in space.
Definition: MVPosition.h:113
Aberration class and calculations.
Definition: Aberration.h:109
MCFrequency()
Default constructor.
MFrequency conversion routines.
Definition: MCFrequency.h:93
static void doFillState()
Fill the global state.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Vector of three direction cosines.
Definition: MVDirection.h:106
unsigned int uInt
Definition: aipstype.h:51
Conversion of Measures Base.
Definition: MConvertBase.h:147
static String showState()
Show the state of the conversion engine (mainly for debugging purposes)
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42