/usr/include/casacore/measures/Measures/MeasConvert.h is in casacore-dev 2.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | //# MeasConvert.h: Conversion of Measures
//# Copyright (C) 1995,1996,1997,1998,1999,2000,2001
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//#
//# $Id$
#ifndef MEASURES_MEASCONVERT_H
#define MEASURES_MEASCONVERT_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/casa/Containers/Block.h>
#include <casacore/measures/Measures/MConvertBase.h>
#include <casacore/casa/Quanta/Quantum.h>
#include <casacore/measures/Measures/Measure.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
//# Forward Declarations
class MCBase;
class MeasVal;
//# Typedefs
//# Constants
// <summary> Conversion of Measures </summary>
// <use visibility=export>
// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
// </reviewed>
// <prerequisite>
// <li> <linkto class=Measure>Measure</linkto> class
// <li> <linkto class=MRBase>MeasRef</linkto> base class
// <li> <linkto class=MConvertBase>MConvertBase</linkto> class
// <li> <linkto class=Quantum>Quantum</linkto> class
// </prerequisite>
//
// <etymology>
// </etymology>
//
// <synopsis>
// MeasConvert can convert a Measure to the same type of Measure in a
// different reference frame. The MeasConvert is a templated class, but
// has typedefs, which are strongly recommended to be used,
// for the allowed conversions, like <src>MEpoch::Convert.</src><br>
// The basic operation is to create a MeasConvert with either of:
// <ul>
// <li> MEpoch::Convert(MEpoch, MEpoch::Ref), where the
// <linkto class=MEpoch>MEpoch</linkto> is a template for subsequent
// conversions, i.e. it will remember the value (with its reference) and
// the <linkto class=MeasRef>MeasRef</linkto> output reference.
// <li> MEpoch::Convert(MEpoch) with a subsequent setOut(MEpoch::Ref)
// <li> MEpoch::Convert(MEpoch::Ref in, MEpoch::Ref out) is a template for
// conversions from the input reference to the output reference. The
// 'template' model used is the default value for the Measure, with
// no units.
// <li> MEpoch::Convert(Unit, MEpoch::Ref in, MEpoch::Ref out) is a
// template for
// conversions from the input reference to the output reference. The
// 'template' model used is the default value for the Measure, with
// the default units as specified.
// <li> MEpoch::Convert() with a setModel(MEpoch) and setOut().
// </ul>
// An empty MeasRef argument indicates no conversion will be attempted<br>.
// The constructor, and set functions, analyse the 'template' Measure and the
// output reference frame, and construct a pointer (in practice a list
// of pointers to bypass the necessity of creating too many conversion
// functions) to a conversion routine.
//
// An <src>isNOP()</src> function is available to test if the created
// conversion engine is empty.
//
// Actual conversions are done with the () operator, which produces a new
// MEpoch (or other appropiate Measure).<br>
// Possible arguments are (MVEpoch is used here generic, and indicates the
// internal format of a Measure; possibly, to make sure distinction between
// values with and without units possible, even simple Measures will
// have their own internal class format, e.g. MVDouble.
// The possible arguments to the () conversion operator are (again Epoch
// is used for the generic Measure):
// <ul>
// <li> (MEpoch, MEpoch::Ref): will create a new conversion method, and use
// it to produce the result of converting the MEpoch to the specified
// frame
// <li> (MEpoch): will create a new conversion method from the
// MEpoch to the MeasRef belonging to the MeasConvert
// <li> (Quantity): will use the conversion chain deduced from the
// MEpoch model in the definition of MeasConvert, and will convert the
// Quantity
// <li> (Quantum<Vector<Double> >) as previous
// <li> (Double): will use the units (if present) as specified in the
// MeasConvert object to construct the internal value
// to be converted
// <li> (Vector<Double> >): as previous
// </ul>
// Float versions will be produced if necessary.<br>
// The conversion analyser expects that all Measure classes have a set
// of routines to do the actual analysing and conversion.
// (see <linkto class=MCBase>MCBase</linkto> class for how this is done in
// practice).<br>
// If the standard conversion is not sufficient, additional methods can be
// added at the end of the list with the <src>addMethod()</src> member
// function (for real pros).<br>
// </synopsis>
//
// <example>
// See <linkto class=Measure>Measure</linkto> for an example
// </example>
//
// <motivation>
// Conversion of Measures will in general be done on a series of values.
// Separating the analysis of the calculations necessary for the conversion
// from the actual conversion could speed up the process.
// </motivation>
//
// <todo asof="1999/09/24">
// </todo>
template<class M> class MeasConvert : public MConvertBase {
public:
//# Friends
//# Constructors
// <note role=tip> In the following constructors and other functions, all
// <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
// where no offsets or frames are needed in the reference.</note>
// Construct an empty MeasConvert. It is not usable, unless a setModel, and
// probably a setOut has been done.
MeasConvert();
// Copy constructor
MeasConvert(const MeasConvert<M> &other);
// Copy assignment
MeasConvert<M> &operator=(const MeasConvert<M> &other);
// Construct a conversion for the specified Measure and reference
// <group>
MeasConvert(const M &ep);
MeasConvert(const M &ep, const typename M::Ref &mr);
MeasConvert(const Measure &ep, const typename M::Ref &mr);
MeasConvert(const M &ep, typename M::Types mr);
MeasConvert(const Measure &ep, typename M::Types mr);
MeasConvert(const typename M::Ref &mrin, const typename M::Ref &mr);
MeasConvert(const typename M::Ref &mrin, typename M::Types mr);
MeasConvert(typename M::Types mrin, const typename M::Ref &mr);
MeasConvert(typename M::Types mrin, typename M::Types mr);
MeasConvert(const Unit &inunit, const typename M::Ref &mrin,
const typename M::Ref &mr);
MeasConvert(const Unit &inunit, const typename M::Ref &mrin,
typename M::Types mr);
MeasConvert(const Unit &inunit, typename M::Types mrin,
const typename M::Ref &mr);
MeasConvert(const Unit &inunit, typename M::Types mrin,
typename M::Types mr);
// </group>
//# Destructor
~MeasConvert();
//# Operators
// The actual conversion operations
// <group>
// Convert model Measure to output frame
const M &operator()();
const M &operator()(Double val);
const M &operator()(const Vector<Double> &val);
const M &operator()(const Quantum<Double> &val);
const M &operator()(const Quantum<Vector<Double> > &val);
const M &operator()(const typename M::MVType &val);
const M &operator()(const MeasVal *val);
const M &operator()(const M &val);
const M &operator()(const M &val, const typename M::Ref &mr);
const M &operator()(const M &val, typename M::Types mr);
const M &operator()(const typename M::Ref &mr);
const M &operator()(typename M::Types mr);
// </group>
//# General Member Functions
// Set a new model for the conversion
virtual void setModel(const Measure &val);
// Set a new output reference
// <group>
void setOut(const typename M::Ref &mr);
void setOut(typename M::Types mr);
// </group>
// Set a new model and reference
// <group>
void set(const M &val, const typename M::Ref &mr);
void set(const M &val, typename M::Types mr);
// </group>
// Set a new model value only
virtual void set(const MeasValue &val);
// Set a new model unit only
virtual void set(const Unit &inunit);
// Add a method (Note: uInt should be an enum from the appropiate Measure)
virtual void addMethod(uInt method);
// Add the frame type (Note: tp should be an MeasFrame::FrameType)
virtual void addFrameType(uInt tp);
// Get number of methods
virtual Int nMethod() const;
// Get method
virtual uInt getMethod(uInt which) const;
// Is the conversion engine empty?
Bool isNOP() { return crout.nelements() == 0; }
// Print conversion engine
virtual void print(ostream &os) const;
private:
//# Data
// The model template Measure
Measure *model;
// The model unit to be used in conversions
Unit unit;
// The output reference
typename M::Ref outref;
// The input offset
typename M::MVType *offin;
// The output offset
typename M::MVType *offout;
// Vector of conversion routines (length variable)
Block<uInt> crout;
// Coded (with MeasFrame::FrameTypes) frames used in conversion
uInt crtype;
// Local conversion data
MCBase *cvdat;
// Cyclic buffer for return values
// <group>
// Current pointer
Int lres;
M *result[4];
// </group>
// Local variables that can be used in conversion
// <group>
typename M::MVType *locres;
// </group>
//# Member functions
// Initialise pointers
void init();
// Copy a MeasConvert
void copy(const MeasConvert<M> &other);
// Clear self
void clear();
// Create the conversion routine chain
void create();
// Convert a value
// <group>
const typename M::MVType &convert();
const typename M::MVType &convert(const typename M::MVType &val);
// </group>
};
//# Global functions
} //# NAMESPACE CASACORE - END
#ifndef CASACORE_NO_AUTO_TEMPLATES
#include <casacore/measures/Measures/MeasConvert.tcc>
#endif //# CASACORE_NO_AUTO_TEMPLATES
#endif
|