casacore
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>
34 #include <casacore/measures/Measures/MeasBase.h>
35 #include <casacore/measures/Measures/MeasRef.h>
36 #include <casacore/measures/Measures/MCBase.h>
37 #include <casacore/measures/Measures/MConvertBase.h>
38 #include <casacore/measures/Measures/MEpoch.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
102 
103  //# Destructor
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 {
141  RAZING
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
casacore::MCEpoch::UT1_UT2
@ UT1_UT2
Definition: MCEpoch.h:128
casacore::MCEpoch::TDT_TCG
@ TDT_TCG
Definition: MCEpoch.h:136
casacore::MCEpoch::~MCEpoch
~MCEpoch()
casacore::MCEpoch::TDB_TDT
@ TDB_TDT
Definition: MCEpoch.h:135
casacore::MEpoch
Definition: MEpoch.h:104
casacore::MCEpoch::theirInitOnce
static CallOnce0 theirInitOnce
Object to ensure safe multi-threaded lazy single initialization.
Definition: MCEpoch.h:162
casacore::Nutation
Definition: Nutation.h:139
casacore::MCEpoch::TCG_TDT
@ TCG_TDT
Definition: MCEpoch.h:137
casacore::MCEpoch
Definition: MCEpoch.h:92
casacore::MCEpoch::initConvert
virtual void initConvert(uInt which, MConvertBase &mc)
Create help structures for Measure conversion routines.
casacore::MCEpoch::doConvert
virtual void doConvert(MeasValue &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)
Routine to convert time from one reference frame to another.
casacore::MCEpoch::UT1_GAST
@ UT1_GAST
Definition: MCEpoch.h:125
casacore::MCEpoch::doConvert
void doConvert(MVEpoch &in, MRBase &inref, MRBase &outref, const MConvertBase &mc)
Conversion routine to cater for inheritance question.
casacore::MCEpoch::LMST_GMST1
@ LMST_GMST1
Definition: MCEpoch.h:120
casacore::MCEpoch::GAST_UT1
@ GAST_UT1
Definition: MCEpoch.h:124
casacore::MCEpoch::UTC_TAI
@ UTC_TAI
Definition: MCEpoch.h:130
casacore::MeasValue
Definition: MeasValue.h:107
casacore::MCBase
Definition: MCBase.h:119
casacore::MEpoch::N_Types
@ N_Types
Number of types.
Definition: MEpoch.h:135
casacore::MCEpoch::TAI_UTC
@ TAI_UTC
Definition: MCEpoch.h:131
casacore::MCEpoch::TDT_TAI
@ TDT_TAI
Definition: MCEpoch.h:133
casacore::MCEpoch::TDB_TCB
@ TDB_TCB
Definition: MCEpoch.h:138
casacore::MRBase
Definition: MRBase.h:103
casacore::MCEpoch::getConvert
virtual void getConvert(MConvertBase &mc, const MRBase &inref, const MRBase &outref)
Create conversion function pointer.
casacore::MCEpoch::FromTo_p
static uInt FromTo_p[MEpoch::N_Types][MEpoch::N_Types]
Transition matrix.
Definition: MCEpoch.h:160
casacore::MCEpoch::UT2_UT1
@ UT2_UT1
Definition: MCEpoch.h:129
casacore::MCEpoch::TCB_TDB
@ TCB_TDB
Definition: MCEpoch.h:139
casacore::MCEpoch::LAST_GAST
@ LAST_GAST
Definition: MCEpoch.h:118
casacore::MCEpoch::TDT_TDB
@ TDT_TDB
Definition: MCEpoch.h:134
casacore::MCEpoch::UT1_UTC
@ UT1_UTC
Definition: MCEpoch.h:126
casacore::MCEpoch::UTC_UT1
@ UTC_UT1
Definition: MCEpoch.h:127
casacore::uInt
unsigned int uInt
Definition: aipstype.h:51
casacore::MCEpoch::MCEpoch
MCEpoch(const MCEpoch &other)
Copy constructor (not implemented)
casacore::MCEpoch::showState
static String showState()
Show the state of the conversion engine (mainly for debugging purposes)
casacore::MCEpoch::GMST1_UT1
@ GMST1_UT1
Definition: MCEpoch.h:122
casacore::MeasConvert
Definition: MeasConvert.h:143
casacore::MCEpoch::RAZING
@ RAZING
Definition: MCEpoch.h:141
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::MVEpoch
Definition: MVEpoch.h:90
casacore::MCEpoch::N_Routes
@ N_Routes
Definition: MCEpoch.h:140
casacore::MCEpoch::TAI_TDT
@ TAI_TDT
Definition: MCEpoch.h:132
casacore::MCEpoch::clearConvert
virtual void clearConvert()
Delete the pointers used in the MeasConvert help structure cache.
casacore::MCEpoch::doFillState
static void doFillState()
Fill the global state.
casacore::MCEpoch::UT1_GMST1
@ UT1_GMST1
Definition: MCEpoch.h:123
casacore::MCEpoch::MCEpoch
MCEpoch()
Default constructor.
casacore::String
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::MCEpoch::NUTATFROM
Nutation * NUTATFROM
Definition: MCEpoch.h:153
casacore::MCEpoch::NUTATTO
Nutation * NUTATTO
Definition: MCEpoch.h:154
casacore::MCEpoch::GMST1_LMST
@ GMST1_LMST
Definition: MCEpoch.h:121
casacore::MCEpoch::ToRef_p
static uInt ToRef_p[N_Routes][3]
Transition list.
Definition: MCEpoch.h:158
casacore::CallOnce0
Wrapper around std::call_once.
Definition: Mutex.h:215
casacore::MCEpoch::GAST_LAST
@ GAST_LAST
Definition: MCEpoch.h:119
casacore::MConvertBase
Definition: MConvertBase.h:147
casacore::MCEpoch::operator=
MCEpoch & operator=(const MCEpoch &other)
Assignment (not implemented)
casacore::MCBase::Routes
Routes
Each derived class should have a list of routines to be called:
Definition: MCBase.h:134