casacore
ExprAggrNodeArray.h
Go to the documentation of this file.
1 //# ExprAggrNodeArray.h: TaQL node representing an array aggregate function
2 //# Copyright (C) 2013
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: TaQLNode.h 21051 2011-04-20 11:46:29Z gervandiepen $
27 
28 #ifndef TABLES_EXPRAGGRNODEARRAY_H
29 #define TABLES_EXPRAGGRNODEARRAY_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/tables/TaQL/ExprFuncNodeArray.h>
34 
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38  //# Forward Declarations.
39  class TableExprGroupFuncBase;
40  class TableExprGroupFuncSet;
41 
42 // <summary>
43 // TaQL node representing an array aggregate function
44 // </summary>
45 
46 // <use visibility=local>
47 
48 // <reviewed reviewer="" date="" tests="tTaQLNode">
49 // </reviewed>
50 
51 // <synopsis>
52 // This class is similar to TableExprAggrNode, but its result is an array
53 // instead of a scalar value.
54 // There are few aggregate functions resulting in an array. An example
55 // is <src>gaggr</src>, which aggregates the non-empty arrays in a group
56 // into a single array. Other functions (like medians, runningmean, etc.)
57 // can be applied to its result making it quite versatile.
58 //
59 // Most array aggregate functions are lazy to avoid using too much memory.
60 // </synopsis>
61 
63  {
64  public:
65  // Constructor.
68  const TableExprNodeSet& source,
69  const TaQLStyle& style);
70 
71  // Get the nodes representing an aggregate function.
72  virtual void getAggrNodes (vector<TableExprNodeRep*>& aggr);
73 
74  // Get the operand node.
76  { return (operands().empty() ? 0 : operands()[0]); }
77 
78  // Create the correct aggregate function object.
80 
81  // Is the array aggregate function lazy?
82  virtual Bool isLazyAggregate() const;
83 
84  // Functions to get the result of an aggregate function.
85  // <group>
86  virtual Array<Bool> getArrayBool (const TableExprId& id);
87  virtual Array<Int64> getArrayInt (const TableExprId& id);
88  virtual Array<Double> getArrayDouble (const TableExprId& id);
89  virtual Array<DComplex> getArrayDComplex (const TableExprId& id);
90  virtual Array<String> getArrayString (const TableExprId& id);
91  virtual Array<MVTime> getArrayDate (const TableExprId& id);
92  // </group>
93 
94  private:
95  // Create the correct aggregate function object.
97 
98  //# Data members.
100  };
101 
102 
103 } //# NAMESPACE CASACORE - END
104 
105 #endif
virtual void getAggrNodes(vector< TableExprNodeRep *> &aggr)
Get the nodes representing an aggregate function.
Class representing an array function in table select expression.
TaQL node representing an array aggregate function.
Class to hold multiple table expression nodes.
Definition: ExprNodeSet.h:305
virtual Array< Double > getArrayDouble(const TableExprId &id)
The default implementation of getArrayDouble does getArrayInt and converts the result.
CountedPtr< TableExprGroupFuncBase > doMakeGroupAggrFunc()
Create the correct aggregate function object.
TableExprAggrNodeArray(TableExprFuncNode::FunctionType, NodeDataType, ValueType, const TableExprNodeSet &source, const TaQLStyle &style)
Constructor.
NodeDataType
Define the data types of a node.
Definition: ExprNodeRep.h:154
Abstract base class for a node in a table column expression tree.
Definition: ExprNodeRep.h:150
virtual Array< String > getArrayString(const TableExprId &id)
virtual Array< DComplex > getArrayDComplex(const TableExprId &id)
The default implementation of getArrayDComplex does getArrayDouble and converts the result...
virtual Bool isLazyAggregate() const
Is the array aggregate function lazy?
virtual Array< Bool > getArrayBool(const TableExprId &id)
Functions to get the result of an aggregate function.
Referenced counted pointer for constant data.
Definition: CountedPtr.h:86
Class with static members defining the TaQL style.
Definition: TaQLStyle.h:64
const PtrBlock< TableExprNodeRep * > & operands() const
Some functions to be used by TableExprNodeFuncArray.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:39
virtual Array< Int64 > getArrayInt(const TableExprId &id)
ValueType
Define the value types.
Definition: ExprNodeRep.h:169
TableExprNodeRep * operand()
Get the operand node.
The identification of a TaQL selection subject.
Definition: TableExprId.h:98
CountedPtr< TableExprGroupFuncBase > itsFunc
virtual CountedPtr< TableExprGroupFuncBase > makeGroupAggrFunc()
Create the correct aggregate function object.
virtual Array< MVTime > getArrayDate(const TableExprId &id)
this file contains all the compiler specific defines
Definition: mainpage.dox:28