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