casacore
Loading...
Searching...
No Matches
MSTimeParse.h
Go to the documentation of this file.
1// # MSTimeParse.h: Classes to hold results from time grammar parser
2// # Copyright (C) 1994,1995,1997,1998,1999,2000,2001,2003
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 MS_MSTIMEPARSE_H
27#define MS_MSTIMEPARSE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/ms/MSSel/MSParse.h>
32#include <casacore/ms/MSSel/MSSelectableMainColumn.h>
33#include <casacore/measures/Measures/MEpoch.h>
34#include <casacore/ms/MSSel/MSTimeDefinitions.h>
35#include <casacore/casa/Containers/Block.h>
36#include <casacore/casa/Arrays/Matrix.h>
37
38namespace casacore { // # NAMESPACE CASACORE - BEGIN
39
40// # Forward Declarations
41
42// <summary>
43// Class to hold values from time grammar parser
44// </summary>
45
46// <use visibility=local>
47
48// <reviewed reviewer="" date="" tests="">
49// </reviewed>
50
51// <prerequisite>
52// # Classes you should understand before using this one.
53// </prerequisite>
54
55// <etymology>
56// MSTimeParse is the class used to parse a time command.
57// </etymology>
58
59// <synopsis>
60// MSTimeParse is used by the parser of time sub-expression statements.
61// The parser is written in Bison and Flex in files MSTimeGram.y and .l.
62// The statements in there use the routines in this file to act
63// upon a reduced rule.
64// Since multiple tables can be given (with a shorthand), the table
65// names are stored in a list. The variable names can be qualified
66// by the table name and will be looked up in the appropriate table.
67//
68// The class MSTimeParse only contains information about a table
69// used in the table command. Global variables (like a list and a vector)
70// are used in MSTimeParse.cc to hold further information.
71//
72// Global functions are used to operate on the information.
73// The main function is the global function msTimeCommand.
74// It executes the given STaQL command and returns the resulting ms.
75// This is, in fact, the only function to be used by a user.
76// </synopsis>
77
78// <motivation>
79// It is necessary to be able to give a ms command in ASCII.
80// This can be used in a CLI or in the table browser to get a subset
81// of a table or to sort a table.
82// </motivation>
83
84// # <todo asof="$DATE:$">
85// # A List of bugs, limitations, extensions or planned refinements.
86// # </todo>
87
88class MSTimeParse : public MSParse {
89 public:
90 // Default constructor
92
93 // Associate the ms and the shorthand.
94 MSTimeParse(const MeasurementSet* ms, const TableExprNode& otherTens,
95 const Bool honourRowFlags = True);
96 MSTimeParse(const MeasurementSet* ms, const TableExprNode& colAsTEN,
97 MSSelectableMainColumn& msMainColInterface, const TableExprNode& otherTEN,
98 const Bool honourRowFlags = True);
100
101 // ~MSTimeParse()
102 // {
103 // if (node_p) delete node_p;node_p=0x0;
104 // if (otherTens_p) delete otherTens_p;otherTens_p=0x0;
105 // }
106
107 const TableExprNode* selectTime(const MEpoch& time, bool daytime = false);
108 const TableExprNode* selectTimeGT(const MEpoch& lowboundTime, bool daytime = false);
109 const TableExprNode* selectTimeLT(const MEpoch& upboundTime, bool daytime = false);
110 const TableExprNode* selectTimeRange(const MEpoch& lowboundTime, const MEpoch& upboundTime,
111 bool daytime = false, Float edgeWidth = -1.0);
114
115 /*
116 static const MEpoch *dayTimeConvert(Int day=-1, Int hour = -1,
117 Int minute = -1, Int second = -1,
118 Int millisec = -1);
119 */
120
121 static void setDefaults(TimeFields& tf, Bool dataOrigin = True);
123 static void copyDefaults(TimeFields& target, TimeFields& source);
124 static const MEpoch* yearTimeConvert(Int year = -1, Int month = -1, Int day = -1, Int hour = -1,
125 Int minute = -1, Int second = -1, Int millisec = -1);
126 static const MEpoch* yearTimeConvert(const TimeFields& tf);
127
128 // Get table expression node object.
129 static const TableExprNode* node();
130
131 Int year0() { return defaultYear; }
132 Int month0() { return defaultMonth; }
133 Int day0() { return defaultDay; }
134 Int hour0() { return defaultHour; }
139
140 static void validate(const TimeFields& tf);
141 static void reset() { timeList.resize(3, 0); }
142 static void cleanup() {
143 if (node_p) delete node_p;
144 node_p = 0x0;
145 }
146
148 // private:
149
154 static Double toTAIInSec(const MEpoch& time);
163 void accumulateTimeList(const Double t0, const Double t1, const Double dT = -1);
167};
168
169} // namespace casacore
170
171#endif
MSParse()
Default constructor for List container class.
MeasurementSet * ms()
Get ms object.
static void setDefaults(TimeFields &tf, Bool dataOrigin=True)
Matrix< Double > selectedTimes()
static MEpoch * daytime
static MSTimeParse * thisMSTParser
static void validate(const TimeFields &tf)
static TableExprNode columnAsTEN_p
static MSSelectableMainColumn * mainColumn_p
static Double toTAIInSec(const MEpoch &time)
const TableExprNode * selectTime(const MEpoch &time, bool daytime=false)
~MSTimeParse() { if (node_p) delete node_p;node_p=0x0; if (otherTens_p) delete otherTens_p;otherTens_...
const TableExprNode * addCondition(TableExprNode &condition)
const TableExprNode * selectTimeLT(const MEpoch &upboundTime, bool daytime=false)
static MeasurementSet * ms_p
static Bool defaultTimeComputed
static Matrix< Double > timeList
static TableExprNode * otherTens_p
private:
const TableExprNode * selectTimeGT(const MEpoch &lowboundTime, bool daytime=false)
MSTimeParse(const MeasurementSet *ms, const TableExprNode &otherTens, const Bool honourRowFlags=True)
Associate the ms and the shorthand.
static const MEpoch * yearTimeConvert(Int year=-1, Int month=-1, Int day=-1, Int hour=-1, Int minute=-1, Int second=-1, Int millisec=-1)
void accumulateTimeList(const Double t0, const Double t1, const Double dT=-1)
const TableExprNode * selectTimeRange(const MEpoch &lowboundTime, const MEpoch &upboundTime, bool daytime=false, Float edgeWidth=-1.0)
MSTimeParse()
Default constructor.
static const MEpoch * yearTimeConvert(const TimeFields &tf)
static void cleanup()
static TableExprNode * node_p
static MEpoch * yeartime
static void reset()
MSTimeParse(const MeasurementSet *ms, const TableExprNode &colAsTEN, MSSelectableMainColumn &msMainColInterface, const TableExprNode &otherTEN, const Bool honourRowFlags=True)
static const TableExprNode * node()
Get table expression node object.
static void copyDefaults(TimeFields &target, TimeFields &source)
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
TableExprNode time(const TableExprNode &node)
Definition ExprNode.h:1368
TableExprNode day(const TableExprNode &node)
Definition ExprNode.h:1329
TableExprNode month(const TableExprNode &node)
Definition ExprNode.h:1326
TableExprNode year(const TableExprNode &node)
Definition ExprNode.h:1323
float Float
Definition aipstype.h:52
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41
double Double
Definition aipstype.h:53