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{
90
91public:
92 // Default constructor
94
95 // Associate the ms and the shorthand.
96 MSTimeParse (const MeasurementSet* ms,const TableExprNode& otherTens,const Bool honourRowFlags=True);
97 MSTimeParse (const MeasurementSet* ms,const TableExprNode& colAsTEN,
98 MSSelectableMainColumn& msMainColInterface,
99 const TableExprNode& otherTEN,
100 const Bool honourRowFlags=True);
102
103// ~MSTimeParse()
104// {
105// if (node_p) delete node_p;node_p=0x0;
106// if (otherTens_p) delete otherTens_p;otherTens_p=0x0;
107// }
108
110 bool daytime = false);
111 const TableExprNode *selectTimeGT(const MEpoch& lowboundTime,
112 bool daytime = false);
113 const TableExprNode *selectTimeLT(const MEpoch& upboundTime,
114 bool daytime = false);
115 const TableExprNode *selectTimeRange(const MEpoch& lowboundTime,
116 const MEpoch& upboundTime,
117 bool daytime = false,
118 Float edgeWidth=-1.0);
121
122 /*
123 static const MEpoch *dayTimeConvert(Int day=-1, Int hour = -1,
124 Int minute = -1, Int second = -1,
125 Int millisec = -1);
126 */
127
128 static void setDefaults(TimeFields& tf, Bool dataOrigin=True);
130 static void copyDefaults(TimeFields& target, TimeFields& source);
131 static const MEpoch *yearTimeConvert(Int year=-1, Int month=-1, Int day=-1,
132 Int hour = -1, Int minute = -1,
133 Int second = -1, Int millisec = -1);
134 static const MEpoch *yearTimeConvert(const TimeFields& tf);
135
136 // Get table expression node object.
137 static const TableExprNode* node();
138
141 Int day0() {return defaultDay;}
147
148 static void validate(const TimeFields& tf);
149 static void reset(){timeList.resize(3,0);}
150 static void cleanup() {if (node_p) delete node_p;node_p=0x0;}
151
153 //private:
154
159 static Double toTAIInSec(const MEpoch& time);
168 void accumulateTimeList(const Double t0, const Double t1,const Double dT=-1);
172};
173
174} //# NAMESPACE CASACORE - END
175
176#endif
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)
void resize(size_t nx, size_t ny, bool copyValues=false)
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
TableExprNode time(const TableExprNode &node)
Definition ExprNode.h:1584
TableExprNode day(const TableExprNode &node)
Definition ExprNode.h:1527
TableExprNode month(const TableExprNode &node)
Definition ExprNode.h:1523
TableExprNode year(const TableExprNode &node)
Definition ExprNode.h:1519
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