casacore
MPosition.h
Go to the documentation of this file.
1 //# MPosition.h: A Measure: position on Earth
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_MPOSITION_H
30 #define MEASURES_MPOSITION_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/measures/Measures/MeasBase.h>
35 #include <casacore/measures/Measures/MeasRef.h>
36 #include <casacore/casa/Quanta/MVPosition.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class MPosition;
42 class MCPosition;
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: position on Earth
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 // </etymology>
64 //
65 // <synopsis>
66 // MPosition forms derived Measure class for an instant in time.
67 // </synopsis>
68 //
69 // <example>
70 // </example>
71 //
72 // <motivation>
73 // </motivation>
74 //
75 // <todo asof="2000/06/15">
76 // <li>
77 // </todo>
78 
79 class MPosition : public MeasBase<MVPosition, MeasRef<MPosition> > {
80 
81  public:
82  //# Friends
83  // Conversion of data
84  friend class MeasConvert<MPosition>;
85 
86  //# Enumerations
87  // Types of known MPositions
88  // <note role=warning> The order defines the order in the translation
89  // matrix FromTo
90  // in the getConvert routine. Do not change the order without
91  // changing the array. Additions should be made before N_types, and
92  // an additional row and column should be coded in FromTo, and
93  // in showType().</note>
94  enum Types {
99 
100  //# Typedefs
101  // Measure value container for this class (i.e. MPosition::MVType)
103  // Measure conversion routines for this class (i.e. MPosition::MCType)
105  // Measure reference (i.e. MPosition::Ref)
107  // Measure Convert (i.e. MPosition::Convert)
109  // Measure table Columns (e.g., MPosition::ScalarColumn)
112  // Reference enum Types (included originally for gcc 2.95)
114 
115  //# Constructors
116  // <note role=tip> In the following constructors and other functions, all
117  // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
118  // where no offsets or frames are needed in the reference. </note>
119  // Default constructor; generates the ITRF centre
120  MPosition();
121  // Create from data and reference
122  // <group>
123  MPosition(const MVPosition &dt);
124  MPosition(const MVPosition &dt, const MPosition::Ref &rf);
125  MPosition(const MVPosition &dt, MPosition::Types rf);
126  MPosition(const Quantity &dt, const Quantity &dt1, const Quantity &dt2);
127  MPosition(const Quantity &dt, const Quantity &dt1, const Quantity &dt2,
128  const MPosition::Ref &rf);
129  MPosition(const Quantity &dt, const Quantity &dt1, const Quantity &dt2,
130  MPosition::Types rf);
131  MPosition(const Quantity &dt0, const Quantum<Vector<Double> > &dt);
132  MPosition(const Quantity &dt0, const Quantum<Vector<Double> > &dt,
133  const MPosition::Ref &rf);
134  MPosition(const Quantity &dt0, const Quantum<Vector<Double> > &dt,
135  MPosition::Types rf);
136  MPosition(const Measure *dt);
137  MPosition(const MeasValue *dt);
138  // </group>
139 
140  // <group>
141  MPosition(const MPosition &);
142  MPosition &operator=(const MPosition &);
143  // </group>
144 
145  //# Destructor
146  virtual ~MPosition();
147 
148  //# Operators
149 
150  //# General Member Functions
151  // Tell me your type
152  // <group>
153  virtual const String &tellMe() const;
154  static const String &showMe();
155  virtual uInt type() const;
156  static void assure(const Measure &in);
157  // </group>
158  // Translate reference code. The uInt version has a check for valid codes
159  // (i.e. it is a safe cast).
160  // <thrown>
161  // <li> AipsError in the uInt interface if illegal code given
162  // </thrown>
163  // <group>
164  static MPosition::Types castType(uInt tp);
165  static const String &showType(MPosition::Types tp);
166  static const String &showType(uInt tp);
167  // </group>
168  // Translate string to reference code
169  // <group>
170  static Bool getType(MPosition::Types &tp, const String &in);
171  // this one throws an exception for an unrecognized String
172  static MPosition::Types getType(const String& in);
173 
174  Bool giveMe(MPosition::Ref &mr, const String &in);
175  // </group>
176  // Set the offset in the reference (False if non-matching Measure)
177  virtual Bool setOffset(const Measure &in);
178  // Set the reference type to the specified String. False if illegal
179  // string, reference set to DEFAULT.
180  virtual Bool setRefString(const String &in);
181  // Get the default reference type
182  virtual const String &getDefaultType() const;
183  // Get a list of all known reference codes. nall returns the number in list,
184  // nextra the number of specials (like planets) that should be at
185  // end of list). typ returns the list of corresponding types.
186  // <group>
187  virtual const String* allTypes(Int &nall, Int &nextra,
188  const uInt *&typ) const;
189  static const String* allMyTypes(Int &nall, Int &nextra,
190  const uInt *&typ);
191  // </group>
192  // Check if all internal tables of types (both enum and String) are
193  // complete and correct. This function is called automatically if and when
194  // necessary.
195  // <thrown>
196  // <li> AipsError if a (programming) error in the types.
197  // </thrown>
198  // <group>
199  virtual void checkTypes() const;
200  static void checkMyTypes();
201  // </group>
202  // Get the reference type (for records, including codes like R_)
203  virtual String getRefString() const;
204  // Get my type (as Register)
205  static uInt myType();
206 
207  // Get Measure data
208  // <group>
209  Quantum<Vector<Double> > get(const Unit &inunit) const;
211  Quantum<Vector<Double> > getAngle(const Unit &inunit) const;
212  // </group>
213 
214  // Make copy
215  // <group>
216  virtual Measure *clone() const;
217  // </group>
218 
219  private:
220  //# Enumerations
221 
222  //# Data
223 
224  //# Member functions
225 
226 };
227 
228 
229 } //# NAMESPACE CASACORE - END
230 
231 #endif
MeasRef< MPosition > Ref
Measure reference (i.e.
Definition: MPosition.h:106
A Measure: position on Earth.
Definition: MPosition.h:79
int Int
Definition: aipstype.h:50
Conversion of Measures.
Definition: MBaseline.h:44
static void checkMyTypes()
virtual const String & getDefaultType() const
Get the default reference type.
virtual Bool setRefString(const String &in)
Set the reference type to the specified String.
static const String & showType(MPosition::Types tp)
ScalarMeasColumn< MPosition > ScalarColumn
Measure table Columns (e.g., MPosition::ScalarColumn)
Definition: MPosition.h:110
virtual Bool setOffset(const Measure &in)
Set the offset in the reference (False if non-matching Measure)
Quantum< Vector< Double > > getAngle() const
Bool giveMe(MPosition::Ref &mr, const String &in)
MPosition & operator=(const MPosition &)
virtual Measure * clone() const
Make copy.
static MPosition::Types castType(uInt tp)
Translate reference code.
Physical quantities within reference frame.
Definition: Measure.h:235
static void assure(const Measure &in)
Base class for all measures.
Definition: MeasBase.h:75
Read only access to table array Measure columns.
Definition: MBaseline.h:45
static const String * allMyTypes(Int &nall, Int &nextra, const uInt *&typ)
MCPosition MCType
Measure conversion routines for this class (i.e.
Definition: MPosition.h:104
defines physical units
Definition: Unit.h:189
Base class for values in a Measure.
Definition: MeasValue.h:107
MVPosition MVType
Measure value container for this class (i.e.
Definition: MPosition.h:102
static Bool getType(MPosition::Types &tp, const String &in)
Translate string to reference code.
virtual void checkTypes() const
Check if all internal tables of types (both enum and String) are complete and correct.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A 3D vector in space.
Definition: MVPosition.h:113
virtual const String * allTypes(Int &nall, Int &nextra, const uInt *&typ) const
Get a list of all known reference codes.
MPosition conversion routines.
Definition: MCPosition.h:82
Types
Each derived class should have a Types enumeration, specifying the recognised frame types...
Definition: Measure.h:254
typedef WHATEVER_SUN_TYPEDEF(MPosition) Types Types
Reference enum Types (included originally for gcc 2.95)
Types
Types of known MPositions Warning: The order defines the order in the translation matrix FromTo in t...
Definition: MPosition.h:94
static uInt myType()
Get my type (as Register)
virtual const String & tellMe() const
Tell me your type.
ArrayMeasColumn< MPosition > ArrayColumn
Definition: MPosition.h:111
virtual String getRefString() const
Get the reference type (for records, including codes like R_)
MeasConvert< MPosition > Convert
Measure Convert (i.e.
Definition: MPosition.h:108
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Read only access to table scalar Measure columns.
Definition: MBaseline.h:46
MPosition()
Tip: In the following constructors and other functions, all MeasRef can be replaced with simple Meas...
static const String & showMe()
virtual uInt type() const
Get the type (== Register() of derived Measure (faster than Strings) All should have: static uInt myT...
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51