casacore
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: 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: ExprUDFNodeArray.h 21262 2012-09-07 12:38:36Z gervandiepen $
27 
28 #ifndef TABLES_EXPRUDFNODEARRAY_H
29 #define TABLES_EXPRUDFNODEARRAY_H
30 
31 //# Includes
32 #include <casacore/tables/TaQL/ExprNodeArray.h>
33 #include <casacore/tables/TaQL/UDFBase.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37  //# Forward Declarations
38  class TableExprNodeSet;
39 
40  // <summary>
41  // Class representing an array UDF in select expression
42  // </summary>
43 
44  // <use visibility=local>
45 
46  // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
47  // </reviewed>
48  // <prerequisite>
49  //# Classes you should understand before using this one.
50  // <li> <linkto class=TableExprNodeMulti>TableExprNodeMulti</linkto>
51  // </prerequisite>
52 
53  // <synopsis>
54  // This class represents a function in a table select tree.
55  // The <src>rownumber</src> function is represented by class
56  // <linkto class=TableExprNodeRownr>TableExprNodeRownr</linkto>.
57  // The <src>rowid</src> function is represented by class
58  // <linkto class=TableExprNodeRowid>TableExprNodeRowid</linkto>.
59  // The <src>rand</src> function is represented by class
60  // <linkto class=TableExprNodeRandom>TableExprNodeRandom</linkto>.
61  // <p>
62  // When one wants to add a function to the table selection grammar,
63  // the following has to be done:
64  // <ul>
65  // <li> Add the function to the enum below.
66  // <li> Implement the function in the get functions in ExprFuncNode(Array).cc.
67  // <li> Implement the function in the checkOperands in ExprFuncNode.cc.
68  // <li> Declare and define the function in ExprNode.h (for C++ binding).
69  // <li> Add the function to findFunc in TableParse.cc (for TaQL).
70  // </ul>
71  // </synopsis>
72 
73 
75  {
76  public:
77 
78  // Constructor
80  const TableExprNodeSet& source);
81 
82  // Destructor
84 
85  // Get the nodes representing an aggregate function.
86  virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
87 
88  // Get the nodes representing a table column.
89  virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
90 
91  // Do not apply the selection.
92  virtual void disableApplySelection();
93 
94  // If needed, let the UDF re-create column objects for a selection of rows.
95  // It calls the function recreateColumnObjects.
96  virtual void applySelection (const Vector<rownr_t>& rownrs);
97 
98  // UDFs do not need a TableExprGroupFuncBase, so null is returned.
100 
101  // Functions to get the desired result of a function
102  // <group>
103  virtual MArray<Bool> getArrayBool (const TableExprId& id);
104  virtual MArray<Int64> getArrayInt (const TableExprId& id);
109  // </group>
110 
111  private:
113  };
114 
115 
116 } //# NAMESPACE CASACORE - END
117 
118 #endif
Referenced counted pointer for constant data.
Definition: CountedPtr.h:81
Class to hold multiple table expression nodes.
Definition: ExprNodeSet.h:311
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
virtual MArray< Double > getArrayDouble(const TableExprId &id)
The default implementation of getArrayDouble does getArrayInt and converts the result.
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
TableExprUDFNodeArray(UDFBase *udf, const Table &, const TableExprNodeSet &source)
Constructor.
virtual MArray< String > getArrayString(const TableExprId &id)
virtual ~TableExprUDFNodeArray()
Destructor.
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Functions to get the desired result of a function.
CountedPtr< TableExprGroupFuncBase > makeGroupAggrFunc()
UDFs do not need a TableExprGroupFuncBase, so null is returned.
virtual void disableApplySelection()
Do not apply the selection.
virtual void applySelection(const Vector< rownr_t > &rownrs)
If needed, let the UDF re-create column objects for a selection of rows.
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
The default implementation of getArrayDComplex does getArrayDouble and converts the result.
this file contains all the compiler specific defines
Definition: mainpage.dox:28