casacore
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: 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_EXPRUDFNODE_H
29#define TABLES_EXPRUDFNODE_H
30
31//# Includes
32#include <casacore/casa/aips.h>
33#include <casacore/tables/TaQL/ExprNodeRep.h>
34#include <casacore/tables/TaQL/UDFBase.h>
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38 //# Forward Declarations
39 class TableExprNodeSet;
40
41 // <summary>
42 // Class representing a scalar 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
81 const TableExprNodeSet& source);
82
83 // Destructor
85
86 // Is the UDF an aggregate function?
88 { return itsUDF->isAggregate(); }
89
90 // Get the nodes representing an aggregate function.
91 virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
92
93 // Get the nodes representing a table column.
94 virtual void getColumnNodes (std::vector<TableExprNodeRep* >& cols);
95
96 // Do not apply the selection.
97 virtual void disableApplySelection();
98
99 // If needed, let the UDF re-create column objects for a selection of rows.
100 // It calls the function recreateColumnObjects.
101 virtual void applySelection (const Vector<rownr_t>& rownrs);
102
103 // UDFs do not need a TableExprGroupFuncBase,
104 // so TableExprGroupNull is returned.
106
107 // Functions to get the desired result of a function
108 // <group>
109 virtual Bool getBool (const TableExprId& id);
110 virtual Int64 getInt (const TableExprId& id);
111 virtual Double getDouble (const TableExprId& id);
112 virtual DComplex getDComplex (const TableExprId& id);
113 virtual String getString (const TableExprId& id);
114 virtual TaqlRegex getRegex (const TableExprId& id);
115 virtual MVTime getDate (const TableExprId& id);
116 // </group>
117
118 private:
120 };
121
122
123} //# NAMESPACE CASACORE - END
124
125#endif
Referenced counted pointer for constant data.
Definition: CountedPtr.h:81
String: the storage and methods of handling collections of characters.
Definition: String.h:225
Abstract base class for a node having multiple child nodes.
Definition: ExprNodeRep.h:661
Class to hold multiple table expression nodes.
Definition: ExprNodeSet.h:311
virtual Bool getBool(const TableExprId &id)
Functions to get the desired result of a function.
virtual MVTime getDate(const TableExprId &id)
virtual DComplex getDComplex(const TableExprId &id)
virtual String getString(const TableExprId &id)
CountedPtr< TableExprGroupFuncBase > makeGroupAggrFunc()
UDFs do not need a TableExprGroupFuncBase, so TableExprGroupNull is returned.
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
Bool isAggregate() const
Is the UDF an aggregate function?
Definition: ExprUDFNode.h:87
virtual void applySelection(const Vector< rownr_t > &rownrs)
If needed, let the UDF re-create column objects for a selection of rows.
virtual Int64 getInt(const TableExprId &id)
virtual TaqlRegex getRegex(const TableExprId &id)
virtual ~TableExprUDFNode()
Destructor.
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
virtual Double getDouble(const TableExprId &id)
TableExprUDFNode(UDFBase *udf, const Table &, const TableExprNodeSet &source)
Constructor.
virtual void disableApplySelection()
Do not apply the selection.
Bool isAggregate() const
Tell if the UDF is an aggregate function.
Definition: UDFBase.h:355
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:38
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
double Double
Definition: aipstype.h:55