Go to the documentation of this file.
28 #ifndef TABLES_EXPRGROUP_H
29 #define TABLES_EXPRGROUP_H
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/BasicSL/String.h>
34 #include <casacore/tables/TaQL/ExprAggrNode.h>
163 const vector<TableExprId>&
ids (
uInt group)
const
164 {
return *
itsIds[group]; }
167 vector<CountedPtr<vector<TableExprId> > >
itsIds;
231 virtual Bool getBool (
const vector<TableExprId>& = vector<TableExprId>());
232 virtual Int64 getInt (
const vector<TableExprId>& = vector<TableExprId>());
233 virtual Double getDouble (
const vector<TableExprId>& = vector<TableExprId>());
235 virtual MVTime getDate (
const vector<TableExprId>& = vector<TableExprId>());
236 virtual String getString (
const vector<TableExprId>& = vector<TableExprId>());
398 for (
size_t i=0; i<ids.size(); ++i) {
409 for (
id=0;
id<ids.size(); ++id) {
419 if (
id == ids.size()) {
431 for (;
id<ids.size(); ++id) {
436 iter.array() = values.
array();
439 miter->array() = values.
mask();
444 if (ndef < ids.size()) {
445 shp[shp.
size() - 1] = ndef;
818 const vector<CountedPtr<TableExprGroupFuncBase> >&
getFuncs()
const
831 vector<CountedPtr<TableExprGroupFuncBase> >
itsFuncs;
virtual MArray< Int64 > getArrayInt(const vector< TableExprId > &=vector< TableExprId >())
virtual MVTime getDate(const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< MVTime > getArrayDate(const vector< TableExprId > &)
virtual String getString(const vector< TableExprId > &=vector< TableExprId >())
Class collecting the rowids of entries in a group.
virtual MArray< Bool > getArrayBool(const vector< TableExprId > &=vector< TableExprId >())
Abstract base class for aggregate functions giving a bool scalar.
uInt ngroup() const
Get the nr of groups.
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
virtual String getString(const vector< TableExprId > &)
MArray< MVTime > itsValue
const vector< CountedPtr< TableExprGroupFuncBase > > & getFuncs() const
Get the vector of functions.
Iterate an Array cursor through another Array.
virtual MArray< Int64 > getArrayInt(const vector< TableExprId > &)
virtual MArray< String > getArrayString(const vector< TableExprId > &)
A Vector of integers, for indexing into Array<T> objects.
virtual ~TableExprGroupFuncInt()
virtual MArray< Bool > getArrayBool(const vector< TableExprId > &)
TableExprGroupFuncDate(TableExprNodeRep *node, const MVTime &initValue=MVTime())
virtual DComplex getDComplex(const vector< TableExprId > &=vector< TableExprId >())
uInt seqnr() const
Get the function's sequence nr.
virtual Double getDouble(const vector< TableExprId > &)
void fill(const vector< TableExprNode > &nodes, const TableExprId &id)
Fill the keys with the values from the nodes for this rowid.
Abstract base class for aggregate functions giving a double array.
virtual ~TableExprGroupFuncString()
bool operator==(const TableExprGroupKey &) const
Compare this and that key.
Class representing a key in the groupby clause.
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
virtual MArray< Double > getArrayDouble(const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< Int64 > getArrayInt(const vector< TableExprId > &)
TableExprGroupFuncArrayString(TableExprNodeRep *node)
virtual ~TableExprGroupFirst()
virtual Bool isLazy() const
Does the aggregate function use lazy semantics? The default implementation returns False.
std::complex< Double > DComplex
Class to handle date/time type conversions and I/O.
virtual ~TableExprGroupFuncDouble()
virtual ~TableExprGroupExprId()
TableExprGroupFuncBool(TableExprNodeRep *node)
virtual CountedPtr< vector< TableExprId > > getIds() const
Get the assembled TableExprIds of a group.
TableExprGroupExprId(TableExprNodeRep *node)
void add(const CountedPtr< TableExprGroupFuncBase > &func)
Add a function object.
MArray< String > itsValue
virtual MArray< Double > getArrayDouble(const vector< TableExprId > &)
virtual Bool isLazy() const
Does the aggregate function use lazy semantics? The default implementation returns False.
Class derived from TableExprGroupFuncBase representing a no function.
ValueType valueType() const
Get the value type.
Referenced counted pointer for constant data.
virtual ~TableExprGroupFuncDComplex()
const TableExprId & getId() const
Get the TableExprId.
TableExprGroupKeySet(const vector< TableExprNode > &nodes)
Form the object from the given groupby nodes.
TableExprGroupFuncBase & operator=(const TableExprGroupFuncBase &)
Class collecting the arrays in a group.
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
Abstract base class for aggregate functions giving a date/time scalar.
virtual ~TableExprGroupFuncBool()
virtual void resize()
Make this array a different shape.
Abstract base class for aggregate functions giving a double scalar.
TableExprGroupNull(TableExprNodeRep *node)
TableExprGroupFuncInt(TableExprNodeRep *node, Int64 initValue=0)
void get(const TableExprId &id, Bool &value)
General get functions for template purposes.
virtual String getString(const vector< TableExprId > &)
uInt ndim() const
Get the dimensionality.
Abstract base class for aggregate functions giving an integer array.
virtual ~TableExprGroupFuncDate()
virtual void finish()
If needed, finish the aggregation.
Abstract base class for aggregate functions giving a bool array.
virtual ~TableExprGroupAggr()
virtual MArray< String > getArrayString(const vector< TableExprId > &=vector< TableExprId >())
Class representing all keys in the groupby clause.
TableExprGroupFirst(TableExprNodeRep *node)
virtual MArray< Bool > getArrayBool(const vector< TableExprId > &)
bool operator<(const TableExprGroupKey &) const
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
TableExprGroupFuncBool(TableExprNodeRep *node, Bool initValue)
Base class for an array with an optional mask.
Bool hasMask() const
Is there a mask?
virtual void apply(const TableExprId &id)=0
Get the operand's value for the given row and apply it to the aggregation.
virtual MVTime getDate(const vector< TableExprId > &)
TableExprGroupFuncArrayDate(TableExprNodeRep *node)
TableExprGroupLast(TableExprNodeRep *node)
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
virtual ~TableExprGroupFuncArrayString()
virtual Bool getBool(const vector< TableExprId > &)
Get the aggregated value.
Abstract base class for aggregate functions giving a string array.
const IPosition & shape() const
Get the shape.
virtual MArray< Double > getArrayDouble(const vector< TableExprId > &)
TableExprGroupFuncBase(TableExprNodeRep *node)
Construct from the TaQL aggregation node.
TableExprNodeRep * itsOperand
TableExprGroupFuncDouble(TableExprNodeRep *node, Double initValue=0)
TableExprGroupRowid(TableExprNodeRep *node)
virtual Double getDouble(const vector< TableExprId > &)
Bool isNull() const
Is the array null?
virtual ~TableExprGroupFuncBase()
virtual CountedPtr< vector< TableExprId > > getIds() const
Get the assembled TableExprIds of a group.
TableExprGroupResult(const vector< CountedPtr< TableExprGroupFuncSet > > &funcSets)
Create from the possible set of immediate aggregate functions.
virtual MArray< Int64 > getArrayInt(const vector< TableExprId > &)
TableExprGroupFuncArrayInt(TableExprNodeRep *node)
Class holding the results of groupby and aggregation.
virtual MArray< MVTime > getArrayDate(const vector< TableExprId > &)
virtual MArray< Bool > getArrayBool(const vector< TableExprId > &)
Class derived from TableExprGroupFuncBase for the first value in a group.
virtual Bool getBool(const vector< TableExprId > &)
Get the aggregated value.
Abstract base class for classes calculating an aggregated group result.
Abstract base class for aggregate functions giving a date/time array.
TableExprNodeRep * itsNode
virtual MArray< DComplex > getArrayDComplex(const vector< TableExprId > &)
virtual Bool isLazy() const
Does the aggregate function use lazy semantics? The default implementation returns False.
virtual MArray< String > getArrayString(const vector< TableExprId > &)
virtual ~TableExprGroupFuncArrayDComplex()
Abstract base class for aggregate functions giving a dcomplex scalar.
const vector< TableExprId > & ids(uInt group) const
Get the set of TableExprIds for the given group.
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
void addKey(TableExprNodeRep::NodeDataType dtype)
Add a key to end the set.
TableExprGroupFuncSet & funcSet(uInt group) const
Get the set of functions (and their results) for the given group.
this file contains all the compiler specific defines
virtual ~TableExprGroupFuncArrayDate()
bool operator<(const TableExprGroupKeySet &) const
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
TableExprNodeRep::NodeDataType itsDT
const Array< T > & array() const
Get access to the array.
virtual DComplex getDComplex(const vector< TableExprId > &)
The identification of a TaQL selection subject.
virtual MArray< MVTime > getArrayDate(const vector< TableExprId > &=vector< TableExprId >())
vector< TableExprGroupKey > itsKeys
TableExprGroupFuncArrayDouble(TableExprNodeRep *node)
virtual ~TableExprGroupFuncArrayInt()
Class derived from TableExprGroupFuncBase collecting the ids in a group.
Abstract base class for aggregate functions giving an integer scalar.
TableExprNodeRep::NodeDataType dataType() const
Get the data type.
virtual Int64 getInt(const vector< TableExprId > &)
virtual Double getDouble(const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< DComplex > getArrayDComplex(const vector< TableExprId > &)
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
vector< CountedPtr< TableExprGroupFuncSet > > itsFuncSets
MArray< Double > itsValue
vector< CountedPtr< vector< TableExprId > > > itsIds
virtual ~TableExprGroupFuncArrayBool()
virtual ~TableExprGroupFuncArrayDouble()
NodeDataType
Define the data types of a node.
virtual MArray< DComplex > getArrayDComplex(const vector< TableExprId > &=vector< TableExprId >())
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
TableExprGroupFuncString(TableExprNodeRep *node, const String &initValue=String())
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
MArray< T > getArray(const vector< TableExprId > &ids)
virtual Double getDouble(const vector< TableExprId > &)
Abstract base class for a node in a table column expression tree.
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
template <class T, class U> class vector;
void set(Bool v)
Set the key's value.
virtual DComplex getDComplex(const vector< TableExprId > &)
vector< CountedPtr< TableExprGroupFuncBase > > itsFuncs
virtual ~TableExprGroupNull()
String: the storage and methods of handling collections of characters.
Class containing the results of aggregated values in a group.
TableExprGroupFuncDComplex(TableExprNodeRep *node, const DComplex &initValue=DComplex())
const Array< Bool > & mask() const
Get the mask.
CountedPtr< vector< TableExprId > > itsIds
bool Bool
Define the standard types used by Casacore.
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
virtual ~TableExprGroupLast()
virtual Int64 getInt(const vector< TableExprId > &)
TableExprGroupFuncSet & operator=(const TableExprGroupFuncSet &)
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
virtual MArray< String > getArrayString(const vector< TableExprId > &)
void setSeqnr(uInt seqnr)
Set the function's sequence nr.
virtual MArray< Int64 > getArrayInt(const vector< TableExprId > &)
void append(const IPosition &other)
Append this IPosition with another one (causing a resize).
bool operator==(const TableExprGroupKeySet &) const
Compare all keys in the set.
TableExprGroupFuncArrayDComplex(TableExprNodeRep *node)
A 1-D Specialization of the Array class.
virtual MArray< DComplex > getArrayDComplex(const vector< TableExprId > &)
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
Abstract base class for aggregate functions giving a dcomplex array.
virtual Int64 getInt(const vector< TableExprId > &=vector< TableExprId >())
TableExprGroupKey(TableExprNodeRep::NodeDataType dtype)
Construct for a given data type.
Class derived from TableExprGroupFuncBase for the first value in a group.
virtual Bool getBool(const vector< TableExprId > &=vector< TableExprId >())
Get the aggregated value.
virtual ~TableExprGroupRowid()
void apply(const TableExprId &id)
Apply the functions to the given row.
virtual Bool isLazy() const
Does the aggregate function use lazy semantics? The default implementation returns False.
TableExprGroupFuncArrayBool(TableExprNodeRep *node)
MArray< DComplex > itsValue
Abstract base class for aggregate functions giving a string scalar.
void set(const String &v)
virtual Bool isLazy() const
Does the aggregate function use lazy semantics? The default implementation returns False.
virtual MVTime getDate(const vector< TableExprId > &)
virtual MArray< MVTime > getArrayDate(const vector< TableExprId > &)
virtual MArray< Double > getArrayDouble(const vector< TableExprId > &)
TableExprGroupAggr(TableExprNodeRep *node)