casacore
 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 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42 //# Forward Declarations
43 class MCEpoch;
44 class Nutation;
45 class String;
46 
47 //# Typedefs
48 
49 // <summary> MEpoch conversion routines </summary>
50 
51 // <use visibility=local>
52 
53 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
54 // </reviewed>
55 
56 // <prerequisite>
57 // <li> <linkto class=Measure>Measure</linkto> class
58 // <li> <linkto class=MCBase>MCBase</linkto> base class
59 // <li> <linkto class=MConvertBase>overall conversion</linkto> class
60 // </prerequisite>
61 //
62 // <etymology>
63 // Measure, Convert and Epoch
64 // </etymology>
65 //
66 // <synopsis>
67 // Contains state machinery and caching for actual conversions
68 // </synopsis>
69 //
70 // <example>
71 // Convert (with all steps explicit) a UTC to an IAT time.
72 // <srcblock>
73 // #include <casacore/measures/Measures.h>
74 // #include <casacore/measures/Measures/MEpoch.h>
75 // #include <casacore/measures/Measures/MCEpoch.h>
76 // cout << "TAI for UTC = MJD(50237.29): " <<
77 // MEpoch::Convert(MEpoch(MVEpoch(Quantity(50237.29, "d")),
78 // MEpoch::Ref(MEpoch::UTC)),
79 // MEpoch::Ref(MEpoch::TAI))() <<
80 // endl;
81 // </srcblock>
82 // </example>
83 //
84 // <motivation>
85 // </motivation>
86 //
87 // <todo asof="1998/09/21">
88 // <li> Nothing I know
89 // </todo>
90 
91 class MCEpoch : public MCBase {
92 
93 public:
94 
95  //# Friends
96  friend class MeasConvert<MEpoch>;
97 
98  //# Constructors
99  // Default constructor
100  MCEpoch();
101 
102  //# Destructor
103  ~MCEpoch();
104 
105  //# Member functions
106  // Show the state of the conversion engine (mainly for debugging purposes)
107  static String showState();
108 
109 private:
110  //# Enumerations
111  // The list of actual routines provided.
112  // <note role=warning> Each <src>AA_BB</src> in the list points to routine
113  // that can be used in the FromTo list in the getConvert routine.
114  // In addition the type to which each is converted should be in the
115  // ToRef array, again in the proper order. </note>
116  enum Routes {
141  };
142 
143  //# Typedefs
144 
145  //# Operators
146 
147  //# General Member Functions
148 
149  //# Enumerations
150 
151  //# Cached Data
154 
155  //# State machine data
156  // Transition list
157  static uInt ToRef_p[N_Routes][3];
158  // Transition matrix
160  // Object to ensure safe multi-threaded lazy single initialization
161  static std::once_flag theirInitOnceFlag;
162 
163  //# Constructors
164  // Copy constructor (not implemented)
165  MCEpoch(const MCEpoch &other);
166  // Assignment (not implemented)
167  MCEpoch &operator=(const MCEpoch &other);
168 
169  //# Member functions
170 
171  // Create conversion function pointer
172  virtual void getConvert(MConvertBase &mc,
173  const MRBase &inref,
174  const MRBase &outref);
175 
176  // Create help structures for Measure conversion routines
177  virtual void initConvert(uInt which, MConvertBase &mc);
178 
179  // Delete the pointers used in the MeasConvert help structure cache
180  virtual void clearConvert();
181 
182  // Routine to convert time from one reference frame to another
183  virtual void doConvert(MeasValue &in,
184  MRBase &inref,
185  MRBase &outref,
186  const MConvertBase &mc);
187  // Conversion routine to cater for inheritance question
188  void doConvert(MVEpoch &in,
189  MRBase &inref,
190  MRBase &outref,
191  const MConvertBase &mc);
192 
193 private:
194  // Fill the global state. Called using theirInitOnce.
195  static void doFillState();
196 };
197 
198 
199 } //# NAMESPACE CASACORE - END
200 
201 #endif
Nutation * NUTATTO
Definition: MCEpoch.h:153
Conversion of Measures.
Definition: MBaseline.h:44
Routes
Each derived class should have a list of routines to be called:
Definition: MCBase.h:134
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.
A Measure: instant in time.
Definition: MEpoch.h:104
static std::once_flag theirInitOnceFlag
Object to ensure safe multi-threaded lazy single initialization.
Definition: MCEpoch.h:161
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:159
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:225
MEpoch conversion routines.
Definition: MCEpoch.h:91
static uInt ToRef_p[N_Routes][3]
Transition list.
Definition: MCEpoch.h:157
MCEpoch()
Default constructor.
Nutation * NUTATFROM
Definition: MCEpoch.h:152
unsigned int uInt
Definition: aipstype.h:51
Conversion of Measures Base.
Definition: MConvertBase.h:147