casacore
Loading...
Searching...
No Matches
ExprUDFNode.h
Go to the documentation of this file.
1//# ExprUDFNode.h: Class representing a scalar UDF in select expression
2//# Copyright (C) 2010
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_EXPRUDFNODE_H
27#define TABLES_EXPRUDFNODE_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/TaQL/ExprNodeRep.h>
32#include <casacore/tables/TaQL/UDFBase.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36 //# Forward Declarations
37 class TableExprNodeSet;
38
39 // <summary>
40 // Class representing a scalar UDF in 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=TableExprNodeMulti>TableExprNodeMulti</linkto>
50 // </prerequisite>
51
52 // <synopsis>
53 // This class represents a function in a table select tree.
54 // The <src>rownumber</src> function is represented by class
55 // <linkto class=TableExprNodeRownr>TableExprNodeRownr</linkto>.
56 // The <src>rowid</src> function is represented by class
57 // <linkto class=TableExprNodeRowid>TableExprNodeRowid</linkto>.
58 // The <src>rand</src> function is represented by class
59 // <linkto class=TableExprNodeRandom>TableExprNodeRandom</linkto>.
60 // <p>
61 // When one wants to add a function to the table selection grammar,
62 // the following has to be done:
63 // <ul>
64 // <li> Add the function to the enum below.
65 // <li> Implement the function in the get functions in ExprFuncNode(Array).cc.
66 // <li> Implement the function in the checkOperands in ExprFuncNode.cc.
67 // <li> Declare and define the function in ExprNode.h (for C++ binding).
68 // <li> Add the function to findFunc in TableParse.cc (for TaQL).
69 // </ul>
70 // </synopsis>
71
72
74 {
75 public:
76
77 // Constructor
78 TableExprUDFNode (const std::shared_ptr<UDFBase>& udf,
79 const TableExprInfo&,
80 const TableExprNodeSet& source);
81
82 // Destructor
83 ~TableExprUDFNode() override = default;
84
85 // Is the UDF an aggregate function?
86 Bool isAggregate() const override
87 { return itsUDF->isAggregate(); }
88
89 // Get the table info.
90 TableExprInfo getTableInfo() const override;
91
92 // Flatten the node tree by adding the node and its children to the vector.
93 void flattenTree (std::vector<TableExprNodeRep*>&) override;
94
95 // Do not apply the selection.
96 void disableApplySelection() override;
97
98 // If needed, let the UDF re-create column objects for a selection of rows.
99 // It calls the function recreateColumnObjects.
100 void applySelection (const Vector<rownr_t>& rownrs) override;
101
102 // UDFs do not need a TableExprGroupFuncBase,
103 // so TableExprGroupNull is returned.
104 std::shared_ptr<TableExprGroupFuncBase> makeGroupAggrFunc() override;
105
106 // Functions to get the desired result of a function
107 // <group>
108 Bool getBool (const TableExprId& id) override;
109 Int64 getInt (const TableExprId& id) override;
110 Double getDouble (const TableExprId& id) override;
111 DComplex getDComplex (const TableExprId& id) override;
112 String getString (const TableExprId& id) override;
113 TaqlRegex getRegex (const TableExprId& id) override;
114 MVTime getDate (const TableExprId& id) override;
115 // </group>
116
117 private:
119 std::shared_ptr<UDFBase> itsUDF;
120 };
121
122
123} //# NAMESPACE CASACORE - END
124
125#endif
String: the storage and methods of handling collections of characters.
Definition String.h:223
Class to connect a Table and its alias name.
Abstract base class for a node having multiple child nodes.
TableExprUDFNode(const std::shared_ptr< UDFBase > &udf, const TableExprInfo &, const TableExprNodeSet &source)
Constructor.
MVTime getDate(const TableExprId &id) override
Double getDouble(const TableExprId &id) override
DComplex getDComplex(const TableExprId &id) override
std::shared_ptr< UDFBase > itsUDF
TaqlRegex getRegex(const TableExprId &id) override
void disableApplySelection() override
Do not apply the selection.
std::shared_ptr< TableExprGroupFuncBase > makeGroupAggrFunc() override
UDFs do not need a TableExprGroupFuncBase, so TableExprGroupNull is returned.
void flattenTree(std::vector< TableExprNodeRep * > &) override
Flatten the node tree by adding the node and its children to the vector.
~TableExprUDFNode() override=default
Destructor.
TableExprInfo getTableInfo() const override
Get the table info.
Bool getBool(const TableExprId &id) override
Functions to get the desired result of a function.
void applySelection(const Vector< rownr_t > &rownrs) override
If needed, let the UDF re-create column objects for a selection of rows.
String getString(const TableExprId &id) override
Bool isAggregate() const override
Is the UDF an aggregate function?
Definition ExprUDFNode.h:86
Int64 getInt(const TableExprId &id) override
this file contains all the compiler specific defines
Definition mainpage.dox:28
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition aipsxtype.h:36
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53