casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MRBase.h
Go to the documentation of this file.
00001 //# MRBase.h: Base for Reference frame for physical measures
00002 //# Copyright (C) 1995,1996,1997,1998,1999,2000,2001
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id: MRBase.h 20615 2009-06-09 02:16:01Z Malte.Marquarding $
00028 
00029 #ifndef MEASURES_MRBASE_H
00030 #define MEASURES_MRBASE_H
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <measures/Measures/MeasFrame.h>
00035 #include <casa/iosfwd.h>
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 //# Forward Declarations
00040 class String;
00041 
00042 // <summary> Base for Reference frame for physical measures </summary>
00043 
00044 // <use visibility=local>
00045 
00046 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
00047 // </reviewed>
00048 
00049 // <prerequisite>
00050 //   <li> <linkto class=Quantum>Quantum</linkto> class 
00051 //   <li> <linkto class=Measure>Measure</linkto> class 
00052 // </prerequisite>
00053 //
00054 // <etymology>
00055 // From Measure and Reference and Base
00056 // </etymology>
00057 //
00058 // <synopsis>
00059 // MRBase is the abstract base class for reference frames.
00060 // Reference frames are specified (see <linkto class=Measure>Measure</linkto>)
00061 // as <src>Measure::Ref</src> (e.g. <src>MEpoch::Ref</src>).
00062 //
00063 // A Measure::Ref is a container for <em>type</em> indicators,
00064 // (e.g. <src>MDirection::J2000</src>),
00065 // an optional offset (e.g. beginning of year), and, if necessary, a
00066 // <linkto class=MeasFrame>MeasFrame</linkto>.<br>
00067 // A MeasFrame consists of
00068 // one or more Measures specifying the reference frame (e.g. an
00069 // <linkto class=MPosition>MPosition</linkto> for a sidereal time definition).
00070 // A time
00071 // (<linkto class=MEpoch>MEpoch</linkto>) could e.g. have a type
00072 // <src>MEpoch::TAI</src>, and an MEpoch as offset: 
00073 // <srcblock>
00074 // MEpoch off(Quantity(40745,"d"), MEpoch::Ref(MEpoch::UTC));
00075 // MEpoch::Ref myref(MEpoch::TAI, off);
00076 // </srcblock>
00077 //
00078 // It is obvious that a circular reference between Measure and Measure::Ref
00079 // is possible. Therefore, each Measure has a <em>default</em> reference
00080 // (necessary anyway to be able to start a Measure chain). For MEpoch
00081 // the default is e.g. an MJD in UTC; and the default Measure for
00082 // an MEpoch reference is 0.<br>
00083 // References are copied by reference; i.e. a reference can be used in many
00084 // places without overhead.<br>
00085 // Some <src>Measure::Ref</src> could need additional conversion information
00086 // ( example: type of Nutation calculations). They are provided by
00087 // <linkto class=Aipsrc>Aipsrc</linkto> keywords. <br>
00088 // All constructors are related to a specific Measure, to be able to check
00089 // relations at compile time.
00090 // </synopsis>
00091 //
00092 // <example>
00093 // See <linkto class=Measure>Measure</linkto> for an example
00094 // </example>
00095 //
00096 // <motivation>
00097 // To gather all reference frame information in the one class.
00098 // </motivation>
00099 //
00100 // <todo asof="1997/04/15">
00101 // </todo>
00102 
00103 class MRBase {
00104   
00105 public:
00106 
00107   //# Friends
00108   friend ostream &operator<<(ostream &os, const MRBase &meas);
00109   
00110   //# Constructors
00111   
00112   //# Destructor
00113   virtual ~MRBase();
00114   
00115   //# Operators
00116   
00117   //# General Member Functions
00118   // Check if empty reference
00119   virtual Bool empty() const = 0;
00120   // Check the type of Measure the reference can be used for:<br>
00121   //   <src> static const String &showMe() = 0; </src>.<br>
00122   // Return the type of the reference
00123   // <note role=caution> the following should really be
00124   // (and should be interpreted as), but
00125   // compiler does not accept it:</note>
00126   //   <src> Ms::Types getType();</src>
00127   virtual uInt getType() const = 0;
00128   // Return the frame of the reference
00129   virtual MeasFrame &getFrame() = 0;
00130   // Return the first frame which has specified information. Checking is done in 
00131   // argument order.
00132   // <thrown>
00133   //   <li> AipsError if neither reference has a frame or the proper type
00134   // </thrown>
00135   // <srcblock>
00136   //  static const MeasFrame &framePosition(const MRBase &ref1,
00137   //                                            const MRBase &ref2) = 0;
00138   //  static const MeasFrame &frameEpoch(const MRBase &ref1,
00139   //                                     const MRBase &ref2) = 0;
00140   //  static const MeasFrame &frameDirection(const MRBase &ref1,
00141   //                                         const MRBase &ref2) = 0;
00142   //  static const MeasFrame &frameRadialVelocity(const MRBase &ref1,
00143   //                                              const MRBase &ref2) = 0;
00144   // </srcblock>
00145   // Return the offset (or 0)
00146   virtual const Measure* offset() const = 0;
00147   // Set the type
00148   // <thrown>
00149   //   <li> AipsError if wrong Measure
00150   // </thrown>
00151   // <note role=caution> the following should really be (and should be called as), but
00152   // compiler does not accept it:</note>
00153   //   <src> void set(Ms::Types tp);</src>
00154   // <group>
00155   virtual void setType(uInt tp) = 0;
00156   virtual void set(uInt tp) = 0;
00157   // </group>
00158   // Set a new offset:<br>
00159   //   void set(const Measure &ep);
00160   // Set a new frame
00161   virtual void set(const MeasFrame &mf) = 0;
00162   
00163   // Print a Measure
00164   virtual void print(ostream &os) const = 0;
00165   
00166 protected:
00167   
00168 private:
00169   
00170   //# Data
00171   
00172   //# Member functions
00173   
00174 };
00175 
00176 //# Global functions
00177 // <summary> Global functions </summary>
00178 // <group name=Output>
00179 // Output declaration
00180 ostream &operator<<(ostream &os, const MRBase &meas);
00181 // </group>
00182 
00183 
00184 } //# NAMESPACE CASA - END
00185 
00186 #endif