casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Converter.h
Go to the documentation of this file.
1 //# Copyright (C) 2005
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 
26 #ifndef CONVERTER_H_
27 #define CONVERTER_H_
28 
29 #include <QList>
30 #include <QString>
31 #include <casa/Arrays/Vector.h>
33 namespace casa {
34 
35  class Converter {
36  public:
37  Converter( const QString& oldUnits, const QString& newUnits);
38 
39  //Factory for producing the appropriate converter.
40  //Note: user is responsible for deleting the converter.
41  static Converter* getConverter( const QString& oldUnits,const QString& newUnits );
42  static void convert( casacore::Vector<double> &resultValues, int sourceIndex, int destIndex, casacore::SpectralCoordinate coordinate);
43  QString getNewUnits() const;
44 
45  //Abstract methods to be implemented by subclasses.
46  virtual double toPixel( double value, casacore::SpectralCoordinate coordinate ) = 0;
48  virtual double convert ( double oldValue, casacore::SpectralCoordinate coordinate);
49  virtual ~Converter();
50 
52 
53  static UnitType getUnitType( const QString& unit );
54 
55  protected:
56  static const QList<QString> FREQUENCY_UNITS;
57  static const QList<QString> WAVELENGTH_UNITS;
58  static const QList<QString> VELOCITY_UNITS;
59 
60  QString oldUnits;
61  QString newUnits;
62 
63 
64  };
65 
66 } /* namespace casa */
67 #endif /* CONVERTER_H_ */
static Converter * getConverter(const QString &oldUnits, const QString &newUnits)
Factory for producing the appropriate converter.
static const QList< QString > VELOCITY_UNITS
Definition: Converter.h:58
virtual ~Converter()
Converter(const QString &oldUnits, const QString &newUnits)
static void convert(casacore::Vector< double > &resultValues, int sourceIndex, int destIndex, casacore::SpectralCoordinate coordinate)
QString newUnits
Definition: Converter.h:61
virtual double toPixel(double value, casacore::SpectralCoordinate coordinate)=0
Abstract methods to be implemented by subclasses.
static UnitType getUnitType(const QString &unit)
Interconvert pixel and frequency values.
QString getNewUnits() const
static const QList< QString > WAVELENGTH_UNITS
Definition: Converter.h:57
static const QList< QString > FREQUENCY_UNITS
Definition: Converter.h:56
QString oldUnits
Definition: Converter.h:60
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.