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
102public:
103
104 //# Friends
105 friend ostream &operator<<(ostream &os, const MRBase &meas);
106
107 //# Constructors
108
109 //# Destructor
110 virtual ~MRBase();
111
112 //# Operators
113
114 //# General Member Functions
115 // Check if empty reference
116 virtual Bool empty() const = 0;
117 // Check the type of Measure the reference can be used for:<br>
118 // <src> static const String &showMe() = 0; </src>.<br>
119 // Return the type of the reference
120 // <note role=caution> the following should really be
121 // (and should be interpreted as), but
122 // compiler does not accept it:</note>
123 // <src> Ms::Types getType();</src>
124 virtual uInt getType() const = 0;
125 // Return the frame of the reference
126 virtual MeasFrame &getFrame() = 0;
127 // Return the first frame which has specified information. Checking is done in
128 // argument order.
129 // <thrown>
130 // <li> AipsError if neither reference has a frame or the proper type
131 // </thrown>
132 // <srcblock>
133 // static const MeasFrame &framePosition(const MRBase &ref1,
134 // const MRBase &ref2) = 0;
135 // static const MeasFrame &frameEpoch(const MRBase &ref1,
136 // const MRBase &ref2) = 0;
137 // static const MeasFrame &frameDirection(const MRBase &ref1,
138 // const MRBase &ref2) = 0;
139 // static const MeasFrame &frameRadialVelocity(const MRBase &ref1,
140 // const MRBase &ref2) = 0;
141 // </srcblock>
142 // Return the offset (or 0)
143 virtual const Measure* offset() const = 0;
144 // Set the type
145 // <thrown>
146 // <li> AipsError if wrong Measure
147 // </thrown>
148 // <note role=caution> the following should really be (and should be called as), but
149 // compiler does not accept it:</note>
150 // <src> void set(Ms::Types tp);</src>
151 // <group>
152 virtual void setType(uInt tp) = 0;
153 virtual void set(uInt tp) = 0;
154 // </group>
155 // Set a new offset:<br>
156 // void set(const Measure &ep);
157 // Set a new frame
158 virtual void set(const MeasFrame &mf) = 0;
159
160 // Print a Measure
161 virtual void print(ostream &os) const = 0;
162
163protected:
164
165private:
166
167 //# Data
168
169 //# Member functions
170
171};
172
173//# Global functions
174// <summary> Global functions </summary>
175// <group name=Output>
176// Output declaration
177ostream &operator<<(ostream &os, const MRBase &meas);
178// </group>
180
181} //# NAMESPACE CASACORE - END
182
183#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.
this file contains all the compiler specific defines
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.