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>
41class MeasConvert;
42template <class M>
43class ArrayMeasColumn;
44template <class M>
46
47// # Typedefs
48
49// <summary>
50// A Measure: instant in time
51// </summary>
52
53// <use visibility=export>
54
55// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
56// </reviewed>
57
58// <prerequisite>
59// <li> <linkto class=Measure>Measure</linkto> class
60// </prerequisite>
61//
62// <etymology>
63// Measure and Epoch
64// </etymology>
65//
66// <synopsis>
67// MEpoch forms derived Measure class for an instant in time.
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// #include <casacore/casa/logging/LogIO.h>
77//
78// cout << "TAI for UTC = MJD(50237.29): " <<
79// MEpoch::Convert(MEpoch(MVEpoch(Quantity(50237.29, "d")),
80// MEpoch::Ref(MEpoch::UTC)),
81// MEpoch::Ref(MEpoch::TAI))() <<
82// endl;
83// LogIO os(LogOrigin("FluxCalc_SS_JPL_Butler", "readEphem"));
84// os << LogIO::DEBUG1 << " at ";
85// os.output() << MEpoch::Convert(MEpoch(MVEpoch(Quantity(50237.29, "d")),
86// MEpoch::Ref(MEpoch::UTC)),
87// MEpoch::Ref(MEpoch::TAI))();
88// os << LogIO::POST;
89// </srcblock>
90// Results in:
91// <srcblock>
92// TAI for UTC = MJD(50237.29): Epoch: 50237::06:58:06.0000 (on stdout)
93// at Epoch: 50237::06:58:06.0000 (in logger)
94// </srcblock>
95// </example>
96//
97// <motivation>
98// </motivation>
99//
100// <todo asof="2000/06/15">
101// <li>
102// </todo>
103
104class MEpoch : public MeasBase<MVEpoch, MeasRef<MEpoch>> {
105 public:
106 // # Friends
107 friend class MeasConvert<MEpoch>;
108
109 // # Enumerations
110 // Types of known MEpochs
111 // <note role=caution> The order defines the order in the translation matrix
112 // in the MCEpoch class. Do not change the order without
113 // changing the array. Additions should be made before N_types, and
114 // an additional row and column should be coded in FromTo (MCEpoch), and
115 // in showType().</note>
116 enum Types {
117 // Local Apparent Sidereal Time
119 // Local Mean Sidereal Time
121 // Greenwich Mean ST1
123 // Greenwich Apparent ST
133 // Number of types
135 // Reduce result to integer days
136 RAZE = 32,
137 // All extra bits
139 // Synonyms
145 // Default
147 };
148
149 // # Typedefs
150 // Measure value container for this class (i.e. MEpoch::MVType)
152 // Measure conversion routines for this class (i.e. MEpoch::MCType)
154 // Measure reference (i.e. MEpoch::Ref)
156 // Measure Convert (i.e. MEpoch::Convert)
158 // Measure table Columns (e.g., MEpoch::ScalarColumn)
161
162 // # Constructors
163 // <note role=tip> In the following constructors and other functions, all
164 // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
165 // where no offsets or frames are needed in the reference. </note>
166 // Default constructor; generates an instant at MJD 0 UTC
168 // Create from data and reference
169 // <group>
170 MEpoch(const MVEpoch &dt);
171 MEpoch(const MVEpoch &dt, const MEpoch::Ref &rf);
173 MEpoch(const Quantity &dt);
174 MEpoch(const Quantity &dt, const MEpoch::Ref &rf);
176 MEpoch(const Measure *dt);
177 MEpoch(const MeasValue *dt);
178 // </group>
179
180 // # Destructor
181 virtual ~MEpoch();
182
183 // # Operators
184
185 // # General Member Functions
186 // Tell me your type
187 // <group>
188 virtual const String &tellMe() const;
189 static const String &showMe();
190 static void assure(const Measure &in);
191 // </group>
192 // Translate reference code. The uInt version has a check for valid codes
193 // (i.e. it is a safe cast).
194 // <thrown>
195 // <li> AipsError in the uInt interface if illegal code given
196 // </thrown>
197 // <group>
199 static const String &showType(MEpoch::Types tp);
200 static const String &showType(uInt tp);
201 // </group>
202 // Translate string to reference code
203 // <group>
204 static Bool getType(MEpoch::Types &tp, const String &in);
205 Bool giveMe(MEpoch::Ref &mr, const String &in);
206 // </group>
207 // Set the offset in the reference (False if non-matching Measure)
208 virtual Bool setOffset(const Measure &in);
209 // Set the reference type to the specified String. False if illegal
210 // string, reference set to DEFAULT.
211 virtual Bool setRefString(const String &in);
212 // Get the default reference type
213 virtual const String &getDefaultType() const;
214 // Get a list of all known reference codes. nall returns the number in list,
215 // nextra the number of specials (like planets) that should be at
216 // end of list). typ returns the list of corresponding types.
217 // <group>
218 virtual const String *allTypes(Int &nall, Int &nextra, const uInt *&typ) const;
219 static const String *allMyTypes(Int &nall, Int &nextra, 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
242 private:
243 // # Enumerations
244
245 // # Data
246
247 // # Member functions
248};
249
250} // namespace casacore
251
252#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:160
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:116
@ LMST
Local Mean Sidereal Time.
Definition MEpoch.h:120
@ RAZE
Reduce result to integer days.
Definition MEpoch.h:136
@ GAST
Greenwich Apparent ST.
Definition MEpoch.h:124
@ N_Types
Number of types.
Definition MEpoch.h:134
@ GMST1
Greenwich Mean ST1.
Definition MEpoch.h:122
@ IAT
Synonyms.
Definition MEpoch.h:140
@ EXTRA
All extra bits.
Definition MEpoch.h:138
@ LAST
Local Apparent Sidereal Time.
Definition MEpoch.h:118
@ DEFAULT
Default.
Definition MEpoch.h:146
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:155
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:157
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:159
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:151
MEpoch(const MVEpoch &dt, const MEpoch::Ref &rf)
MCEpoch MCType
Measure conversion routines for this class (i.e.
Definition MEpoch.h:153
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:355
For temporary backward namespace compatibility, use casa as alias for casacore.
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
Quantum< Double > Quantity
Definition Quantum.h:40