casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TaQLNodeVisitor.h
Go to the documentation of this file.
1 //# TaQLNodeVisitor.h: Class to visit the nodes in the raw TaQL parse tree
2 //# Copyright (C) 2005
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: aips2-request@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 //# $Id$
27 
28 #ifndef TABLES_TAQLNODEVISITOR_H
29 #define TABLES_TAQLNODEVISITOR_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 // <summary>
39 // Class to visit the nodes in the raw TaQL parse tree.
40 // </summary>
41 
42 // <use visibility=local>
43 
44 // <reviewed reviewer="" date="" tests="tTableGram">
45 // </reviewed>
46 
47 // <prerequisite>
48 //# Classes you should understand before using this one.
49 // <li> <linkto class=TaQLNode>TaQLNode</linkto>
50 // <li> Note 199 describing
51 // <a href="../notes/199.html">
52 // TaQL</a>
53 // </prerequisite>
54 
55 // <synopsis>
56 // TaQLNodeVisitor is the abstract base class for classes that want to
57 // visit a TaQLNode tree, i.e. traverse the tree.
58 // Each visit results in a TaQLNodeResult object which acts as the basis
59 // for the actual result object.
60 // <br>
61 // A specialization of TaQLNodeVisitor (e.g. class
62 // <linkto class=TaQLNodeHandler>TaQLNodeHandler</linkto> needs to implement
63 // the various visitXXNode functions. A visit function will process a node
64 // which usually means visiting its children, etc..
65 // </synopsis>
66 
67 // <motivation>
68 // The visitor design pattern separates the tree from the way it is processed.
69 // In this way any handler can be created. For instance, a query optimizer
70 // could be a future other handler.
71 // </motivation>
72 
74 {
75 public:
76  virtual ~TaQLNodeVisitor();
77 
78  // Define the functions to visit each node type.
79  // <group>
80  virtual TaQLNodeResult visitConstNode (const TaQLConstNodeRep& node) = 0;
81  virtual TaQLNodeResult visitRegexNode (const TaQLRegexNodeRep& node) = 0;
82  virtual TaQLNodeResult visitUnaryNode (const TaQLUnaryNodeRep& node) = 0;
83  virtual TaQLNodeResult visitBinaryNode (const TaQLBinaryNodeRep& node) = 0;
84  virtual TaQLNodeResult visitMultiNode (const TaQLMultiNodeRep& node) = 0;
85  virtual TaQLNodeResult visitFuncNode (const TaQLFuncNodeRep& node) = 0;
86  virtual TaQLNodeResult visitRangeNode (const TaQLRangeNodeRep& node) = 0;
87  virtual TaQLNodeResult visitIndexNode (const TaQLIndexNodeRep& node) = 0;
88  virtual TaQLNodeResult visitKeyColNode (const TaQLKeyColNodeRep& node) = 0;
89  virtual TaQLNodeResult visitTableNode (const TaQLTableNodeRep& node) = 0;
90  virtual TaQLNodeResult visitColNode (const TaQLColNodeRep& node) = 0;
91  virtual TaQLNodeResult visitColumnsNode (const TaQLColumnsNodeRep& node) = 0;
92  virtual TaQLNodeResult visitJoinNode (const TaQLJoinNodeRep& node) = 0;
93  virtual TaQLNodeResult visitGroupNode (const TaQLGroupNodeRep& node) = 0;
94  virtual TaQLNodeResult visitSortKeyNode (const TaQLSortKeyNodeRep& node) = 0;
95  virtual TaQLNodeResult visitSortNode (const TaQLSortNodeRep& node) = 0;
96  virtual TaQLNodeResult visitLimitOffNode (const TaQLLimitOffNodeRep& node) = 0;
97  virtual TaQLNodeResult visitGivingNode (const TaQLGivingNodeRep& node) = 0;
98  virtual TaQLNodeResult visitUpdExprNode (const TaQLUpdExprNodeRep& node) = 0;
99  virtual TaQLNodeResult visitSelectNode (const TaQLSelectNodeRep& node) = 0;
100  virtual TaQLNodeResult visitUpdateNode (const TaQLUpdateNodeRep& node) = 0;
101  virtual TaQLNodeResult visitInsertNode (const TaQLInsertNodeRep& node) = 0;
102  virtual TaQLNodeResult visitDeleteNode (const TaQLDeleteNodeRep& node) = 0;
103  virtual TaQLNodeResult visitCountNode (const TaQLCountNodeRep& node) = 0;
104  virtual TaQLNodeResult visitCalcNode (const TaQLCalcNodeRep& node) = 0;
105  virtual TaQLNodeResult visitCreTabNode (const TaQLCreTabNodeRep& node) = 0;
106  virtual TaQLNodeResult visitColSpecNode (const TaQLColSpecNodeRep& node) = 0;
107  virtual TaQLNodeResult visitRecFldNode (const TaQLRecFldNodeRep& node) = 0;
108  virtual TaQLNodeResult visitUnitNode (const TaQLUnitNodeRep& node) = 0;
109  virtual TaQLNodeResult visitAltTabNode (const TaQLAltTabNodeRep& node) = 0;
110  virtual TaQLNodeResult visitAddColNode (const TaQLAddColNodeRep& node) = 0;
111  virtual TaQLNodeResult visitSetKeyNode (const TaQLSetKeyNodeRep& node) = 0;
112  virtual TaQLNodeResult visitRenDropNode (const TaQLRenDropNodeRep& node) = 0;
113  virtual TaQLNodeResult visitAddRowNode (const TaQLAddRowNodeRep& node) = 0;
114  virtual TaQLNodeResult visitConcTabNode (const TaQLConcTabNodeRep& node) = 0;
115  virtual TaQLNodeResult visitShowNode (const TaQLShowNodeRep& node) = 0;
116  virtual TaQLNodeResult visitCopyColNode (const TaQLCopyColNodeRep& node) = 0;
117  virtual TaQLNodeResult visitDropTabNode (const TaQLDropTabNodeRep& node) = 0;
118  // </group>
119 
120 protected:
121  // A convenience function to visit the given node using this visitor.
123  { return node.visit (*this); }
124 };
125 
126 } //# NAMESPACE CASACORE - END
127 
128 #endif
virtual TaQLNodeResult visitLimitOffNode(const TaQLLimitOffNodeRep &node)=0
Raw TaQL parse tree node defining a count command.
Definition: TaQLNodeDer.h:835
virtual TaQLNodeResult visitSortKeyNode(const TaQLSortKeyNodeRep &node)=0
virtual TaQLNodeResult visitRecFldNode(const TaQLRecFldNodeRep &node)=0
Raw TaQL parse tree node defining an alter table add rows command.
Definition: TaQLNodeDer.h:1250
Raw TaQL parse tree node defining a select command.
Definition: TaQLNodeDer.h:788
Raw TaQL parse tree node defining an update command.
Definition: TaQLNodeDer.h:868
virtual TaQLNodeResult visitIndexNode(const TaQLIndexNodeRep &node)=0
virtual TaQLNodeResult visitAltTabNode(const TaQLAltTabNodeRep &node)=0
virtual TaQLNodeResult visitRenDropNode(const TaQLRenDropNodeRep &node)=0
virtual TaQLNodeResult visitColNode(const TaQLColNodeRep &node)=0
virtual TaQLNodeResult visitDeleteNode(const TaQLDeleteNodeRep &node)=0
virtual TaQLNodeResult visitAddRowNode(const TaQLAddRowNodeRep &node)=0
Raw TaQL parse tree node defining a range.
Definition: TaQLNodeDer.h:324
virtual TaQLNodeResult visitInsertNode(const TaQLInsertNodeRep &node)=0
Raw TaQL parse tree node defining an alter table set keyword command.
Definition: TaQLNodeDer.h:1223
virtual TaQLNodeResult visitCopyColNode(const TaQLCopyColNodeRep &node)=0
Raw TaQL parse tree node defining a constant value.
Definition: TaQLNodeDer.h:61
Raw TaQL parse tree node defining a create table command.
Definition: TaQLNodeDer.h:1007
virtual TaQLNodeResult visitMultiNode(const TaQLMultiNodeRep &node)=0
Raw TaQL parse tree node defining an index in a array.
Definition: TaQLNodeDer.h:358
Raw TaQL parse tree node defining a calc command.
Definition: TaQLNodeDer.h:973
virtual TaQLNodeResult visitAddColNode(const TaQLAddColNodeRep &node)=0
Raw TaQL parse tree node defining a list of nodes.
Definition: TaQLNodeDer.h:247
virtual TaQLNodeResult visitBinaryNode(const TaQLBinaryNodeRep &node)=0
virtual TaQLNodeResult visitGivingNode(const TaQLGivingNodeRep &node)=0
virtual TaQLNodeResult visitRangeNode(const TaQLRangeNodeRep &node)=0
TaQLNodeResult visitNode(const TaQLNode &node)
A convenience function to visit the given node using this visitor.
virtual TaQLNodeResult visitUnaryNode(const TaQLUnaryNodeRep &node)=0
Raw TaQL parse tree node defining a delete command.
Definition: TaQLNodeDer.h:940
virtual TaQLNodeResult visitShowNode(const TaQLShowNodeRep &node)=0
Raw TaQL parse tree node defining a table.
Definition: TaQLNodeDer.h:448
Raw TaQL parse tree node defining an alter table copy column command.
Definition: TaQLNodeDer.h:1335
Raw TaQL parse tree node defining a groupby list.
Definition: TaQLNodeDer.h:541
Raw TaQL parse tree node defining a giving expression list.
Definition: TaQLNodeDer.h:668
Raw TaQL parse tree node defining a unary operator.
Definition: TaQLNodeDer.h:154
Raw TaQL parse tree node defining a constant regex value.
Definition: TaQLNodeDer.h:118
Raw TaQL parse tree node defining a record field.
Definition: TaQLNodeDer.h:1074
virtual TaQLNodeResult visitConstNode(const TaQLConstNodeRep &node)=0
Define the functions to visit each node type.
Raw TaQL parse tree node defining an alter table command.
Definition: TaQLNodeDer.h:1277
Raw TaQL parse tree node defining a keyword or column name.
Definition: TaQLNodeDer.h:418
virtual TaQLNodeResult visitUnitNode(const TaQLUnitNodeRep &node)=0
Raw TaQL parse tree node defining a function.
Definition: TaQLNodeDer.h:294
virtual TaQLNodeResult visitCountNode(const TaQLCountNodeRep &node)=0
virtual TaQLNodeResult visitConcTabNode(const TaQLConcTabNodeRep &node)=0
Raw TaQL parse tree node defining an alter table rename or drop command.
Definition: TaQLNodeDer.h:1195
Raw TaQL parse tree node defining a create column specification.
Definition: TaQLNodeDer.h:1043
virtual TaQLNodeResult visitUpdExprNode(const TaQLUpdExprNodeRep &node)=0
Raw TaQL parse tree node defining a unit.
Definition: TaQLNodeDer.h:1108
Raw TaQL parse tree node defining a column update expression.
Definition: TaQLNodeDer.h:701
virtual TaQLNodeResult visitFuncNode(const TaQLFuncNodeRep &node)=0
virtual TaQLNodeResult visitCreTabNode(const TaQLCreTabNodeRep &node)=0
virtual TaQLNodeResult visitDropTabNode(const TaQLDropTabNodeRep &node)=0
virtual TaQLNodeResult visitRegexNode(const TaQLRegexNodeRep &node)=0
Raw TaQL parse tree node defining a DROP TABLE command.
Definition: TaQLNodeDer.h:1363
virtual TaQLNodeResult visitSelectNode(const TaQLSelectNodeRep &node)=0
Envelope class to hold the result of a visit to the node tree.
Raw TaQL parse tree node defining a limit/offset expression.
Definition: TaQLNodeDer.h:639
virtual TaQLNodeResult visitSortNode(const TaQLSortNodeRep &node)=0
Raw TaQL parse tree node defining a sort key.
Definition: TaQLNodeDer.h:573
Raw TaQL parse tree node defining a sort list.
Definition: TaQLNodeDer.h:606
virtual TaQLNodeResult visitJoinNode(const TaQLJoinNodeRep &node)=0
Raw TaQL parse tree node defining an alter table add column command.
Definition: TaQLNodeDer.h:1167
virtual TaQLNodeResult visitSetKeyNode(const TaQLSetKeyNodeRep &node)=0
virtual TaQLNodeResult visitGroupNode(const TaQLGroupNodeRep &node)=0
Raw TaQL parse tree node defining a select column expression.
Definition: TaQLNodeDer.h:480
Raw TaQL parse tree node defining a show command.
Definition: TaQLNodeDer.h:1308
Raw TaQL parse tree node defining a select column list.
Definition: TaQLNodeDer.h:512
Raw TaQL parse tree node defining a join operation.
Definition: TaQLNodeDer.h:389
Envelope class for a node in the raw TaQL parse tree.
Definition: TaQLNode.h:83
Class to visit the nodes in the raw TaQL parse tree.
virtual TaQLNodeResult visitTableNode(const TaQLTableNodeRep &node)=0
virtual TaQLNodeResult visitColSpecNode(const TaQLColSpecNodeRep &node)=0
TaQLNodeResult visit(TaQLNodeVisitor &visitor) const
Let the visitor visit the node.
Definition: TaQLNode.h:133
virtual TaQLNodeResult visitCalcNode(const TaQLCalcNodeRep &node)=0
virtual TaQLNodeResult visitUpdateNode(const TaQLUpdateNodeRep &node)=0
Raw TaQL parse tree node defining a binary operator.
Definition: TaQLNodeDer.h:191
Raw TaQL parse tree node defining an alter table command.
Definition: TaQLNodeDer.h:1136
virtual TaQLNodeResult visitColumnsNode(const TaQLColumnsNodeRep &node)=0
Raw TaQL parse tree node defining an insert command.
Definition: TaQLNodeDer.h:905
virtual TaQLNodeResult visitKeyColNode(const TaQLKeyColNodeRep &node)=0