casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
MSTimeGram.h
Go to the documentation of this file.
00001 //# MSTimeGram.h: Grammar for ms time sub-expressions
00002 //# Copyright (C) 1998
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: MSTimeGram.h 20652 2009-07-06 05:04:32Z Malte.Marquarding $
00027 
00028 #ifndef MS_MSTIMEGRAM_H
00029 #define MS_MSTIMEGRAM_H
00030 
00031 
00032 //# Includes
00033 #include <casa/BasicSL/String.h>
00034 #include <ms/MeasurementSets/MSTimeDefinitions.h>
00035 #include <ms/MeasurementSets/MSTimeParse.h> // routines used by bison actions
00036 #include <ms/MeasurementSets/MSSelectableMainColumn.h>
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038   
00039   //# Forward Declarations
00040   class MeasurementSet;
00041   class TableExprNode;
00042   
00043   // <summary>
00044   // Global functions for flex/bison scanner/parser for MSTimeGram
00045   // </summary>
00046   
00047   // <use visibility=local>
00048   
00049   // <reviewed reviewer="" date="" tests="">
00050   // </reviewed>
00051   
00052   // <prerequisite>
00053   //# Classes you should understand before using this one.
00054   //  <li> MSTimeGram.l and .y  (flex and bison grammar)
00055   // </prerequisite>
00056   
00057   // <synopsis> 
00058   // Global functions are needed to define the input of the flex scanner
00059   // and to start the bison parser.
00060   // The input is taken from a string.
00061   // </synopsis> 
00062   
00063   // <motivation>
00064   // It is necessary to be able to give an image expression in ASCII.
00065   // This can be used in glish.
00066   // </motivation>
00067   // <todo asof="$DATE:$">
00068   //# A List of bugs, limitations, extensions or planned refinements.
00069   // </todo>
00070   
00071   // <group name=MSTimeGramFunctions>
00072   
00073   // Declare the bison parser (is implemented by bison command).
00074   int msTimeGramParseCommand (const MeasurementSet *ms, const String& command, const TableExprNode& otherTens);
00075   int msTimeGramParseCommand (const MeasurementSet *ms, const String& command, const TableExprNode& otherTens,
00076                               Matrix<Double>& timeList);
00077   int msTimeGramParseCommand (const MeasurementSet *ms, const String& command, const TableExprNode& colAsTEN, 
00078                               MSSelectableMainColumn& msMainColInterface, const TableExprNode& otherTens, Matrix<Double>& timeList);
00079   int baseMSTimeGramParseCommand (MSTimeParse* parser, const String& command, 
00080                                   Matrix<Double>& selectedTimeList);
00081     
00082   // The yyerror function for the parser.
00083   // It throws an exception with the current token.
00084     void MSTimeGramerror (const char*);
00085   
00086   // Give the table expression node.
00087   const TableExprNode *msTimeGramParseNode();
00088   void msTimeGramParseDeleteNode();
00089   
00090   // Give the current position in the string.
00091   // This can be used when parse errors occur.
00092   Int& msTimeGramPosition();
00093   
00094   // Declare the input routine for flex/bison.
00095   int msTimeGramInput (char* buf, int max_size);
00096   
00097   // A function to remove escaped characters.
00098   String msTimeGramRemoveEscapes (const String& in);
00099   
00100   // A function to remove quotes from a quoted string.
00101   //String msTimeGramRemoveQuotes (const String& in);
00102   
00103   // A function to set the fields of the TimeFields structure
00104   void msTimeGramSetTimeFields (struct TimeFields& tf, 
00105                                 Int year, Int month, Int day,
00106                                 Int hour, Int minute, Int sec, Int fsec);
00107   // </group>
00108   
00109 } //# NAMESPACE CASA - END
00110 
00111 #endif