casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MRBase.h
Go to the documentation of this file.
1 //# MRBase.h: Base for Reference frame for physical measures
2 //# Copyright (C) 1995,1996,1997,1998,1999,2000,2001
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_MRBASE_H
30 #define MEASURES_MRBASE_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
35 #include <casacore/casa/iosfwd.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 class String;
41 
42 // <summary> Base for Reference frame for physical measures </summary>
43 
44 // <use visibility=local>
45 
46 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
47 // </reviewed>
48 
49 // <prerequisite>
50 // <li> <linkto class=Quantum>Quantum</linkto> class
51 // <li> <linkto class=Measure>Measure</linkto> class
52 // </prerequisite>
53 //
54 // <etymology>
55 // From Measure and Reference and Base
56 // </etymology>
57 //
58 // <synopsis>
59 // MRBase is the abstract base class for reference frames.
60 // Reference frames are specified (see <linkto class=Measure>Measure</linkto>)
61 // as <src>Measure::Ref</src> (e.g. <src>MEpoch::Ref</src>).
62 //
63 // A Measure::Ref is a container for <em>type</em> indicators,
64 // (e.g. <src>MDirection::J2000</src>),
65 // an optional offset (e.g. beginning of year), and, if necessary, a
66 // <linkto class=MeasFrame>MeasFrame</linkto>.<br>
67 // A MeasFrame consists of
68 // one or more Measures specifying the reference frame (e.g. an
69 // <linkto class=MPosition>MPosition</linkto> for a sidereal time definition).
70 // A time
71 // (<linkto class=MEpoch>MEpoch</linkto>) could e.g. have a type
72 // <src>MEpoch::TAI</src>, and an MEpoch as offset:
73 // <srcblock>
74 // MEpoch off(Quantity(40745,"d"), MEpoch::Ref(MEpoch::UTC));
75 // MEpoch::Ref myref(MEpoch::TAI, off);
76 // </srcblock>
77 //
78 // It is obvious that a circular reference between Measure and Measure::Ref
79 // is possible. Therefore, each Measure has a <em>default</em> reference
80 // (necessary anyway to be able to start a Measure chain). For MEpoch
81 // the default is e.g. an MJD in UTC; and the default Measure for
82 // an MEpoch reference is 0.<br>
83 // References are copied by reference; i.e. a reference can be used in many
84 // places without overhead.<br>
85 // Some <src>Measure::Ref</src> could need additional conversion information
86 // ( example: type of Nutation calculations). They are provided by
87 // <linkto class=Aipsrc>Aipsrc</linkto> keywords. <br>
88 // All constructors are related to a specific Measure, to be able to check
89 // relations at compile time.
90 // </synopsis>
91 //
92 // <example>
93 // See <linkto class=Measure>Measure</linkto> for an example
94 // </example>
95 //
96 // <motivation>
97 // To gather all reference frame information in the one class.
98 // </motivation>
99 //
100 // <todo asof="1997/04/15">
101 // </todo>
102 
103 class MRBase {
104 
105 public:
106 
107  //# Friends
108  friend ostream &operator<<(ostream &os, const MRBase &meas);
109 
110  //# Constructors
111 
112  //# Destructor
113  virtual ~MRBase();
114 
115  //# Operators
116 
117  //# General Member Functions
118  // Check if empty reference
119  virtual Bool empty() const = 0;
120  // Check the type of Measure the reference can be used for:<br>
121  // <src> static const String &showMe() = 0; </src>.<br>
122  // Return the type of the reference
123  // <note role=caution> the following should really be
124  // (and should be interpreted as), but
125  // compiler does not accept it:</note>
126  // <src> Ms::Types getType();</src>
127  virtual uInt getType() const = 0;
128  // Return the frame of the reference
129  virtual MeasFrame &getFrame() = 0;
130  // Return the first frame which has specified information. Checking is done in
131  // argument order.
132  // <thrown>
133  // <li> AipsError if neither reference has a frame or the proper type
134  // </thrown>
135  // <srcblock>
136  // static const MeasFrame &framePosition(const MRBase &ref1,
137  // const MRBase &ref2) = 0;
138  // static const MeasFrame &frameEpoch(const MRBase &ref1,
139  // const MRBase &ref2) = 0;
140  // static const MeasFrame &frameDirection(const MRBase &ref1,
141  // const MRBase &ref2) = 0;
142  // static const MeasFrame &frameRadialVelocity(const MRBase &ref1,
143  // const MRBase &ref2) = 0;
144  // </srcblock>
145  // Return the offset (or 0)
146  virtual const Measure* offset() const = 0;
147  // Set the type
148  // <thrown>
149  // <li> AipsError if wrong Measure
150  // </thrown>
151  // <note role=caution> the following should really be (and should be called as), but
152  // compiler does not accept it:</note>
153  // <src> void set(Ms::Types tp);</src>
154  // <group>
155  virtual void setType(uInt tp) = 0;
156  virtual void set(uInt tp) = 0;
157  // </group>
158  // Set a new offset:<br>
159  // void set(const Measure &ep);
160  // Set a new frame
161  virtual void set(const MeasFrame &mf) = 0;
162 
163  // Print a Measure
164  virtual void print(ostream &os) const = 0;
165 
166 protected:
167 
168 private:
169 
170  //# Data
171 
172  //# Member functions
173 
174 };
175 
176 //# Global functions
177 // <summary> Global functions </summary>
178 // <group name=Output>
179 // Output declaration
180 ostream &operator<<(ostream &os, const MRBase &meas);
181 // </group>
182 
183 
184 } //# NAMESPACE CASACORE - END
185 
186 #endif
virtual const Measure * offset() const =0
Return the first frame which has specified information.
virtual void set(uInt tp)=0
Base for Reference frame for physical measures.
Definition: MRBase.h:103
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
virtual ~MRBase()
Container for Measure frame.
Definition: MeasFrame.h:137
Physical quantities within reference frame.
Definition: Measure.h:235
virtual void print(ostream &os) const =0
Print a Measure.
virtual Bool empty() const =0
Check if empty reference.
virtual void setType(uInt tp)=0
Set the type.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual uInt getType() const =0
Check the type of Measure the reference can be used for: static const String &amp;showMe() = 0; ...
friend ostream & operator<<(ostream &os, const MRBase &meas)
virtual MeasFrame & getFrame()=0
Return the frame of the reference.
unsigned int uInt
Definition: aipstype.h:51