casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCDirection.h
Go to the documentation of this file.
1 //# MCDirection.h: MDirection conversion routines
2 //# Copyright (C) 1995-2000,2002,2004,2007
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_MCDIRECTION_H
30 #define MEASURES_MCDIRECTION_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
41 
42 #include <mutex>
43 
44 namespace casacore { //# NAMESPACE CASACORE - BEGIN
45 
46 //# Forward Declarations
47 class MCDirection;
48 class MVPosition;
49 class String;
50 
51 //# Typedefs
52 
53 // <summary> MDirection 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 Direction
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="2000/09/12">
83 // <li> nothing I know
84 // </todo>
85 
86 class MCDirection : public MCBase {
87 
88 public:
89 
90  //# Friends
91  // Conversion of data
92  friend class MeasConvert<MDirection>;
93 
94  //# Constructors
95  // Default constructor
96  MCDirection();
97 
98  //# Destructor
99  ~MCDirection();
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 {
162  // General for Planets
167  // Individual planets. Order should be the same as in MDirection.h
178 
179  //# Typedefs
180 
181  //# Operators
182 
183  //# General Member Functions
184 
185  //# Enumerations
186 
187  //# Cached Data
191 
192  //# State machine data
193  // Transition list
194  static uInt ToRef_p[N_Routes][3];
195  // Transition matrix
197  // Object to ensure safe multi-threaded lazy single initialization
198  static std::once_flag theirInitOnceFlag;
199 
200  //# Constructors
201  // Copy constructor (not implemented)
202  MCDirection(const MCDirection &other);
203  // Assignment (not implemented)
204  MCDirection &operator=(const MCDirection &other);
205 
206  //# Member functions
207 
208  // Create conversion function pointer
209  virtual void getConvert(MConvertBase &mc,
210  const MRBase &inref,
211  const MRBase &outref);
212 
213  // Create help structures for Measure conversion routines
214  virtual void initConvert(uInt which, MConvertBase &mc);
215 
216  // Delete the pointers used in the MeasConvert help structure cache
217  virtual void clearConvert();
218 
219  // Routines to convert directions from one reference frame to another
220  virtual void doConvert(MeasValue &in,
221  MRBase &inref,
222  MRBase &outref,
223  const MConvertBase &mc);
224  // Conversion routine to cater for inheritance question
225  void doConvert(MVDirection &in,
226  MRBase &inref,
227  MRBase &outref,
228  const MConvertBase &mc);
229 
230 private:
231  // Fill the global state. Called using theirInitOnce.
232  static void doFillState();
233 };
234 
235 
236 } //# NAMESPACE CASACORE - END
237 
238 #endif
239 
A Measure: astronomical direction.
Definition: MDirection.h:174
Vector< Double > * VEC61
Definition: MCDirection.h:189
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
Base for specific measure conversions.
Definition: MCBase.h:119
Vector< Double > * VEC63
Definition: MCDirection.h:189
Measure conversion aid routines.
Definition: MeasMath.h:96
MVPosition * MVPOS2
Definition: MCDirection.h:188
MDirection conversion routines.
Definition: MCDirection.h:86
Vector< Double > * VEC62
Definition: MCDirection.h:189
General for Planets.
Definition: MCDirection.h:163
virtual void initConvert(uInt which, MConvertBase &mc)
Create help structures for Measure conversion routines.
Base class for values in a Measure.
Definition: MeasValue.h:107
static std::once_flag theirInitOnceFlag
Object to ensure safe multi-threaded lazy single initialization.
Definition: MCDirection.h:198
virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref)
Create conversion function pointer.
static String showState()
Show the state of the conversion engine (mainly for debugging purposes)
static uInt ToRef_p[N_Routes][3]
Transition list.
Definition: MCDirection.h:194
MVPosition * MVPOS1
Definition: MCDirection.h:188
virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)
Routines to convert directions from one reference frame to another.
A 3D vector in space.
Definition: MVPosition.h:113
static void doFillState()
Fill the global state.
MCDirection()
Default constructor.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
Vector of three direction cosines.
Definition: MVDirection.h:107
static uInt FromTo_p[MDirection::N_Types][MDirection::N_Types]
Transition matrix.
Definition: MCDirection.h:196
MCDirection & operator=(const MCDirection &other)
Assignment (not implemented)
MVPosition * MVPOS3
Definition: MCDirection.h:188
unsigned int uInt
Definition: aipstype.h:51
Conversion of Measures Base.
Definition: MConvertBase.h:147
virtual void clearConvert()
Delete the pointers used in the MeasConvert help structure cache.