casacore
EpochUDF.h
Go to the documentation of this file.
1 //# EpochUDF.h: TaQL UDFs for Epoch conversions
2 //# Copyright (C) 2011
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef MEAS_EPOCHUDF_H
29 #define MEAS_EPOCHUDF_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/meas/MeasUDF/EpochEngine.h>
34 #include <casacore/tables/TaQL/UDFBase.h>
35 #include <casacore/tables/TaQL/ExprNode.h>
36 #include <casacore/measures/Measures/MEpoch.h>
37 #include <casacore/measures/Measures/MCEpoch.h>
38 #include <casacore/measures/Measures/MeasConvert.h>
39 
40 namespace casacore {
41 
42 // <summary>
43 // TaQL UDFs for Epoch conversions.
44 // </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="" date="" tests="tMeas.cc">
49 // </reviewed>
50 
51 // <prerequisite>
52 //# Classes you should understand before using this one.
53 // <li> UDFBase
54 // </prerequisite>
55 
56 // <synopsis>
57 // EpochUDF defines UDFs (user defined functions) that can be used in TaQL
58 // to convert Measures for epochs.
59 // Special functions exist to convert to local sidereal time.
60 // In this way such derived values appear to be ordinary TaQL functions.
61 //
62 // A function is called like:
63 // <srcblock>
64 // meas.epoch (toref, epoch, fromref, pos, posref)
65 // For example,
66 // meas.dir ('APP', 'MOON', POSITION, TIME)
67 // </srcblock>
68 // <ul>
69 // <li>
70 // <src>toref</src> is a single constant string.
71 // <li>
72 // <src>dir</src> can have various value types. A single numeric array is
73 // a series of RA,DEC in J2000. If given as a set, the last argument of the
74 // set can be the reference types of the values in the set. The values can
75 // be strings (indicating planetary objects) or value pairs giving lon,lat.
76 // The default reference type is J2000.
77 // </ul>
78 // All functions have data type double and unit radian.
79 // </synopsis>
80 
81 // <motivation>
82 // It makes it possible to handle measures in TaQL.
83 // </motivation>
84 
85  class EpochUDF: public UDFBase
86  {
87  public:
88  // Define the possible function types.
89  enum FuncType {EPOCH, LAST};
90 
91  explicit EpochUDF (FuncType);
92 
93  // Function to create an object.
94  static UDFBase* makeEPOCH (const String&);
95  static UDFBase* makeLAST (const String&);
96 
97  // Setup the object.
98  virtual void setup (const Table&, const TaQLStyle&);
99 
100  // Get the value.
101  virtual Double getDouble (const TableExprId& id);
102  virtual Array<Double> getArrayDouble (const TableExprId& id);
103 
104  private:
105  //# Data members.
110  };
111 
112 } //end namespace
113 
114 #endif
PositionEngine itsPositionEngine
Definition: EpochUDF.h:107
virtual void setup(const Table &, const TaQLStyle &)
Setup the object.
static UDFBase * makeLAST(const String &)
Main interface class to a read/write table.
Definition: Table.h:149
static UDFBase * makeEPOCH(const String &)
Function to create an object.
Engine for TaQL UDF Position conversions.
Abstract base class for a user-defined TaQL function.
Definition: UDFBase.h:233
virtual Double getDouble(const TableExprId &id)
Get the value.
TaQL UDFs for Epoch conversions.
Definition: EpochUDF.h:85
double Double
Definition: aipstype.h:52
Class with static members defining the TaQL style.
Definition: TaQLStyle.h:64
Engine for TaQL UDF Epoch conversions.
Definition: EpochEngine.h:88
MEpoch::Types itsRefType
Definition: EpochUDF.h:109
virtual Array< Double > getArrayDouble(const TableExprId &id)
FuncType
Define the possible function types.
Definition: EpochUDF.h:89
The identification of a TaQL selection subject.
Definition: TableExprId.h:98
FuncType itsType
Definition: EpochUDF.h:108
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
EpochEngine itsEngine
Definition: EpochUDF.h:106
this file contains all the compiler specific defines
Definition: mainpage.dox:28