casacore
ExprConeNode.h
Go to the documentation of this file.
1 //# ExprConeNode.h: Class representing a cone search in table select expression
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_EXPRCONENODE_H
29 #define TABLES_EXPRCONENODE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/tables/TaQL/ExprFuncNode.h>
34 #include <casacore/tables/TaQL/ExprFuncNodeArray.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 
39 // <summary>
40 // Class representing a cone search in table select expression
41 // </summary>
42 
43 // <use visibility=local>
44 
45 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
46 // </reviewed>
47 // <prerequisite>
48 //# Classes you should understand before using this one.
49 // <li> <linkto class=TableExprFuncNode>TableExprFuncNode</linkto>
50 // </prerequisite>
51 
52 // <synopsis>
53 // The class represents a cone search.
54 // It is a specialization of the TableExprFuncNode class.
55 // Currently the implementation is straightforward, but in the future
56 // it can do smarter things.
57 // For instance:
58 // <ul>
59 // <li> If the cone positions and radii are constant, one can use
60 // an integer zone number (e.g. floor(dec)) to avoid the much
61 // more expensive sine/cosine calculations. Each cone will get a
62 // minzone and maxzone value (derived from cone position and radius).
63 // <li> Multiple cones can be ordered on minzone and maxzone.
64 // </ul>
65 // </synopsis>
66 
67 
69 {
70 public:
71  // Constructor
73  const TableExprNodeSet& source, uInt origin);
74 
75  // Destructor
77 
78  // 'get' Functions to get the desired result of a function.
79  // <group>
80  Bool getBool (const TableExprId& id);
81  Int64 getInt (const TableExprId& id);
82  // </group>
83 
84  // Check the data and value types of the operands.
85  // It sets the exptected data and value types of the operands.
86  // Set the value type of the function result and returns
87  // the data type of the function result.
88  static NodeDataType checkOperands (Block<Int>& dtypeOper,
89  ValueType& resVT,
90  Block<Int>& vtypeOper,
93 
94  // Link the children to the node and convert the children
95  // to constants if possible. Also convert the node to
96  // constant if possible.
97  static TableExprNodeRep* fillNode (TableExprConeNode* thisNode,
99  const Block<Int>& dtypeOper);
100 
101  // Link the children to the node and convert the children
102  // to constants if possible.
103  static void fillChildNodes (TableExprConeNode* thisNode,
105  const Block<Int>& dtypeOper);
106 
107 private:
108  // Try if the function gives a constant result.
109  // If so, set the expression type to Constant.
110  void tryToConst();
111 
112  // Find the number of elements in an argument.
113  // It returns -1 if unknown.
114  static Int findNelem (const TableExprNodeRep* node);
115 
116 
118 };
119 
120 
121 
122 
124 {
125 public:
126  // Constructor
128  const TableExprNodeSet& source, uInt origin);
129 
130  // Destructor
132 
133  // 'get' Functions to get the desired result of a function.
134  // <group>
137  // </group>
138 
139  // Link the children to the node and convert the children
140  // to constants if possible. Also convert the node to
141  // constant if possible.
144  const Block<Int>& dtypeOper);
145 
146  // Link the children to the node and convert the children
147  // to constants if possible.
148  static void fillChildNodes (TableExprConeNodeArray* thisNode,
150  const Block<Int>& dtypeOper);
151 
152 private:
153  // Try if the function gives a constant result.
154  // If so, set the expression type to Constant.
155  void tryToConst();
156 
157 
159 };
160 
161 
162 } //# NAMESPACE CASACORE - END
163 
164 #endif
Class representing a function in table select expression.
Definition: ExprFuncNode.h:76
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
int Int
Definition: aipstype.h:47
Class representing an array function in table select expression.
static Int findNelem(const TableExprNodeRep *node)
Find the number of elements in an argument.
Class to hold multiple table expression nodes.
Definition: ExprNodeSet.h:305
Bool getBool(const TableExprId &id)
&#39;get&#39; Functions to get the desired result of a function.
NodeDataType
Define the data types of a node.
Definition: ExprNodeRep.h:154
Abstract base class for a node in a table column expression tree.
Definition: ExprNodeRep.h:150
TableExprConeNode(FunctionType, NodeDataType, const TableExprNodeSet &source, uInt origin)
Constructor.
void tryToConst()
Try if the function gives a constant result.
Class representing a cone search in table select expression.
Definition: ExprConeNode.h:68
~TableExprConeNode()
Destructor.
static void fillChildNodes(TableExprConeNode *thisNode, PtrBlock< TableExprNodeRep *> &nodes, const Block< Int > &dtypeOper)
Link the children to the node and convert the children to constants if possible.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:39
ValueType
Define the value types.
Definition: ExprNodeRep.h:169
A drop-in replacement for Block<T*>.
Definition: Block.h:861
Int64 getInt(const TableExprId &id)
virtual Array< Int64 > getArrayInt(const TableExprId &id)
The identification of a TaQL selection subject.
Definition: TableExprId.h:98
static NodeDataType checkOperands(Block< Int > &dtypeOper, ValueType &resVT, Block< Int > &vtypeOper, FunctionType, PtrBlock< TableExprNodeRep *> &)
Check the data and value types of the operands.
static TableExprNodeRep * fillNode(TableExprConeNode *thisNode, PtrBlock< TableExprNodeRep *> &nodes, const Block< Int > &dtypeOper)
Link the children to the node and convert the children to constants if possible.
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.