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 vector<TENShPtr>& nodes,
70  const Block<Int>& dtypeOper,
71  const TaQLStyle& style);
72 
73  // Get the nodes representing an aggregate function.
74  virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
75 
76  // Get the operand node.
78  { return (operands().empty() ? TENShPtr() : operands()[0]); }
79 
80  // Create the correct aggregate function object.
82 
83  // Is the array aggregate function lazy?
84  virtual Bool isLazyAggregate() const;
85 
86  // Functions to get the result of an aggregate function.
87  // <group>
88  virtual MArray<Bool> getArrayBool (const TableExprId& id);
89  virtual MArray<Int64> getArrayInt (const TableExprId& id);
94  // </group>
95 
96  private:
97  // Create the correct aggregate function object.
99 
100  //# Data members.
102  };
103 
104 
105 } //# NAMESPACE CASACORE - END
106 
107 #endif
virtual Bool isLazyAggregate() const
Is the array aggregate function lazy?
CountedPtr< TableExprGroupFuncBase > itsFunc
virtual MArray< String > getArrayString(const TableExprId &id)
TENShPtr operand()
Get the operand node.
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
The default implementation of getArrayDComplex does getArrayDouble and converts the result.
virtual CountedPtr< TableExprGroupFuncBase > makeGroupAggrFunc()
Create the correct aggregate function object.
virtual MArray< Double > getArrayDouble(const TableExprId &id)
The default implementation of getArrayDouble does getArrayInt and converts the result.
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
CountedPtr< TableExprGroupFuncBase > doMakeGroupAggrFunc()
Create the correct aggregate function object.
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Functions to get the result of an aggregate function.
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
TableExprAggrNodeArray(TableExprFuncNode::FunctionType, NodeDataType, ValueType, const TableExprNodeSet &source, const vector< TENShPtr > &nodes, const Block< Int > &dtypeOper, const TaQLStyle &style)
Constructor.
const std::vector< TENShPtr > & operands() const
Some functions to be used by TableExprNodeFuncArray.
NodeDataType
Define the data types of a node.
Definition: ExprNodeRep.h:161
ValueType
Define the value types.
Definition: ExprNodeRep.h:176
Class to hold multiple table expression nodes.
Definition: ExprNodeSet.h:311
this file contains all the compiler specific defines
Definition: mainpage.dox:28
CountedPtr< TableExprNodeRep > TENShPtr
Definition: ExprNodeRep.h:56
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42