casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MCBaseline.h
Go to the documentation of this file.
00001 //# MCBaseline.h: MBaseline conversion routines 
00002 //# Copyright (C) 1998-2000,2002,2004,2007
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: MCBaseline.h 21130 2011-10-18 07:39:05Z gervandiepen $
00028 
00029 #ifndef MEASURES_MCBASELINE_H
00030 #define MEASURES_MCBASELINE_H
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <measures/Measures/MBaseline.h>
00035 #include <measures/Measures/MeasBase.h>
00036 #include <measures/Measures/MeasRef.h>
00037 #include <measures/Measures/MCBase.h>
00038 #include <measures/Measures/MConvertBase.h>
00039 #include <measures/Measures/MeasMath.h>
00040 #include <casa/OS/Mutex.h>
00041 
00042 namespace casa { //# NAMESPACE CASA - BEGIN
00043 
00044 //# Forward Declarations
00045 class MCBaseline;
00046 class String;
00047 template <class T> class Vector;
00048 
00049 //# Typedefs
00050 
00051 // <summary> MBaseline conversion routines  </summary>
00052 
00053 // <use visibility=local>
00054 
00055 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMBaseline" demos="">
00056 // </reviewed>
00057 
00058 // <prerequisite>
00059 //   <li> <linkto class=Measure>Measure</linkto> class 
00060 //   <li> <linkto class=MCBase>MCBase</linkto> base class
00061 //   <li> <linkto class=MConvertBase>overall conversion</linkto>  class
00062 // </prerequisite>
00063 //
00064 // <etymology>
00065 // Measure, Convert and Baseline
00066 // </etymology>
00067 //
00068 // <synopsis>
00069 // Contains state machinery and caching for actual conversions
00070 // </synopsis>
00071 //
00072 // <example>
00073 // See <linkto module=Measures>Measures</linkto> module description for
00074 // conversion examples.
00075 // </example>
00076 //
00077 // <motivation>
00078 // </motivation>
00079 //
00080 // <todo asof="2000/09/12">
00081 //      <li> nothing I know
00082 // </todo>
00083 
00084 class MCBaseline : public MCBase { 
00085   
00086 public:
00087 
00088   //# Friends
00089   // Conversion of data
00090   friend class MeasConvert<MBaseline>;
00091   
00092   //# Constructors
00093   // Default constructor
00094   MCBaseline();
00095   
00096   //# Destructor
00097   ~MCBaseline();
00098 
00099   //# Member functions
00100   // Show the state of the conversion engine (mainly for debugging purposes)
00101   static String showState();
00102 
00103 private:  
00104   //# Enumerations
00105   // The list of actual routines provided.
00106   // <note role=warning> Each <src>AA_BB</src> in the list points to routine
00107   // that can be used in the FromTo list in the getConvert routine.
00108   // In addition the type to which each is converted should be in the
00109   // ToRef array, again in the proper order. </note>
00110   enum Routes {
00111     GAL_J2000,
00112     GAL_B1950,
00113     J2000_GAL,
00114     B1950_GAL,
00115     J2000_B1950,
00116     J2000_B1950_VLA,
00117     B1950_J2000,
00118     B1950_VLA_J2000,
00119     B1950_B1950_VLA,
00120     B1950_VLA_B1950,
00121     J2000_JMEAN,
00122     B1950_BMEAN,
00123     JMEAN_J2000,
00124     JMEAN_JTRUE,
00125     BMEAN_B1950,
00126     BMEAN_BTRUE,
00127     JTRUE_JMEAN,
00128     BTRUE_BMEAN,
00129     J2000_JNAT,
00130     JNAT_J2000,
00131     B1950_APP,
00132     APP_B1950,
00133     APP_TOPO,
00134     HADEC_AZEL,
00135     HADEC_AZELGEO,
00136     AZEL_HADEC,
00137     AZELGEO_HADEC,
00138     HADEC_TOPO,
00139     AZEL_AZELSW,
00140     AZELGEO_AZELSWGEO,
00141     AZELSW_AZEL,
00142     AZELSWGEO_AZELGEO,
00143     APP_JNAT,
00144     JNAT_APP,
00145     J2000_ECLIP,
00146     ECLIP_J2000,
00147     JMEAN_MECLIP,
00148     MECLIP_JMEAN,
00149     JTRUE_TECLIP,
00150     TECLIP_JTRUE,
00151     GAL_SUPERGAL,
00152     SUPERGAL_GAL,
00153     ITRF_HADEC,
00154     HADEC_ITRF,
00155     TOPO_HADEC,
00156     TOPO_APP,
00157     ICRS_J2000,
00158     J2000_ICRS,
00159     N_Routes
00160   };
00161   
00162   //# Typedefs
00163   
00164   //# Operators
00165   
00166   //# General Member Functions
00167   
00168   //# Enumerations
00169   
00170   //# Cached Data
00171   MeasMath measMath;
00172 
00173   //# State machine data
00174   // Transition list
00175   static uInt ToRef_p[N_Routes][3];
00176   // Transition matrix
00177   static uInt FromTo_p[MBaseline::N_Types][MBaseline::N_Types];
00178   // Mutex for thread-safety.
00179   static MutexedInit theirMutexedInit;
00180 
00181   // Fill the global state in a thread-safe way.
00182   static void fillState()
00183     { theirMutexedInit.exec(); }
00184 
00185   //# Constructors
00186   // Copy constructor (not implemented)
00187   MCBaseline(const MCBaseline &other);
00188   // Assignment (not implemented)
00189   MCBaseline &operator=(const MCBaseline &other);
00190   
00191   //# Member functions
00192   
00193   // Create conversion function pointer
00194   virtual void getConvert(MConvertBase &mc,
00195                           const MRBase &inref, 
00196                           const MRBase &outref);
00197   
00198   // Create help structures for Measure conversion routines
00199   virtual void initConvert(uInt which, MConvertBase &mc);
00200   
00201   // Delete the pointers used in the MeasConvert help structure cache
00202   virtual void clearConvert();
00203   
00204   // Routines to convert Baselines from one reference frame to another
00205   virtual void doConvert(MeasValue &in,
00206                          MRBase &inref,
00207                          MRBase &outref,
00208                          const MConvertBase &mc);
00209   // Conversion routine to cater for inheritance question
00210   void doConvert(MVBaseline &in,
00211                  MRBase &inref,
00212                  MRBase &outref,
00213                  const MConvertBase &mc);
00214 
00215 private:
00216   // Fill the global state in a thread-safe way.
00217   static void doFillState (void*);  
00218 };
00219 
00220 
00221 } //# NAMESPACE CASA - END
00222 
00223 #endif
00224