casacore
Loading...
Searching...
No Matches
ExprUDFNodeArray.h
Go to the documentation of this file.
1// # ExprUDFNodeArray.h: Class representing an array 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_EXPRUDFNODEARRAY_H
27#define TABLES_EXPRUDFNODEARRAY_H
28
29// # Includes
30#include <casacore/tables/TaQL/ExprNodeArray.h>
31#include <casacore/tables/TaQL/UDFBase.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// # Forward Declarations
37
38// <summary>
39// Class representing an array UDF in select expression
40// </summary>
41
42// <use visibility=local>
43
44// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
45// </reviewed>
46// <prerequisite>
47// # Classes you should understand before using this one.
48// <li> <linkto class=TableExprNodeMulti>TableExprNodeMulti</linkto>
49// </prerequisite>
50
51// <synopsis>
52// This class represents a function in a table select tree.
53// The <src>rownumber</src> function is represented by class
54// <linkto class=TableExprNodeRownr>TableExprNodeRownr</linkto>.
55// The <src>rowid</src> function is represented by class
56// <linkto class=TableExprNodeRowid>TableExprNodeRowid</linkto>.
57// The <src>rand</src> function is represented by class
58// <linkto class=TableExprNodeRandom>TableExprNodeRandom</linkto>.
59// <p>
60// When one wants to add a function to the table selection grammar,
61// the following has to be done:
62// <ul>
63// <li> Add the function to the enum below.
64// <li> Implement the function in the get functions in ExprFuncNode(Array).cc.
65// <li> Implement the function in the checkOperands in ExprFuncNode.cc.
66// <li> Declare and define the function in ExprNode.h (for C++ binding).
67// <li> Add the function to findFunc in TableParse.cc (for TaQL).
68// </ul>
69// </synopsis>
70
72 public:
73 // Constructor
74 TableExprUDFNodeArray(const std::shared_ptr<UDFBase>& udf, const TableExprInfo&,
75 const TableExprNodeSet& source);
76
77 // Destructor
78 ~TableExprUDFNodeArray() override = default;
79
80 // Flatten the node tree by adding the node and its children to the vector.
81 void flattenTree(std::vector<TableExprNodeRep*>&) override;
82
83 // Get the table info.
84 TableExprInfo getTableInfo() const override;
85
86 // Do not apply the selection.
87 void disableApplySelection() override;
88
89 // If needed, let the UDF re-create column objects for a selection of rows.
90 // It calls the function recreateColumnObjects.
91 void applySelection(const Vector<rownr_t>& rownrs) override;
92
93 // UDFs do not need a TableExprGroupFuncBase, so null is returned.
94 std::shared_ptr<TableExprGroupFuncBase> makeGroupAggrFunc() override;
95
96 // Functions to get the desired result of a function
97 // <group>
104 // </group>
105
106 private:
108 std::shared_ptr<UDFBase> itsUDF;
109};
110
111} // namespace casacore
112
113#endif
Class to connect a Table and its alias name.
TableExprNodeArray(NodeDataType, OperType)
Create the object.
MArray< Int64 > getArrayInt(const TableExprId &id) override
MArray< String > getArrayString(const TableExprId &id) override
void disableApplySelection() override
Do not apply the selection.
std::shared_ptr< UDFBase > itsUDF
void flattenTree(std::vector< TableExprNodeRep * > &) override
Flatten the node tree by adding the node and its children to the vector.
void applySelection(const Vector< rownr_t > &rownrs) override
If needed, let the UDF re-create column objects for a selection of rows.
MArray< DComplex > getArrayDComplex(const TableExprId &id) override
The default implementation of getArrayDComplex does getArrayDouble and converts the result.
~TableExprUDFNodeArray() override=default
Destructor.
TableExprUDFNodeArray(const std::shared_ptr< UDFBase > &udf, const TableExprInfo &, const TableExprNodeSet &source)
Constructor.
std::shared_ptr< TableExprGroupFuncBase > makeGroupAggrFunc() override
UDFs do not need a TableExprGroupFuncBase, so null is returned.
MArray< Double > getArrayDouble(const TableExprId &id) override
The default implementation of getArrayDouble does getArrayInt and converts the result.
MArray< MVTime > getArrayDate(const TableExprId &id) override
MArray< Bool > getArrayBool(const TableExprId &id) override
Functions to get the desired result of a function.
TableExprInfo getTableInfo() const override
Get the table info.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28