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 public:
95 // # Friends
96 // Conversion of data
97 friend class MeasConvert<MDoppler>;
98
99 // # Constructors
100 // Default constructor
102
103 // # Destructor
105
106 // # Member functions
107 // Show the state of the conversion engine (mainly for debugging purposes)
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>
128
129 // # Typedefs
130
131 // # Operators
132
133 // # General Member Functions
134
135 // # Enumerations
136
137 // # Cached Data
138
139 // # State machine data
140 // Transition list
142 // Transition matrix
144 // Object to ensure safe multi-threaded lazy single initialization
145 static std::once_flag theirInitOnceFlag;
146
147 // # Member functions
148
149 // Create conversion function pointer
150 virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref);
151
152 // Create help structures for Measure conversion routines
153 virtual void initConvert(uInt which, MConvertBase &mc);
154
155 // Delete the pointers used in the MeasConvert help structure cache
156 virtual void clearConvert();
157
158 // Routine to convert Doppler from one reference frame to another
159 virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc);
160 // Conversion routine to cater for inheritance question
161 void doConvert(MVDoppler &in, MRBase &inref, MRBase &outref, const MConvertBase &mc);
162
163 private:
164 // Fill the global state. Called using theirInitOnce.
165 static void doFillState();
166};
167
168/*
169static class MCDoppler_initializer {
170public:
171 MCDoppler_initializer( ) {
172 if ( ! initialized ) {
173 initialized = true;
174 MutexedInit init(MCDoppler::doFillState);
175 init.exec( );
176 }
177 }
178private:
179 static bool initialized;
180} _local_static_MCDoppler_init;
181*/
182
183} // namespace casacore
184
185#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:143
static void doFillState()
Fill the global state.
static std::once_flag theirInitOnceFlag
Object to ensure safe multi-threaded lazy single initialization.
Definition MCDoppler.h:145
Routes
The list of actual routines provided.
Definition MCDoppler.h:117
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:141
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:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49