casacore
ExprNodeRecord.h
Go to the documentation of this file.
1 //# ExprNodeRecord.h: Nodes representing fields in record select expression tree
2 //# Copyright (C) 2000
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_EXPRNODERECORD_H
29 #define TABLES_EXPRNODERECORD_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/tables/TaQL/ExprNodeRep.h>
34 #include <casacore/tables/TaQL/ExprNodeArray.h>
35 #include <casacore/casa/Containers/Block.h>
36 #include <casacore/casa/Utilities/DataType.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class RecordDesc;
42 class RecordInterface;
43 
44 
45 //# This file defines classes derived from TableExprNode representing
46 //# fields in a record select expression.
47 //#
48 //# Data types Bool, Double, DComplex and String are used.
49 //# Char, uChar, Short, uShort, Int, uInt and float are converted
50 //# to Double, and Complex to DComplex.
51 //# Binary operators +, -, *, /, ==, >=, >, <, <= and != are recognized.
52 //# Also &&, ||, parentheses and unary +, - and ! are recognized.
53 
54 
55 
56 // <summary>
57 // Scalar field in record select expression tree
58 // </summary>
59 
60 // <use visibility=local>
61 
62 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
63 // </reviewed>
64 //
65 // <prerequisite>
66 //# Classes you should understand before using this one.
67 // <li> TableExprNode
68 // </prerequisite>
69 
70 // <synopsis>
71 // This class represents a scalar column in a table select expression tree.
72 // When the select expression gets evaluated, the value of the
73 // given row in the column is used.
74 // </synopsis>
75 
76 
78 {
79 public:
80  TableExprNodeRecordField (DataType dtype,
81  const Block<Int>& fieldNumbers);
83 
84  virtual const IPosition& getShape (const TableExprId& id);
85  virtual Bool isDefined (const TableExprId& id);
86 
87  virtual Bool getBool (const TableExprId& id);
88  virtual Int64 getInt (const TableExprId& id);
89  virtual Double getDouble (const TableExprId& id);
90  virtual DComplex getDComplex (const TableExprId& id);
91  virtual String getString (const TableExprId& id);
92 
93 protected:
96 
97  // Get the record for the last field number, thus going through
98  // all subrecords for the other field numbers.
99  const RecordInterface& getRecord (const TableExprId& id) const;
100 };
101 
102 
103 
104 // <summary>
105 // Array field in record select expression tree
106 // </summary>
107 
108 // <use visibility=local>
109 
110 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
111 // </reviewed>
112 //
113 // <prerequisite>
114 //# Classes you should understand before using this one.
115 // <li> TableExprNode
116 // </prerequisite>
117 
118 // <synopsis>
119 // This class represents a scalar column in a table select expression tree.
120 // When the select expression gets evaluated, the value of the
121 // given row in the column is used.
122 // </synopsis>
123 
124 
126 {
127 public:
128  TableExprNodeRecordFieldArray (DataType dtype,
129  const Block<Int>& fieldNumbers);
131 
132  virtual Bool isDefined (const TableExprId& id);
133  virtual const IPosition& getShape (const TableExprId& id);
134 
135  virtual Array<Bool> getArrayBool (const TableExprId& id);
136  virtual Array<Int64> getArrayInt (const TableExprId& id);
137  virtual Array<Double> getArrayDouble (const TableExprId& id);
138  virtual Array<DComplex> getArrayDComplex (const TableExprId& id);
139  virtual Array<String> getArrayString (const TableExprId& id);
140 
141 protected:
144 
145  // Get the record for the last field number, thus going through
146  // all subrecords for the other field numbers.
147  const RecordInterface& getRecord (const TableExprId& id) const;
148 };
149 
150 
151 
152 
153 } //# NAMESPACE CASACORE - END
154 
155 #endif
A Vector of integers, for indexing into Array<T> objects.
Definition: IPosition.h:119
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
virtual Array< String > getArrayString(const TableExprId &id)
virtual DComplex getDComplex(const TableExprId &id)
Base class for arrays in table select expression.
Definition: ExprNodeArray.h:66
Scalar field in record select expression tree.
virtual Array< Double > getArrayDouble(const TableExprId &id)
Array field in record select expression tree.
virtual Bool isDefined(const TableExprId &id)
Is the value in the given row defined? The default implementation returns True.
const RecordInterface & getRecord(const TableExprId &id) const
Get the record for the last field number, thus going through all subrecords for the other field numbe...
double Double
Definition: aipstype.h:52
virtual const IPosition & getShape(const TableExprId &id)
Get the shape for the given row.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:39
virtual Bool getBool(const TableExprId &id)
Get a scalar value for this node in the given row.
virtual Int64 getInt(const TableExprId &id)
virtual Double getDouble(const TableExprId &id)
TableExprNodeRecordField(DataType dtype, const Block< Int > &fieldNumbers)
virtual Array< Int64 > getArrayInt(const TableExprId &id)
The identification of a TaQL selection subject.
Definition: TableExprId.h:98
virtual Array< DComplex > getArrayDComplex(const TableExprId &id)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Abstract base class for Record classes.
virtual String getString(const TableExprId &id)
Abstract base class for a node having 0, 1, or 2 child nodes.
Definition: ExprNodeRep.h:549
this file contains all the compiler specific defines
Definition: mainpage.dox:28
unsigned int uInt
Definition: aipstype.h:48
virtual Array< Bool > getArrayBool(const TableExprId &id)
Get an array value for this node in the given row.