casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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_MEPOCH_H
30 #define MEASURES_MEPOCH_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class MEpoch;
42 class MCEpoch;
43 template <class M> class MeasConvert;
44 template <class M> class ArrayMeasColumn;
45 template <class M> class ScalarMeasColumn;
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 
104 class MEpoch : public MeasBase<MVEpoch, MeasRef<MEpoch> > {
105 
106 public:
107  //# Friends
108  friend class MeasConvert<MEpoch>;
109 
110  //# Enumerations
111  // Types of known MEpochs
112  // <note role=caution> The order defines the order in the translation matrix
113  // in the MCEpoch class. Do not change the order without
114  // changing the array. Additions should be made before N_types, and
115  // an additional row and column should be coded in FromTo (MCEpoch), and
116  // in showType().</note>
117  enum Types {
118  // Local Apparent Sidereal Time
120  // Local Mean Sidereal Time
122  // Greenwich Mean ST1
124  // Greenwich Apparent ST
134  // Number of types
136  // Reduce result to integer days
137  RAZE = 32,
138  // All extra bits
140  // Synonyms
146  // Default
148  };
149 
150  //# Typedefs
151  // Measure value container for this class (i.e. MEpoch::MVType)
152  typedef MVEpoch MVType;
153  // Measure conversion routines for this class (i.e. MEpoch::MCType)
154  typedef MCEpoch MCType;
155  // Measure reference (i.e. MEpoch::Ref)
157  // Measure Convert (i.e. MEpoch::Convert)
159  // Measure table Columns (e.g., MEpoch::ScalarColumn)
162 
163  //# Constructors
164  // <note role=tip> In the following constructors and other functions, all
165  // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
166  // where no offsets or frames are needed in the reference. </note>
167  // Default constructor; generates an instant at MJD 0 UTC
168  MEpoch();
169  // Create from data and reference
170  // <group>
171  MEpoch(const MVEpoch &dt);
172  MEpoch(const MVEpoch &dt, const MEpoch::Ref &rf);
173  MEpoch(const MVEpoch &dt, MEpoch::Types rf);
174  MEpoch(const Quantity &dt);
175  MEpoch(const Quantity &dt, const MEpoch::Ref &rf);
176  MEpoch(const Quantity &dt, MEpoch::Types rf);
177  MEpoch(const Measure *dt);
178  MEpoch(const MeasValue *dt);
179  // </group>
180 
181  //# Destructor
182  virtual ~MEpoch();
183 
184  //# Operators
185 
186  //# General Member Functions
187  // Tell me your type
188  // <group>
189  virtual const String &tellMe() const;
190  static const String &showMe();
191  static void assure(const Measure &in);
192  // </group>
193  // Translate reference code. The uInt version has a check for valid codes
194  // (i.e. it is a safe cast).
195  // <thrown>
196  // <li> AipsError in the uInt interface if illegal code given
197  // </thrown>
198  // <group>
199  static MEpoch::Types castType(uInt tp);
200  static const String &showType(MEpoch::Types tp);
201  static const String &showType(uInt tp);
202  // </group>
203  // Translate string to reference code
204  // <group>
205  static Bool getType(MEpoch::Types &tp, const String &in);
206  Bool giveMe(MEpoch::Ref &mr, const String &in);
207  // </group>
208  // Set the offset in the reference (False if non-matching Measure)
209  virtual Bool setOffset(const Measure &in);
210  // Set the reference type to the specified String. False if illegal
211  // string, reference set to DEFAULT.
212  virtual Bool setRefString(const String &in);
213  // Get the default reference type
214  virtual const String &getDefaultType() const;
215  // Get a list of all known reference codes. nall returns the number in list,
216  // nextra the number of specials (like planets) that should be at
217  // end of list). typ returns the list of corresponding types.
218  // <group>
219  virtual const String* allTypes(Int &nall, Int &nextra,
220  const uInt *&typ) const;
221  static const String* allMyTypes(Int &nall, Int &nextra,
222  const uInt *&typ);
223  // </group>
224  // Check if all internal tables of types (both enum and String) are
225  // complete and correct. This function is called automatically if and when
226  // necessary.
227  // <thrown>
228  // <li> AipsError if a (programming) error in the types.
229  // </thrown>
230  // <group>
231  virtual void checkTypes() const;
232  static void checkMyTypes();
233  // </group>
234  // Get the reference type (for records, including codes like R_)
235  virtual String getRefString() const;
236 
237  // Get time in specified units
238  Quantity get(const Unit &inunit) const;
239 
240  // Create copy
241  // <group>
242  virtual Measure *clone() const;
243  // </group>
244 
245 private:
246  //# Enumerations
247 
248  //# Data
249 
250  //# Member functions
251 
252 };
253 
254 
255 } //# NAMESPACE CASACORE - END
256 
257 #endif
int Int
Definition: aipstype.h:50
Conversion of Measures.
Definition: MBaseline.h:44
virtual void checkTypes() const
Check if all internal tables of types (both enum and String) are complete and correct.
Local Mean Sidereal Time.
Definition: MEpoch.h:121
Bool giveMe(MEpoch::Ref &mr, const String &in)
virtual const String & getDefaultType() const
Get the default reference type.
Local Apparent Sidereal Time.
Definition: MEpoch.h:119
MEpoch()
Tip: In the following constructors and other functions, all MeasRef can be replaced with simple Meas...
Physical quantities within reference frame.
Definition: Measure.h:235
Base class for all measures.
Definition: MeasBase.h:73
A Measure: instant in time.
Definition: MEpoch.h:104
static const String * allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
static MEpoch::Types castType(uInt tp)
Translate reference code.
static void checkMyTypes()
virtual ~MEpoch()
defines physical units
Definition: Unit.h:189
MeasConvert< MEpoch > Convert
Measure Convert (i.e.
Definition: MEpoch.h:158
Synonyms.
Definition: MEpoch.h:141
static void assure(const Measure &in)
Base class for values in a Measure.
Definition: MeasValue.h:107
ScalarMeasColumn< MEpoch > ScalarColumn
Measure table Columns (e.g., MEpoch::ScalarColumn)
Definition: MEpoch.h:160
static const String & showMe()
MeasRef< MEpoch > Ref
Measure reference (i.e.
Definition: MEpoch.h:156
MVEpoch MVType
Measure value container for this class (i.e.
Definition: MEpoch.h:152
static const String & showType(MEpoch::Types tp)
Reduce result to integer days.
Definition: MEpoch.h:137
virtual Bool setOffset(const Measure &in)
Set the offset in the reference (False if non-matching Measure)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
static Bool getType(MEpoch::Types &tp, const String &in)
Translate string to reference code.
virtual String getRefString() const
Get the reference type (for records, including codes like R_)
Greenwich Mean ST1.
Definition: MEpoch.h:123
Types
Each derived class should have a Types enumeration, specifying the recognised frame types...
Definition: Measure.h:254
A class for high precision time.
Definition: MVEpoch.h:90
virtual Measure * clone() const
Create copy.
virtual const String & tellMe() const
Tell me your type.
All extra bits.
Definition: MEpoch.h:139
Number of types.
Definition: MEpoch.h:135
Greenwich Apparent ST.
Definition: MEpoch.h:125
String: the storage and methods of handling collections of characters.
Definition: String.h:225
MEpoch conversion routines.
Definition: MCEpoch.h:91
virtual Bool setRefString(const String &in)
Set the reference type to the specified String.
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
virtual const String * allTypes(Int &nall, Int &nextra, const uInt *&typ) const
Get a list of all known reference codes.
ArrayMeasColumn< MEpoch > ArrayColumn
Definition: MEpoch.h:161
MCEpoch MCType
Measure conversion routines for this class (i.e.
Definition: MEpoch.h:154
unsigned int uInt
Definition: aipstype.h:51