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