TaQLNodeVisitor.h

Go to the documentation of this file.
00001 //# TaQLNodeVisitor.h: Class to visit the nodes in the raw TaQL parse tree
00002 //# Copyright (C) 2005
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$
00027 
00028 #ifndef TABLES_TAQLNODEVISITOR_H
00029 #define TABLES_TAQLNODEVISITOR_H
00030 
00031 //# Includes
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/tables/TaQL/TaQLNode.h>
00034 #include <casacore/tables/TaQL/TaQLNodeDer.h>
00035 
00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00037 
00038 // <summary>
00039 // Class to visit the nodes in the raw TaQL parse tree.
00040 // </summary>
00041 
00042 // <use visibility=local>
00043 
00044 // <reviewed reviewer="" date="" tests="tTableGram">
00045 // </reviewed>
00046 
00047 // <prerequisite>
00048 //# Classes you should understand before using this one.
00049 //   <li> <linkto class=TaQLNode>TaQLNode</linkto>
00050 //   <li> Note 199 describing
00051 //        <a href="../notes/199.html">
00052 //        TaQL</a>
00053 // </prerequisite>
00054 
00055 // <synopsis> 
00056 // TaQLNodeVisitor is the abstract base class for classes that want to
00057 // visit a TaQLNode tree, i.e. traverse the tree.
00058 // Each visit results in a TaQLNodeResult object which acts as the basis
00059 // for the actual result object.
00060 // <br>
00061 // A specialization of TaQLNodeVisitor (e.g. class
00062 // <linkto class=TaQLNodeHandler>TaQLNodeHandler</linkto> needs to implement
00063 // the various visitXXNode functions. A visit function will process a node
00064 // which usually means visiting its children, etc..
00065 // </synopsis>
00066 
00067 // <motivation>
00068 // The visitor design pattern separates the tree from the way it is processed.
00069 // In this way any handler can be created. For instance, a query optimizer
00070 // could be a future other handler.
00071 // </motivation>
00072 
00073 class TaQLNodeVisitor
00074 {
00075 public:
00076   virtual ~TaQLNodeVisitor();
00077 
00078   // Define the functions to visit each node type.
00079   // <group>
00080   virtual TaQLNodeResult visitConstNode    (const TaQLConstNodeRep& node) = 0;
00081   virtual TaQLNodeResult visitRegexNode    (const TaQLRegexNodeRep& node) = 0;
00082   virtual TaQLNodeResult visitUnaryNode    (const TaQLUnaryNodeRep& node) = 0;
00083   virtual TaQLNodeResult visitBinaryNode   (const TaQLBinaryNodeRep& node) = 0;
00084   virtual TaQLNodeResult visitMultiNode    (const TaQLMultiNodeRep& node) = 0;
00085   virtual TaQLNodeResult visitFuncNode     (const TaQLFuncNodeRep& node) = 0;
00086   virtual TaQLNodeResult visitRangeNode    (const TaQLRangeNodeRep& node) = 0;
00087   virtual TaQLNodeResult visitIndexNode    (const TaQLIndexNodeRep& node) = 0;
00088   virtual TaQLNodeResult visitKeyColNode   (const TaQLKeyColNodeRep& node) = 0;
00089   virtual TaQLNodeResult visitTableNode    (const TaQLTableNodeRep& node) = 0;
00090   virtual TaQLNodeResult visitColNode      (const TaQLColNodeRep& node) = 0;
00091   virtual TaQLNodeResult visitColumnsNode  (const TaQLColumnsNodeRep& node) = 0;
00092   virtual TaQLNodeResult visitJoinNode     (const TaQLJoinNodeRep& node) = 0;
00093   virtual TaQLNodeResult visitGroupNode    (const TaQLGroupNodeRep& node) = 0;
00094   virtual TaQLNodeResult visitSortKeyNode  (const TaQLSortKeyNodeRep& node) = 0;
00095   virtual TaQLNodeResult visitSortNode     (const TaQLSortNodeRep& node) = 0;
00096   virtual TaQLNodeResult visitLimitOffNode (const TaQLLimitOffNodeRep& node) = 0;
00097   virtual TaQLNodeResult visitGivingNode   (const TaQLGivingNodeRep& node) = 0;
00098   virtual TaQLNodeResult visitUpdExprNode  (const TaQLUpdExprNodeRep& node) = 0;
00099   virtual TaQLNodeResult visitSelectNode   (const TaQLSelectNodeRep& node) = 0;
00100   virtual TaQLNodeResult visitUpdateNode   (const TaQLUpdateNodeRep& node) = 0;
00101   virtual TaQLNodeResult visitInsertNode   (const TaQLInsertNodeRep& node) = 0;
00102   virtual TaQLNodeResult visitDeleteNode   (const TaQLDeleteNodeRep& node) = 0;
00103   virtual TaQLNodeResult visitCountNode    (const TaQLCountNodeRep& node) = 0;
00104   virtual TaQLNodeResult visitCalcNode     (const TaQLCalcNodeRep& node) = 0;
00105   virtual TaQLNodeResult visitCreTabNode   (const TaQLCreTabNodeRep& node) = 0;
00106   virtual TaQLNodeResult visitColSpecNode  (const TaQLColSpecNodeRep& node) = 0;
00107   virtual TaQLNodeResult visitRecFldNode   (const TaQLRecFldNodeRep& node) = 0;
00108   virtual TaQLNodeResult visitUnitNode     (const TaQLUnitNodeRep& node) = 0;
00109   virtual TaQLNodeResult visitAltTabNode   (const TaQLAltTabNodeRep& node) = 0;
00110   virtual TaQLNodeResult visitAddColNode   (const TaQLAddColNodeRep& node) = 0;
00111   virtual TaQLNodeResult visitSetKeyNode   (const TaQLSetKeyNodeRep& node) = 0;
00112   virtual TaQLNodeResult visitRenDropNode  (const TaQLRenDropNodeRep& node) = 0;
00113   virtual TaQLNodeResult visitAddRowNode   (const TaQLAddRowNodeRep& node) = 0;
00114   virtual TaQLNodeResult visitConcTabNode  (const TaQLConcTabNodeRep& node) = 0;
00115   virtual TaQLNodeResult visitShowNode     (const TaQLShowNodeRep& node) = 0;
00116   // </group>
00117 
00118 protected:
00119   // A convenience function to visit the given node using this visitor.
00120   TaQLNodeResult visitNode (const TaQLNode& node)
00121     { return node.visit (*this); }
00122 };
00123 
00124 } //# NAMESPACE CASACORE - END
00125 
00126 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1