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