casacore
EpochEngine.h
Go to the documentation of this file.
1 //# EpochEngine.h: Engine for TaQL UDF 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_EPOCHENGINE_H
29 #define MEAS_EPOCHENGINE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include<casacore/meas/MeasUDF/MeasEngine.h>
34 #include <casacore/measures/Measures/MEpoch.h>
35 #include <casacore/measures/Measures/MCEpoch.h>
36 #include <casacore/measures/Measures/MeasConvert.h>
37 
38 namespace casacore {
39 
40  //# Forward declarations
41  class PositionEngine;
42 
43 
44 // <summary>
45 // Engine for TaQL UDF Epoch conversions
46 // </summary>
47 
48 // <use visibility=export>
49 
50 // <reviewed reviewer="" date="" tests="tMeas.cc">
51 // </reviewed>
52 
53 // <prerequisite>
54 //# Classes you should understand before using this one.
55 // <li> EngineBase
56 // </prerequisite>
57 
58 // <synopsis>
59 // EpochEngine defines Engines (user defined functions) that can be used in TaQL
60 // to convert Measures for epochs.
61 // In this way such derived values appear to be ordinary TaQL functions.
62 //
63 // In TaQL these functions can be called like:
64 // <srcblock>
65 // meas.epoch (toref, time, fromref)
66 // meas.last (time, fromref, pos, posref)
67 // For example,
68 // meas.epoch ('UTC', 1e9 s, 'WGS84')
69 // </srcblock>
70 // <ul>
71 // <li>
72 // <src>toref</src> is a single constant string.
73 // <li>
74 // <src>pos</src> can have various value types. A single numeric array is
75 // a series of RA,DEC in J2000. If given as a set, the last argument of the
76 // set can be the reference types of the values in the set. The values can
77 // be strings (indicating planetary objects) or value pairs giving lon,lat.
78 // The default reference type is J2000.
79 // </ul>
80 // All functions have data type double and unit radian.
81 
82 // A epoch can also be a table column which usually knows its type.
83 // It can also be an expression (e.g. EPOCH[0,]) which also knows the type.
84 // </synopsis>
85 
86 // <motivation>
87 // It makes it possible to handle measures in TaQL.
88 // </motivation>
89 
90  class EpochEngine: public MeasEngine<MEpoch>
91  {
92  public:
94 
95  virtual ~EpochEngine();
96 
97  // Tell if the fraction has to be used for sidereal times.
98  Bool sidFrac() const
99  { return itsSidFrac; }
100 
101  // Get the values.
103 
104  // Get the epochs.
106 
107  // Handle the argument(s) giving the input epochs and reference type.
108  // The epoch can be a column in a table.
109  void handleEpoch (std::vector<TENShPtr>& args,
110  uInt& argnr);
111 
112  // Set the MeasConvert object.
114 
115  // Set the possible position engine.
116  // It can be done only once.
118 
119  private:
120  // Strip a possible prefix from the epoch type.
121  virtual String stripMeasType (const String& type);
122  virtual void handleValues (TableExprNode& operand,
123  const TableExprId& id,
124  Array<MEpoch>& epochs);
125 
126  //# Data members.
127  Bool itsSidFrac; //# T = fraction for sidereal
128  MeasFrame itsFrame; //# frame used by converter
131  };
132 
133 } //end namespace
134 
135 #endif
PositionEngine * itsPositionEngine
Definition: EpochEngine.h:130
void setPositionEngine(PositionEngine &engine)
Set the possible position engine.
Array< MEpoch > getEpochs(const TableExprId &id)
Get the epochs.
virtual void handleValues(TableExprNode &operand, const TableExprId &id, Array< MEpoch > &epochs)
Let a derive class handle the values.
void setConverter(MEpoch::Types toType, Bool sidFrac)
Set the MeasConvert object.
MEpoch::Convert itsConverter
Definition: EpochEngine.h:129
void handleEpoch(std::vector< TENShPtr > &args, uInt &argnr)
Handle the argument(s) giving the input epochs and reference type.
Array< Double > getArrayDouble(const TableExprId &id)
Get the values.
virtual String stripMeasType(const String &type)
Strip a possible prefix from the epoch type.
Bool sidFrac() const
Tell if the fraction has to be used for sidereal times.
Definition: EpochEngine.h:98
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition: MEpoch.h:117
String: the storage and methods of handling collections of characters.
Definition: String.h:225
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:51
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42