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 public:
76// Define the various derived types (to be stored with AipsIO).
77// # They are easier to use than an enum.
78// # Do not change these definitions, since these values are stored in files.
79// <group>
80#define TaQLNode_Null char(0)
81#define TaQLNode_Const char(1)
82#define TaQLNode_Unary char(2)
83#define TaQLNode_Binary char(3)
84#define TaQLNode_Multi char(4)
85#define TaQLNode_Func char(5)
86#define TaQLNode_Range char(6)
87#define TaQLNode_Index char(7)
88#define TaQLNode_KeyCol char(8)
89#define TaQLNode_Table char(9)
90#define TaQLNode_Col char(10)
91#define TaQLNode_Columns char(11)
92#define TaQLNode_Join char(12)
93#define TaQLNode_SortKey char(13)
94#define TaQLNode_Sort char(14)
95#define TaQLNode_LimitOff char(15)
96#define TaQLNode_Giving char(16)
97#define TaQLNode_UpdExpr char(17)
98#define TaQLNode_Select char(18)
99#define TaQLNode_Update char(19)
100#define TaQLNode_Insert char(20)
101#define TaQLNode_Delete char(21)
102#define TaQLNode_Calc char(22)
103#define TaQLNode_CreTab char(23)
104#define TaQLNode_ColSpec char(24)
105#define TaQLNode_RecFld char(25)
106#define TaQLNode_Unit char(26)
107#define TaQLNode_Regex char(27)
108#define TaQLNode_Count char(28)
109#define TaQLNode_Groupby char(29)
110#define TaQLNode_AltTab char(30)
111#define TaQLNode_AddCol char(31)
112#define TaQLNode_SetKey char(32)
113#define TaQLNode_RenDrop char(33)
114#define TaQLNode_AddRow char(34)
115#define TaQLNode_ConcTab char(35)
116#define TaQLNode_Show char(36)
117#define TaQLNode_CopyCol char(37)
118#define TaQLNode_DropTab char(38)
119 // </group>
120
121 // Constructor for derived classes specifying the type.
122 explicit TaQLNodeRep(int nodeType);
123
124 virtual ~TaQLNodeRep();
125
126 // Letter objects cannot be copied.
127 // <group>
128 TaQLNodeRep(const TaQLNodeRep&) = delete;
130 // </group>
131
132 // Get the node type of the derived class.
133 char nodeType() const { return itsNodeType; }
134
135 // Get the TaQL style.
136 const TaQLStyle& style() const { return itsStyle; }
137
138 // Visit a node for tree traversal.
140
141 // Print the object in an ostream.
142 virtual void show(std::ostream& os) const = 0;
143
144 // Save the object.
145 virtual void save(AipsIO& aio) const = 0;
146
147 // Check the data type string and return its standard form.
149
150 // Add escape characters to a table name where needed.
151 String addEscape(const String& str) const;
152
153 private:
156};
157
158} // namespace casacore
159
160#endif
String: the storage and methods of handling collections of characters.
Definition String.h:355
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.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28