casacore
Loading...
Searching...
No Matches
TaQLNodeRep.h
Go to the documentation of this file.
1//# TaQLNodeRep.h: Representation of a node 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: 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 TABLES_TAQLNODEREP_H
27#define TABLES_TAQLNODEREP_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/TaQL/TaQLNodeResult.h>
32#include <casacore/tables/TaQL/TaQLStyle.h>
33#include <casacore/casa/BasicSL/String.h>
34#include <iosfwd>
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38//# Forward Declaration.
39class AipsIO;
40class TaQLNodeVisitor;
41
42// <summary>
43// Representation of a node in the raw TaQL parse tree.
44// </summary>
45
46// <use visibility=local>
47
48// <reviewed reviewer="" date="" tests="tTaQLNode">
49// </reviewed>
50
51// <prerequisite>
52//# Classes you should understand before using this one.
53// <li> <linkto class=TaQLNode>TaQLNode</linkto>
54// <li> Note 199 describing
55// <a href="../notes/199.html">
56// TaQL</a>
57// </prerequisite>
58
59// <synopsis>
60// TaQLNode/TaQLNodeRep form an envelope/letter pair.
61// TaQLNodeRep is the abstract base class for all classes used in the
62// raw TaQL parse tree
63// (e.g. <linkto class=TaQLConstNodeRep>TaQLConstNodeRep</linkto>).
64// </synopsis>
65
66// <motivation>
67// The envelope/letter idiom (aka counted referencing) is a nice means
68// to pass an object around by value, so to ensure that an object is deleted
69// in case of an exception.
70// Furthermore it makes copying an object very cheap and memory
71// management straightforward.
72// </motivation>
73
75{
76public:
77 // Define the various derived types (to be stored with AipsIO).
78 //# They are easier to use than an enum.
79 //# Do not change these definitions, since these values are stored in files.
80 // <group>
81 #define TaQLNode_Null char(0)
82 #define TaQLNode_Const char(1)
83 #define TaQLNode_Unary char(2)
84 #define TaQLNode_Binary char(3)
85 #define TaQLNode_Multi char(4)
86 #define TaQLNode_Func char(5)
87 #define TaQLNode_Range char(6)
88 #define TaQLNode_Index char(7)
89 #define TaQLNode_KeyCol char(8)
90 #define TaQLNode_Table char(9)
91 #define TaQLNode_Col char(10)
92 #define TaQLNode_Columns char(11)
93 #define TaQLNode_Join char(12)
94 #define TaQLNode_SortKey char(13)
95 #define TaQLNode_Sort char(14)
96 #define TaQLNode_LimitOff char(15)
97 #define TaQLNode_Giving char(16)
98 #define TaQLNode_UpdExpr char(17)
99 #define TaQLNode_Select char(18)
100 #define TaQLNode_Update char(19)
101 #define TaQLNode_Insert char(20)
102 #define TaQLNode_Delete char(21)
103 #define TaQLNode_Calc char(22)
104 #define TaQLNode_CreTab char(23)
105 #define TaQLNode_ColSpec char(24)
106 #define TaQLNode_RecFld char(25)
107 #define TaQLNode_Unit char(26)
108 #define TaQLNode_Regex char(27)
109 #define TaQLNode_Count char(28)
110 #define TaQLNode_Groupby char(29)
111 #define TaQLNode_AltTab char(30)
112 #define TaQLNode_AddCol char(31)
113 #define TaQLNode_SetKey char(32)
114 #define TaQLNode_RenDrop char(33)
115 #define TaQLNode_AddRow char(34)
116 #define TaQLNode_ConcTab char(35)
117 #define TaQLNode_Show char(36)
118 #define TaQLNode_CopyCol char(37)
119 #define TaQLNode_DropTab char(38)
120 // </group>
121
122 // Constructor for derived classes specifying the type.
123 explicit TaQLNodeRep (int nodeType);
124
125 virtual ~TaQLNodeRep();
126
127 // Letter objects cannot be copied.
128 // <group>
129 TaQLNodeRep (const TaQLNodeRep&) = delete;
131 // </group>
132
133 // Get the node type of the derived class.
134 char nodeType() const
135 { return itsNodeType; }
136
137 // Get the TaQL style.
138 const TaQLStyle& style() const
139 { return itsStyle; }
140
141 // Visit a node for tree traversal.
143
144 // Print the object in an ostream.
145 virtual void show (std::ostream& os) const = 0;
146
147 // Save the object.
148 virtual void save (AipsIO& aio) const = 0;
149
150 // Check the data type string and return its standard form.
151 static String checkDataType (const String&);
152
153 // Add escape characters to a table name where needed.
154 String addEscape (const String& str) const;
155
156private:
159};
160
161
162} //# NAMESPACE CASACORE - END
163
164#endif
String: the storage and methods of handling collections of characters.
Definition String.h:223
virtual TaQLNodeResult visit(TaQLNodeVisitor &) const =0
Visit a node for tree traversal.
TaQLNodeRep & operator=(const TaQLNodeRep &)=delete
virtual void show(std::ostream &os) const =0
Print the object in an ostream.
TaQLNodeRep(int nodeType)
Constructor for derived classes specifying the type.
TaQLNodeRep(const TaQLNodeRep &)=delete
Letter objects cannot be copied.
char nodeType() const
Get the node type of the derived class.
static String checkDataType(const String &)
Check the data type string and return its standard form.
virtual void save(AipsIO &aio) const =0
Save the object.
const TaQLStyle & style() const
Get the TaQL style.
String addEscape(const String &str) const
Add escape characters to a table name where needed.
Envelope class to hold the result of a visit to the node tree.
this file contains all the compiler specific defines
Definition mainpage.dox:28