casacore
Loading...
Searching...
No Matches
MCDoppler.h
Go to the documentation of this file.
1//# MCDoppler.h: MDoppler conversion routines
2//# Copyright (C) 1995,1996,1997,1998,1999,2002,2018
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 MEASURES_MCDOPPLER_H
27#define MEASURES_MCDOPPLER_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/measures/Measures/MeasBase.h>
32#include <casacore/measures/Measures/MeasRef.h>
33#include <casacore/measures/Measures/MCBase.h>
34#include <casacore/measures/Measures/MConvertBase.h>
35#include <casacore/measures/Measures/MDoppler.h>
36
37#include <mutex>
38
39namespace casacore { //# NAMESPACE CASACORE - BEGIN
40
41//# Forward Declarations
42class MCDoppler;
43class String;
44
45//# Typedefs
46
47// <summary> MDoppler conversion routines </summary>
48
49// <use visibility=local>
50
51// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
52// </reviewed>
53
54// <prerequisite>
55// <li> <linkto class=Measure>Measure</linkto> class
56// <li> <linkto class=MCBase>MCBase</linkto> base class
57// <li> <linkto class=MConvertBase>overall conversion</linkto> class
58// </prerequisite>
59//
60// <etymology>
61// Measure, Convert and Doppler
62// </etymology>
63//
64// <synopsis>
65// Contains state machinery and caching for actual conversions
66// </synopsis>
67//
68// <example>
69// Conversion of a radio Doppler to an optical
70// <srcblock>
71// #include <casacore/measures/Measures.h>
72// #include <casacore/measures/Measures/MDoppler.h>
73// MDoppler radio(0.01); // A radio Doppler value
74// cout << "Doppler radio = " << radio << "; optical = " <<
75// MDoppler::Convert(radio, MDoppler::OPTICAL)() << // Convert
76// endl;
77// </srcblock>
78// Setting up a conversion
79// <srcblock>
80// MDoppler::Convert to_opt(MDoppler::RADIO, MDoppler::OPTICAL);
81// for (Double d=0; d<0.1; d += 0.005) {
82// cout << "radio = " << d << " to optical = " <<
83// to_opt(d) << endl;
84// </srcblock>
85// </example>
86//
87// <motivation>
88// </motivation>
89//
90// <todo asof="1996/05/04">
91// </todo>
92
93class MCDoppler : public MCBase {
94
95public:
96
97 //# Friends
98 // Conversion of data
99 friend class MeasConvert<MDoppler>;
100
101 //# Constructors
102 // Default constructor
104
105 //# Destructor
107
108 //# Member functions
109 // Show the state of the conversion engine (mainly for debugging purposes)
111
112private:
113
114 //# Enumerations
115 // The list of actual routines provided.
116 // <note role=warning> Each <src>AA_BB</src> in the list points to routine
117 // that can be used in the FromTo list in the getConvert routine.
118 // In addition the type to which each is converted should be in the
119 // ToRef array, again in the proper order. </note>
130
131 //# Typedefs
132
133 //# Operators
134
135 //# General Member Functions
136
137 //# Enumerations
138
139 //# Cached Data
140
141 //# State machine data
142 // Transition list
144 // Transition matrix
146 // Object to ensure safe multi-threaded lazy single initialization
147 static std::once_flag theirInitOnceFlag;
148
149 //# Member functions
150
151 // Create conversion function pointer
152 virtual void getConvert(MConvertBase &mc,
153 const MRBase &inref,
154 const MRBase &outref);
155
156 // Create help structures for Measure conversion routines
157 virtual void initConvert(uInt which, MConvertBase &mc);
158
159 // Delete the pointers used in the MeasConvert help structure cache
160 virtual void clearConvert();
161
162 // Routine to convert Doppler from one reference frame to another
163 virtual void doConvert(MeasValue &in,
164 MRBase &inref,
165 MRBase &outref,
166 const MConvertBase &mc);
167 // Conversion routine to cater for inheritance question
169 MRBase &inref,
170 MRBase &outref,
171 const MConvertBase &mc);
172
173private:
174 // Fill the global state. Called using theirInitOnce.
175 static void doFillState();
176};
177
178 /*
179static class MCDoppler_initializer {
180 public:
181 MCDoppler_initializer( ) {
182 if ( ! initialized ) {
183 initialized = true;
184 MutexedInit init(MCDoppler::doFillState);
185 init.exec( );
186 }
187 }
188 private:
189 static bool initialized;
190} _local_static_MCDoppler_init;
191 */
192
193} //# NAMESPACE CASACORE - END
194
195#endif
void doConvert(MVDoppler &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)
Conversion routine to cater for inheritance question.
static String showState()
Show the state of the conversion engine (mainly for debugging purposes)
virtual void clearConvert()
Delete the pointers used in the MeasConvert help structure cache.
virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)
Routine to convert Doppler from one reference frame to another.
static uInt FromTo_p[MDoppler::N_Types][MDoppler::N_Types]
Transition matrix.
Definition MCDoppler.h:145
static void doFillState()
Fill the global state.
static std::once_flag theirInitOnceFlag
Object to ensure safe multi-threaded lazy single initialization.
Definition MCDoppler.h:147
Routes
The list of actual routines provided.
Definition MCDoppler.h:120
virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref)
Create conversion function pointer.
static uInt ToRef_p[N_Routes][3]
Transition list.
Definition MCDoppler.h:143
virtual void initConvert(uInt which, MConvertBase &mc)
Create help structures for Measure conversion routines.
MCDoppler()
Default constructor.
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49