casa
$Rev:20696$
|
00001 //# MeasBase.h: Base class for all measures 00002 //# Copyright (C) 1995,1996,1997,1998,1999,2000,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: MeasBase.h 20615 2009-06-09 02:16:01Z Malte.Marquarding $ 00028 00029 #ifndef MEASURES_MEASBASE_H 00030 #define MEASURES_MEASBASE_H 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <measures/Measures/Measure.h> 00035 #include <casa/Quanta/Quantum.h> 00036 00037 namespace casa { //# NAMESPACE CASA - BEGIN 00038 00039 //# Forward Declarations 00040 template <class T> class Vector; 00041 00042 //# Typedefs 00043 00044 // <summary> Base class for all measures </summary> 00045 00046 // <use visibility=local> 00047 00048 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos=""> 00049 // </reviewed> 00050 00051 // <prerequisite> 00052 // <li> <linkto class=Measure>Measure</linkto> class 00053 // </prerequisite> 00054 // 00055 // <etymology> 00056 // Measure and Base 00057 // </etymology> 00058 // 00059 // <synopsis> 00060 // MeasBase forms derived Measure class for all actual measures 00061 // </synopsis> 00062 // 00063 // <example> 00064 // </example> 00065 // 00066 // <motivation> 00067 // To have most work in single routine 00068 // </motivation> 00069 // 00070 // <todo asof="1997/04/15"> 00071 // <li> 00072 // </todo> 00073 //# Made non-virtual for MeasureHolder 00074 //#template<class Mv, class Mr> class MeasBase : public virtual Measure { 00075 template<class Mv, class Mr> class MeasBase : public Measure { 00076 00077 public: 00078 //# Friends 00079 00080 //# Enumerations 00081 00082 //# Typedefs 00083 00084 //# Constructors 00085 // <note role=tip> In the following constructors and other functions, all 00086 // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src> 00087 // where no offsets or frames are needed in the reference. For reasons 00088 // of compiler limitations the formal arguments had to be specified as 00089 // <em>uInt</em> rather than the Measure enums that should be used as actual 00090 // arguments.</note> 00091 // Default constructor 00092 MeasBase(); 00093 // Copy constructor 00094 MeasBase(const MeasBase<Mv,Mr> &other); 00095 // Copy assignment 00096 MeasBase<Mv,Mr> &operator=(const MeasBase<Mv,Mr> &other); 00097 // Create from data and reference 00098 // <group> 00099 MeasBase(const Mv &dt, const Mr &rf); 00100 MeasBase(const Mv &dt, uInt rf); 00101 MeasBase(const Quantity &dt, const Mr &rf); 00102 MeasBase(const Quantity &dt, uInt rf); 00103 MeasBase(const Measure *dt); 00104 MeasBase(const Mr &rf); 00105 MeasBase(const uInt rf); 00106 // </group> 00107 00108 //# Destructor 00109 virtual ~MeasBase(); 00110 00111 //# Operators 00112 00113 //# General Member Functions 00114 // Check the type of derived entity 00115 virtual Bool areYou(const String &tp) const; 00116 // Assert that we are the correct type 00117 // <thrown> 00118 // <li> AipsError if wrong Measure 00119 // </thrown> 00120 virtual void assured(const String &tp) const; 00121 00122 // Refill the specified entities 00123 // <group> 00124 void set(const Mv &dt); 00125 void set(const Mr &rf); 00126 void set(const Mv &dt, const Mr &rf); 00127 void set(const Unit &inunit); 00128 virtual void set(const MeasValue &dt); 00129 virtual Bool putValue(const Vector<Quantum<Double> > &in); 00130 // </group> 00131 00132 // Get reference 00133 Mr getRef() const; 00134 00135 // Get Measure data 00136 // <group> 00137 const Mv &getValue() const; 00138 // </group> 00139 00140 // Get Unit 00141 const Unit &getUnit() const; 00142 00143 // Get reference pointer 00144 virtual MRBase *getRefPtr() const; 00145 00146 // Get pointer to data 00147 virtual const MeasValue* getData() const; 00148 00149 // Print a Measure 00150 virtual void print(std::ostream &os) const; 00151 00152 protected: 00153 //# Enumerations 00154 00155 //# Data 00156 // The measure value (e.g. instant in time) 00157 Mv data; 00158 // Reference frame data 00159 Mr ref; 00160 // Possible input units 00161 Unit unit; 00162 // Error information 00163 // MeasErr error; 00164 00165 00166 private: 00167 //# Member functions 00168 // Clear the measure 00169 void clear(); 00170 00171 }; 00172 00173 00174 } //# NAMESPACE CASA - END 00175 00176 #ifndef CASACORE_NO_AUTO_TEMPLATES 00177 #include <measures/Measures/MeasBase.tcc> 00178 #endif //# CASACORE_NO_AUTO_TEMPLATES 00179 #endif