casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: ExprNodeRecord.h 21262 2012-09-07 12:38:36Z gervandiepen $
27 
28 #ifndef TABLES_EXPRNODERECORD_H
29 #define TABLES_EXPRNODERECORD_H
30 
31 //# Includes
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 //# Forward Declarations
40 class RecordDesc;
41 class RecordInterface;
42 
43 
44 //# This file defines classes derived from TableExprNode representing
45 //# fields in a record select expression.
46 //#
47 //# Data types Bool, Double, DComplex and String are used.
48 //# Char, uChar, Short, uShort, Int and uInt are converted to Int64,
49 //# float to Double, and Complex to DComplex.
50 //# Binary operators +, -, *, /, ==, >=, >, <, <= and != are recognized.
51 //# Also &&, ||, parentheses and unary +, - and ! are recognized.
52 
53 
54 
55 // <summary>
56 // Scalar field in record select expression tree
57 // </summary>
58 
59 // <use visibility=local>
60 
61 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
62 // </reviewed>
63 //
64 // <prerequisite>
65 //# Classes you should understand before using this one.
66 // <li> TableExprNode
67 // </prerequisite>
68 
69 // <synopsis>
70 // This class represents a scalar column in a table select expression tree.
71 // When the select expression gets evaluated, the value of the
72 // given row in the column is used.
73 // </synopsis>
74 
75 
77 {
78 public:
79  TableExprNodeRecordField (DataType dtype,
80  const Block<Int>& fieldNumbers);
82 
83  virtual const IPosition& getShape (const TableExprId& id);
84  virtual Bool isDefined (const TableExprId& id);
85 
86  virtual Bool getBool (const TableExprId& id);
87  virtual Int64 getInt (const TableExprId& id);
88  virtual Double getDouble (const TableExprId& id);
89  virtual DComplex getDComplex (const TableExprId& id);
90  virtual String getString (const TableExprId& id);
91 
92 protected:
95 
96  // Get the record for the last field number, thus going through
97  // all subrecords for the other field numbers.
98  const RecordInterface& getRecord (const TableExprId& id) const;
99 };
100 
101 
102 
103 // <summary>
104 // Array field in record select expression tree
105 // </summary>
106 
107 // <use visibility=local>
108 
109 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
110 // </reviewed>
111 //
112 // <prerequisite>
113 //# Classes you should understand before using this one.
114 // <li> TableExprNode
115 // </prerequisite>
116 
117 // <synopsis>
118 // This class represents a scalar column in a table select expression tree.
119 // When the select expression gets evaluated, the value of the
120 // given row in the column is used.
121 // </synopsis>
122 
123 
125 {
126 public:
127  TableExprNodeRecordFieldArray (DataType dtype,
128  const Block<Int>& fieldNumbers);
130 
131  virtual Bool isDefined (const TableExprId& id);
132  virtual const IPosition& getShape (const TableExprId& id);
133 
134  virtual MArray<Bool> getArrayBool (const TableExprId& id);
135  virtual MArray<Int64> getArrayInt (const TableExprId& id);
136  virtual MArray<Double> getArrayDouble (const TableExprId& id);
137  virtual MArray<DComplex> getArrayDComplex (const TableExprId& id);
138  virtual MArray<String> getArrayString (const TableExprId& id);
139 
140 protected:
143 
144  // Get the record for the last field number, thus going through
145  // all subrecords for the other field numbers.
146  const RecordInterface& getRecord (const TableExprId& id) const;
147 };
148 
149 
150 
151 
152 } //# NAMESPACE CASACORE - END
153 
154 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Get an array value for this node in the given row.
virtual Bool isDefined(const TableExprId &id)
Is the value in the given row defined? The default implementation returns True.
virtual DComplex getDComplex(const TableExprId &id)
TableExprNodeRecordFieldArray(DataType dtype, const Block< Int > &fieldNumbers)
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
The default implementation of getArrayDComplex does getArrayDouble and converts the result...
Base class for arrays in table select expression.
Definition: ExprNodeArray.h:65
virtual const IPosition & getShape(const TableExprId &id)
Get the shape of the array in the given row.
virtual MArray< String > getArrayString(const TableExprId &id)
Scalar field in record select expression tree.
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.
double Double
Definition: aipstype.h:55
virtual MArray< Double > getArrayDouble(const TableExprId &id)
The default implementation of getArrayDouble does getArrayInt and converts the result.
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:42
virtual Bool getBool(const TableExprId &id)
Get a scalar value for this node in the given row.
virtual Int64 getInt(const TableExprId &id)
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...
virtual Double getDouble(const TableExprId &id)
TableExprNodeRecordField(DataType dtype, const Block< Int > &fieldNumbers)
The identification of a TaQL selection subject.
Definition: TableExprId.h:97
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:558
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...
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42