casa
$Rev:20696$
|
00001 //# MCPosition.h: MPosition conversion routines 00002 //# Copyright (C) 1995,1996,1997,1998,1999,2002 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: MCPosition.h 21130 2011-10-18 07:39:05Z gervandiepen $ 00028 00029 #ifndef MEASURES_MCPOSITION_H 00030 #define MEASURES_MCPOSITION_H 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <measures/Measures/MeasBase.h> 00035 #include <measures/Measures/MeasRef.h> 00036 #include <measures/Measures/MCBase.h> 00037 #include <measures/Measures/MConvertBase.h> 00038 #include <measures/Measures/MPosition.h> 00039 #include <casa/OS/Mutex.h> 00040 00041 namespace casa { //# NAMESPACE CASA - BEGIN 00042 00043 //# Forward Declarations 00044 class MCPosition; 00045 class String; 00046 template <class T> class Vector; 00047 00048 //# Typedefs 00049 00050 // <summary> MPosition conversion routines </summary> 00051 00052 // <use visibility=local> 00053 00054 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos=""> 00055 // </reviewed> 00056 00057 // <prerequisite> 00058 // <li> <linkto class=Measure>Measure</linkto> class 00059 // <li> <linkto class=MCBase>MCBase</linkto> base class 00060 // <li> <linkto class=MConvertBase>overall conversion</linkto> class 00061 // </prerequisite> 00062 // 00063 // <etymology> 00064 // Measure, Convert and Position 00065 // </etymology> 00066 // 00067 // <synopsis> 00068 // Contains state machinery and caching for actual conversions 00069 // </synopsis> 00070 // 00071 // <example> 00072 // See <linkto class=Measure>Measure</linkto> for conversion example. 00073 // </example> 00074 // 00075 // <motivation> 00076 // </motivation> 00077 // 00078 // <todo asof="1996/02/21"> 00079 // <li> 00080 // </todo> 00081 00082 class MCPosition : public MCBase { 00083 00084 public: 00085 00086 //# Friends 00087 // Conversion of data 00088 friend class MeasConvert<MPosition>; 00089 00090 //# Constructors 00091 // Default constructor 00092 MCPosition(); 00093 00094 //# Destructor 00095 ~MCPosition(); 00096 00097 //# Member functions 00098 // Show the state of the conversion engine (mainly for debugging purposes) 00099 static String showState(); 00100 00101 private: 00102 //# Enumerations 00103 // The list of actual routines provided. 00104 // <note role=warning> Each <src>AA_BB</src> in the list points to routine 00105 // that can be used in the FromTo list in the getConvert routine. 00106 // In addition the type to which each is converted should be in the 00107 // ToRef array, again in the proper order. </note> 00108 enum Routes { 00109 ITRF_WGS84, 00110 WGS84_ITRF, 00111 N_Routes }; 00112 00113 //# Typedefs 00114 00115 //# Operators 00116 00117 //# General Member Functions 00118 00119 //# Enumerations 00120 00121 //# Cached Data 00122 Vector<Double> *DVEC1; 00123 00124 //# State machine data 00125 // Transition list 00126 static uInt ToRef_p[N_Routes][3]; 00127 // Transition matrix 00128 static uInt FromTo_p[MPosition::N_Types][MPosition::N_Types]; 00129 // Mutex for thread-safety. 00130 static MutexedInit theirMutexedInit; 00131 00132 // Fill the global state in a thread-safe way. 00133 static void fillState() 00134 { theirMutexedInit.exec(); } 00135 00136 //# Constructors 00137 // Copy constructor (not implemented) 00138 MCPosition(const MCPosition &other); 00139 // Assignment (not implemented) 00140 MCPosition &operator=(const MCPosition &other); 00141 00142 //# Member functions 00143 00144 // Create conversion function pointer 00145 virtual void getConvert(MConvertBase &mc, 00146 const MRBase &inref, 00147 const MRBase &outref); 00148 00149 // Create help structures for Measure conversion routines 00150 virtual void initConvert(uInt which, MConvertBase &mc); 00151 00152 // Delete the pointers used in the MeasConvert help structure cache 00153 virtual void clearConvert(); 00154 00155 // Routine to do actual conversion 00156 virtual void doConvert(MeasValue &in, 00157 MRBase &inref, 00158 MRBase &outref, 00159 const MConvertBase &mc); 00160 // Conversion routine to cater for inheritance question 00161 void doConvert(MVPosition &in, 00162 MRBase &inref, 00163 MRBase &outref, 00164 const MConvertBase &mc); 00165 00166 private: 00167 // Fill the global state in a thread-safe way. 00168 static void doFillState (void*); 00169 }; 00170 00171 00172 } //# NAMESPACE CASA - END 00173 00174 #endif