casacore
Loading...
Searching...
No Matches
MEpoch.h
Go to the documentation of this file.
1//# MEpoch.h: A Measure: instant in time
2//# Copyright (C) 1995,1996,1997,1998,1999,2000,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: casa-feedback@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#ifndef MEASURES_MEPOCH_H
27#define MEASURES_MEPOCH_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/measures/Measures/MeasBase.h>
32#include <casacore/measures/Measures/MeasRef.h>
33#include <casacore/casa/Quanta/MVEpoch.h>
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37//# Forward Declarations
38class MEpoch;
39class MCEpoch;
40template <class M> class MeasConvert;
41template <class M> class ArrayMeasColumn;
42template <class M> class ScalarMeasColumn;
43
44//# Typedefs
45
46// <summary>
47// A Measure: instant in time
48// </summary>
49
50// <use visibility=export>
51
52// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
53// </reviewed>
54
55// <prerequisite>
56// <li> <linkto class=Measure>Measure</linkto> class
57// </prerequisite>
58//
59// <etymology>
60// Measure and Epoch
61// </etymology>
62//
63// <synopsis>
64// MEpoch forms derived Measure class for an instant in time.
65// </synopsis>
66//
67// <example>
68// Convert (with all steps explicit) a UTC to an IAT time.
69// <srcblock>
70// #include <casacore/measures/Measures.h>
71// #include <casacore/measures/Measures/MEpoch.h>
72// #include <casacore/measures/Measures/MCEpoch.h>
73// #include <casacore/casa/logging/LogIO.h>
74//
75// cout << "TAI for UTC = MJD(50237.29): " <<
76// MEpoch::Convert(MEpoch(MVEpoch(Quantity(50237.29, "d")),
77// MEpoch::Ref(MEpoch::UTC)),
78// MEpoch::Ref(MEpoch::TAI))() <<
79// endl;
80// LogIO os(LogOrigin("FluxCalc_SS_JPL_Butler", "readEphem"));
81// os << LogIO::DEBUG1 << " at ";
82// os.output() << MEpoch::Convert(MEpoch(MVEpoch(Quantity(50237.29, "d")),
83// MEpoch::Ref(MEpoch::UTC)),
84// MEpoch::Ref(MEpoch::TAI))();
85// os << LogIO::POST;
86// </srcblock>
87// Results in:
88// <srcblock>
89// TAI for UTC = MJD(50237.29): Epoch: 50237::06:58:06.0000 (on stdout)
90// at Epoch: 50237::06:58:06.0000 (in logger)
91// </srcblock>
92// </example>
93//
94// <motivation>
95// </motivation>
96//
97// <todo asof="2000/06/15">
98// <li>
99// </todo>
100
101class MEpoch : public MeasBase<MVEpoch, MeasRef<MEpoch> > {
102
103public:
104 //# Friends
105 friend class MeasConvert<MEpoch>;
106
107 //# Enumerations
108 // Types of known MEpochs
109 // <note role=caution> The order defines the order in the translation matrix
110 // in the MCEpoch class. Do not change the order without
111 // changing the array. Additions should be made before N_types, and
112 // an additional row and column should be coded in FromTo (MCEpoch), and
113 // in showType().</note>
114 enum Types {
115 // Local Apparent Sidereal Time
117 // Local Mean Sidereal Time
119 // Greenwich Mean ST1
121 // Greenwich Apparent ST
131 // Number of types
133 // Reduce result to integer days
134 RAZE = 32,
135 // All extra bits
137 // Synonyms
143 // Default
145 };
146
147 //# Typedefs
148 // Measure value container for this class (i.e. MEpoch::MVType)
150 // Measure conversion routines for this class (i.e. MEpoch::MCType)
152 // Measure reference (i.e. MEpoch::Ref)
154 // Measure Convert (i.e. MEpoch::Convert)
156 // Measure table Columns (e.g., MEpoch::ScalarColumn)
159
160 //# Constructors
161 // <note role=tip> In the following constructors and other functions, all
162 // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
163 // where no offsets or frames are needed in the reference. </note>
164 // Default constructor; generates an instant at MJD 0 UTC
166 // Create from data and reference
167 // <group>
168 MEpoch(const MVEpoch &dt);
169 MEpoch(const MVEpoch &dt, const MEpoch::Ref &rf);
171 MEpoch(const Quantity &dt);
172 MEpoch(const Quantity &dt, const MEpoch::Ref &rf);
174 MEpoch(const Measure *dt);
175 MEpoch(const MeasValue *dt);
176 // </group>
177
178 //# Destructor
179 virtual ~MEpoch();
180
181 //# Operators
182
183 //# General Member Functions
184 // Tell me your type
185 // <group>
186 virtual const String &tellMe() const;
187 static const String &showMe();
188 static void assure(const Measure &in);
189 // </group>
190 // Translate reference code. The uInt version has a check for valid codes
191 // (i.e. it is a safe cast).
192 // <thrown>
193 // <li> AipsError in the uInt interface if illegal code given
194 // </thrown>
195 // <group>
197 static const String &showType(MEpoch::Types tp);
198 static const String &showType(uInt tp);
199 // </group>
200 // Translate string to reference code
201 // <group>
202 static Bool getType(MEpoch::Types &tp, const String &in);
203 Bool giveMe(MEpoch::Ref &mr, const String &in);
204 // </group>
205 // Set the offset in the reference (False if non-matching Measure)
206 virtual Bool setOffset(const Measure &in);
207 // Set the reference type to the specified String. False if illegal
208 // string, reference set to DEFAULT.
209 virtual Bool setRefString(const String &in);
210 // Get the default reference type
211 virtual const String &getDefaultType() const;
212 // Get a list of all known reference codes. nall returns the number in list,
213 // nextra the number of specials (like planets) that should be at
214 // end of list). typ returns the list of corresponding types.
215 // <group>
216 virtual const String* allTypes(Int &nall, Int &nextra,
217 const uInt *&typ) const;
218 static const String* allMyTypes(Int &nall, Int &nextra,
219 const uInt *&typ);
220 // </group>
221 // Check if all internal tables of types (both enum and String) are
222 // complete and correct. This function is called automatically if and when
223 // necessary.
224 // <thrown>
225 // <li> AipsError if a (programming) error in the types.
226 // </thrown>
227 // <group>
228 virtual void checkTypes() const;
229 static void checkMyTypes();
230 // </group>
231 // Get the reference type (for records, including codes like R_)
232 virtual String getRefString() const;
233
234 // Get time in specified units
235 Quantity get(const Unit &inunit) const;
236
237 // Create copy
238 // <group>
239 virtual Measure *clone() const;
240 // </group>
241
242private:
243 //# Enumerations
244
245 //# Data
246
247 //# Member functions
248
249};
250
251
252} //# NAMESPACE CASACORE - END
253
254#endif
virtual Bool setRefString(const String &in)
Set the reference type to the specified String.
MEpoch(const MVEpoch &dt)
Create from data and reference.
ArrayMeasColumn< MEpoch > ArrayColumn
Definition MEpoch.h:158
MEpoch(const Measure *dt)
static void checkMyTypes()
Bool giveMe(MEpoch::Ref &mr, const String &in)
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition MEpoch.h:114
@ LMST
Local Mean Sidereal Time.
Definition MEpoch.h:118
@ RAZE
Reduce result to integer days.
Definition MEpoch.h:134
@ GAST
Greenwich Apparent ST.
Definition MEpoch.h:122
@ N_Types
Number of types.
Definition MEpoch.h:132
@ GMST1
Greenwich Mean ST1.
Definition MEpoch.h:120
@ IAT
Synonyms.
Definition MEpoch.h:138
@ EXTRA
All extra bits.
Definition MEpoch.h:136
@ LAST
Local Apparent Sidereal Time.
Definition MEpoch.h:116
@ DEFAULT
Default.
Definition MEpoch.h:144
MEpoch(const Quantity &dt, MEpoch::Types rf)
Quantity get(const Unit &inunit) const
Get time in specified units.
virtual const String & tellMe() const
Tell me your type.
static const String * allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
virtual const String & getDefaultType() const
Get the default reference type.
MEpoch(const Quantity &dt)
static const String & showType(uInt tp)
MeasRef< MEpoch > Ref
Measure reference (i.e.
Definition MEpoch.h:153
virtual ~MEpoch()
MEpoch(const MeasValue *dt)
static MEpoch::Types castType(uInt tp)
Translate reference code.
MeasConvert< MEpoch > Convert
Measure Convert (i.e.
Definition MEpoch.h:155
MEpoch()
Tip: In the following constructors and other functions, all MeasRef can be replaced with simple Measu...
virtual void checkTypes() const
Check if all internal tables of types (both enum and String) are complete and correct.
static void assure(const Measure &in)
ScalarMeasColumn< MEpoch > ScalarColumn
Measure table Columns (e.g., MEpoch::ScalarColumn)
Definition MEpoch.h:157
virtual const String * allTypes(Int &nall, Int &nextra, const uInt *&typ) const
Get a list of all known reference codes.
MEpoch(const Quantity &dt, const MEpoch::Ref &rf)
static Bool getType(MEpoch::Types &tp, const String &in)
Translate string to reference code.
virtual Bool setOffset(const Measure &in)
Set the offset in the reference (False if non-matching Measure)
static const String & showMe()
virtual Measure * clone() const
Create copy.
virtual String getRefString() const
Get the reference type (for records, including codes like R_)
MVEpoch MVType
Measure value container for this class (i.e.
Definition MEpoch.h:149
MEpoch(const MVEpoch &dt, const MEpoch::Ref &rf)
MCEpoch MCType
Measure conversion routines for this class (i.e.
Definition MEpoch.h:151
static const String & showType(MEpoch::Types tp)
MEpoch(const MVEpoch &dt, MEpoch::Types rf)
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
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40