casa  5.7.0-16
 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  virtual uInt type() const;
192  static void assure(const Measure &in);
193  // </group>
194  // Translate reference code. The uInt version has a check for valid codes
195  // (i.e. it is a safe cast).
196  // <thrown>
197  // <li> AipsError in the uInt interface if illegal code given
198  // </thrown>
199  // <group>
200  static MEpoch::Types castType(uInt tp);
201  static const String &showType(MEpoch::Types tp);
202  static const String &showType(uInt tp);
203  // </group>
204  // Translate string to reference code
205  // <group>
206  static Bool getType(MEpoch::Types &tp, const String &in);
207  Bool giveMe(MEpoch::Ref &mr, const String &in);
208  // </group>
209  // Set the offset in the reference (False if non-matching Measure)
210  virtual Bool setOffset(const Measure &in);
211  // Set the reference type to the specified String. False if illegal
212  // string, reference set to DEFAULT.
213  virtual Bool setRefString(const String &in);
214  // Get the default reference type
215  virtual const String &getDefaultType() const;
216  // Get a list of all known reference codes. nall returns the number in list,
217  // nextra the number of specials (like planets) that should be at
218  // end of list). typ returns the list of corresponding types.
219  // <group>
220  virtual const String* allTypes(Int &nall, Int &nextra,
221  const uInt *&typ) const;
222  static const String* allMyTypes(Int &nall, Int &nextra,
223  const uInt *&typ);
224  // </group>
225  // Check if all internal tables of types (both enum and String) are
226  // complete and correct. This function is called automatically if and when
227  // necessary.
228  // <thrown>
229  // <li> AipsError if a (programming) error in the types.
230  // </thrown>
231  // <group>
232  virtual void checkTypes() const;
233  static void checkMyTypes();
234  // </group>
235  // Get the reference type (for records, including codes like R_)
236  virtual String getRefString() const;
237  // Get my type (as Register)
238  static uInt myType();
239 
240  // Get time in specified units
241  Quantity get(const Unit &inunit) const;
242 
243  // Create copy
244  // <group>
245  virtual Measure *clone() const;
246  // </group>
247 
248 private:
249  //# Enumerations
250 
251  //# Data
252 
253  //# Member functions
254 
255 };
256 
257 
258 } //# NAMESPACE CASACORE - END
259 
260 #endif
int Int
Definition: aipstype.h:50
Conversion of Measures.
Definition: MDirection.h:43
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
static uInt myType()
Get my type (as Register)
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:75
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
virtual uInt type() const
Get the type (== Register() of derived Measure (faster than Strings) All should have: static uInt myT...
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:223
MEpoch conversion routines.
Definition: MCEpoch.h:92
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
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42