casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCEpoch.h
Go to the documentation of this file.
1 //# MCEpoch.h: MEpoch conversion routines
2 //# Copyright (C) 1995,1996,1997,1998,1999,2002
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_MCEPOCH_H
30 #define MEASURES_MCEPOCH_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
39 #include <casacore/casa/OS/Mutex.h>
40 
41 namespace casacore { //# NAMESPACE CASACORE - BEGIN
42 
43 //# Forward Declarations
44 class MCEpoch;
45 class Nutation;
46 class String;
47 
48 //# Typedefs
49 
50 // <summary> MEpoch conversion routines </summary>
51 
52 // <use visibility=local>
53 
54 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
55 // </reviewed>
56 
57 // <prerequisite>
58 // <li> <linkto class=Measure>Measure</linkto> class
59 // <li> <linkto class=MCBase>MCBase</linkto> base class
60 // <li> <linkto class=MConvertBase>overall conversion</linkto> class
61 // </prerequisite>
62 //
63 // <etymology>
64 // Measure, Convert and Epoch
65 // </etymology>
66 //
67 // <synopsis>
68 // Contains state machinery and caching for actual conversions
69 // </synopsis>
70 //
71 // <example>
72 // Convert (with all steps explicit) a UTC to an IAT time.
73 // <srcblock>
74 // #include <casacore/measures/Measures.h>
75 // #include <casacore/measures/Measures/MEpoch.h>
76 // #include <casacore/measures/Measures/MCEpoch.h>
77 // cout << "TAI for UTC = MJD(50237.29): " <<
78 // MEpoch::Convert(MEpoch(MVEpoch(Quantity(50237.29, "d")),
79 // MEpoch::Ref(MEpoch::UTC)),
80 // MEpoch::Ref(MEpoch::TAI))() <<
81 // endl;
82 // </srcblock>
83 // </example>
84 //
85 // <motivation>
86 // </motivation>
87 //
88 // <todo asof="1998/09/21">
89 // <li> Nothing I know
90 // </todo>
91 
92 class MCEpoch : public MCBase {
93 
94 public:
95 
96  //# Friends
97  friend class MeasConvert<MEpoch>;
98 
99  //# Constructors
100  // Default constructor
101  MCEpoch();
102 
103  //# Destructor
104  ~MCEpoch();
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 {
142  };
143 
144  //# Typedefs
145 
146  //# Operators
147 
148  //# General Member Functions
149 
150  //# Enumerations
151 
152  //# Cached Data
155 
156  //# State machine data
157  // Transition list
158  static uInt ToRef_p[N_Routes][3];
159  // Transition matrix
161  // Object to ensure safe multi-threaded lazy single initialization
163 
164  //# Constructors
165  // Copy constructor (not implemented)
166  MCEpoch(const MCEpoch &other);
167  // Assignment (not implemented)
168  MCEpoch &operator=(const MCEpoch &other);
169 
170  //# Member functions
171 
172  // Create conversion function pointer
173  virtual void getConvert(MConvertBase &mc,
174  const MRBase &inref,
175  const MRBase &outref);
176 
177  // Create help structures for Measure conversion routines
178  virtual void initConvert(uInt which, MConvertBase &mc);
179 
180  // Delete the pointers used in the MeasConvert help structure cache
181  virtual void clearConvert();
182 
183  // Routine to convert time from one reference frame to another
184  virtual void doConvert(MeasValue &in,
185  MRBase &inref,
186  MRBase &outref,
187  const MConvertBase &mc);
188  // Conversion routine to cater for inheritance question
189  void doConvert(MVEpoch &in,
190  MRBase &inref,
191  MRBase &outref,
192  const MConvertBase &mc);
193 
194 private:
195  // Fill the global state. Called using theirInitOnce.
196  static void doFillState();
197 };
198 
199 
200 } //# NAMESPACE CASACORE - END
201 
202 #endif
Wrapper around std::call_once.
Definition: Mutex.h:214
Nutation * NUTATTO
Definition: MCEpoch.h:154
Conversion of Measures.
Definition: MDirection.h:43
static CallOnce0 theirInitOnce
Object to ensure safe multi-threaded lazy single initialization.
Definition: MCEpoch.h:162
virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)
Routine to convert time from one reference frame to another.
Base for Reference frame for physical measures.
Definition: MRBase.h:103
MCEpoch & operator=(const MCEpoch &other)
Assignment (not implemented)
Base for specific measure conversions.
Definition: MCBase.h:119
static void doFillState()
Fill the global state.
Routes
The list of actual routines provided.
Definition: MCEpoch.h:117
A Measure: instant in time.
Definition: MEpoch.h:104
Base class for values in a Measure.
Definition: MeasValue.h:107
virtual void initConvert(uInt which, MConvertBase &mc)
Create help structures for Measure conversion routines.
static String showState()
Show the state of the conversion engine (mainly for debugging purposes)
Nutation class and calculations.
Definition: Nutation.h:139
virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref)
Create conversion function pointer.
static uInt FromTo_p[MEpoch::N_Types][MEpoch::N_Types]
Transition matrix.
Definition: MCEpoch.h:160
A class for high precision time.
Definition: MVEpoch.h:90
Number of types.
Definition: MEpoch.h:135
virtual void clearConvert()
Delete the pointers used in the MeasConvert help structure cache.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
MEpoch conversion routines.
Definition: MCEpoch.h:92
static uInt ToRef_p[N_Routes][3]
Transition list.
Definition: MCEpoch.h:158
MCEpoch()
Default constructor.
Nutation * NUTATFROM
Definition: MCEpoch.h:153
unsigned int uInt
Definition: aipstype.h:51
Conversion of Measures Base.
Definition: MConvertBase.h:147
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42