casacore
MCEarthMagnetic.h
Go to the documentation of this file.
1 //# MCEarthMagnetic.h: MEarthMagnetic conversion routines
2 //# Copyright (C) 1998,1999,2000,2002,2004
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_MCEARTHMAGNETIC_H
30 #define MEASURES_MCEARTHMAGNETIC_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/measures/Measures/MEarthMagnetic.h>
35 #include <casacore/measures/Measures/MeasBase.h>
36 #include <casacore/measures/Measures/MeasRef.h>
37 #include <casacore/measures/Measures/MCBase.h>
38 #include <casacore/measures/Measures/MConvertBase.h>
39 #include <casacore/measures/Measures/MeasMath.h>
40 #include <casacore/casa/OS/Mutex.h>
41 
42 namespace casacore { //# NAMESPACE CASACORE - BEGIN
43 
44 //# Forward Declarations
45 class MCEarthMagnetic;
46 class MVPosition;
47 class EarthField;
48 class String;
49 template <class T> class Vector;
50 
51 //# Typedefs
52 
53 // <summary> MEarthMagnetic conversion routines </summary>
54 
55 // <use visibility=local>
56 
57 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMEarthMagnetic" 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 EarthMagnetic
68 // </etymology>
69 //
70 // <synopsis>
71 // Contains state machinery and caching for actual conversions
72 // </synopsis>
73 //
74 // <example>
75 // See <linkto module=Measures>Measures</linkto> module description for
76 // conversion examples.
77 // </example>
78 //
79 // <motivation>
80 // </motivation>
81 //
82 // <todo asof="1998/04/21">
83 // <li> Use MCDirection routines directly
84 // </todo>
85 
86 class MCEarthMagnetic : public MCBase {
87 
88 public:
89 
90  //# Friends
91  // Conversion of data
92  friend class MeasConvert<MEarthMagnetic>;
93 
94  //# Constructors
95  // Default constructor
97 
98  //# Destructor
100 
101  //# Member functions
102  // Show the state of the conversion engine (mainly for debugging purposes)
103  static String showState();
104 
105 private:
106  //# Enumerations
107  // The list of actual routines provided.
108  // <note role=warning> Each <src>AA_BB</src> in the list points to routine
109  // that can be used in the FromTo list in the getConvert routine.
110  // In addition the type to which each is converted should be in the
111  // ToRef array, again in the proper order. </note>
112  enum Routes {
158  // General for Models
161  // Individual models. Order should be the same as in MEarthMagnetic.h
163  };
164 
165  //# Typedefs
166 
167  //# Operators
168 
169  //# General Member Functions
170 
171  //# Enumerations
172 
173  //# Cached Data
177 
178  //# State machine data
179  // Transition list
180  static uInt ToRef_p[N_Routes][3];
181  // Transition matrix
183  // Mutex for thread-safety.
185 
186  // Fill the global state in a thread-safe way.
187  static void fillState()
188  { theirMutexedInit.exec(); }
189 
190  //# Constructors
191  // Copy constructor (not implemented)
192  MCEarthMagnetic(const MCEarthMagnetic &other);
193  // Assignment (not implemented)
195 
196  //# Member functions
197 
198  // Create conversion function pointer
199  virtual void getConvert(MConvertBase &mc,
200  const MRBase &inref,
201  const MRBase &outref);
202 
203  // Create help structures for Measure conversion routines
204  virtual void initConvert(uInt which, MConvertBase &mc);
205 
206  // Delete the pointers used in the MeasConvert help structure cache
207  virtual void clearConvert();
208 
209  // Routines to convert EarthMagnetics from one reference frame to another
210  virtual void doConvert(MeasValue &in,
211  MRBase &inref,
212  MRBase &outref,
213  const MConvertBase &mc);
214  // Conversion routine to cater for inheritance question
215  void doConvert(MVEarthMagnetic &in,
216  MRBase &inref,
217  MRBase &outref,
218  const MConvertBase &mc);
219 
220 private:
221  // Fill the global state in a thread-safe way.
222  static void doFillState (void*);
223 };
224 
225 
226 } //# NAMESPACE CASACORE - END
227 
228 #endif
229 
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
static void fillState()
Fill the global state in a thread-safe way.
EarthField class model calculations.
Definition: EarthField.h:130
Base for specific measure conversions.
Definition: MCBase.h:119
virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)
Routines to convert EarthMagnetics from one reference frame to another.
Measure conversion aid routines.
Definition: MeasMath.h:96
virtual void initConvert(uInt which, MConvertBase &mc)
Create help structures for Measure conversion routines.
static void doFillState(void *)
Fill the global state in a thread-safe way.
Thread-safe initialization of global variables.
Definition: Mutex.h:161
virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref)
Create conversion function pointer.
static uInt FromTo_p[MEarthMagnetic::N_Types][MEarthMagnetic::N_Types]
Transition matrix.
A Measure: Magnetic field on Earth.
virtual void clearConvert()
Delete the pointers used in the MeasConvert help structure cache.
MCEarthMagnetic & operator=(const MCEarthMagnetic &other)
Assignment (not implemented)
static MutexedInit theirMutexedInit
Mutex for thread-safety.
static uInt ToRef_p[N_Routes][3]
Transition list.
Base class for values in a Measure.
Definition: MeasValue.h:107
MEarthMagnetic conversion routines.
A 3D Earth magnetic field vector.
A 3D vector in space.
Definition: MVPosition.h:113
void exec()
Execute the initialization function if not done yet.
Definition: Mutex.h:171
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
static String showState()
Show the state of the conversion engine (mainly for debugging purposes)
unsigned int uInt
Definition: aipstype.h:48
MCEarthMagnetic()
Default constructor.
Conversion of Measures Base.
Definition: MConvertBase.h:147