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