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