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
39 class PositionEngine;
40
41
42// <summary>
43// Engine for TaQL UDF 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> EngineBase
54// </prerequisite>
55
56// <synopsis>
57// EpochEngine defines Engines (user defined functions) that can be used in TaQL
58// to convert Measures for epochs.
59// In this way such derived values appear to be ordinary TaQL functions.
60//
61// In TaQL these functions can be called like:
62// <srcblock>
63// meas.epoch (toref, time, fromref)
64// meas.last (time, fromref, pos, posref)
65// For example,
66// meas.epoch ('UTC', 1e9 s, 'WGS84')
67// </srcblock>
68// <ul>
69// <li>
70// <src>toref</src> is a single constant string.
71// <li>
72// <src>pos</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
80// A epoch can also be a table column which usually knows its type.
81// It can also be an expression (e.g. EPOCH[0,]) which also knows the type.
82// </synopsis>
83
84// <motivation>
85// It makes it possible to handle measures in TaQL.
86// </motivation>
87
88 class EpochEngine: public MeasEngine<MEpoch>
89 {
90 public:
92
93 virtual ~EpochEngine();
94
95 // Tell if the fraction has to be used for sidereal times.
96 Bool sidFrac() const
97 { return itsSidFrac; }
98
99 // Get the values.
101
102 // Get the epochs.
104
105 // Handle the argument(s) giving the input epochs and reference type.
106 // The epoch can be a column in a table.
107 void handleEpoch (std::vector<TENShPtr>& args,
108 uInt& argnr);
109
110 // Set the MeasConvert object.
112
113 // Set the possible position engine.
114 // It can be done only once.
116
117 private:
118 // Strip a possible prefix from the epoch type.
119 virtual String stripMeasType (const String& type);
120 virtual void handleValues (TableExprNode& operand,
121 const TableExprId& id,
122 Array<MEpoch>& epochs);
123
124 //# Data members.
125 Bool itsSidFrac; //# T = fraction for sidereal
126 MeasFrame itsFrame; //# frame used by converter
129 };
130
131} //end namespace
132
133#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:96
Types
Types of known MEpochs Caution: The order defines the order in the translation matrix in the MCEpoch...
Definition MEpoch.h:114
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40