Loading...
Searching...
No Matches
casacore::TableExprGroupFuncBase Class Referenceabstract
tables package (libcasa_tables) » TaQL_module » TaQL_module_internal_classes

Abstract base class for classes calculating an aggregated group result. More...

`#include <ExprGroup.h>`

## Public Member Functions

| TableExprGroupFuncBase (TableExprNodeRep *node)
| Construct from the TaQL aggregation node.
virtual | ~TableExprGroupFuncBase ()
| TableExprGroupFuncBase (const TableExprGroupFuncBase &)=delete
| Copying is not needed, thus not allowed.
TableExprGroupFuncBase & | operator= (const TableExprGroupFuncBase &)=delete
virtual Bool | isLazy () const
| Does the aggregate function use lazy semantics?
uInt | seqnr () const
| Get the function's sequence nr.
void | setSeqnr (uInt seqnr)
| Set the function's sequence nr.
virtual void | apply (const TableExprId &id)=0
| Get the operand's value for the given row and apply it to the aggregation.
virtual void | finish ()
| If needed, finish the aggregation.
virtual std::shared_ptr< vector< TableExprId > > | getIds () const
| Get the assembled TableExprIds of a group.
virtual Bool | getBool (const vector< TableExprId > &=vector< TableExprId >())
| Get the aggregated value.
virtual Int64 | getInt (const vector< TableExprId > &=vector< TableExprId >())
virtual Double | getDouble (const vector< TableExprId > &=vector< TableExprId >())
virtual DComplex | getDComplex (const vector< TableExprId > &=vector< TableExprId >())
virtual MVTime | getDate (const vector< TableExprId > &=vector< TableExprId >())
virtual String | getString (const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< Bool > | getArrayBool (const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< Int64 > | getArrayInt (const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< Double > | getArrayDouble (const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< DComplex > | getArrayDComplex (const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< MVTime > | getArrayDate (const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< String > | getArrayString (const vector< TableExprId > &=vector< TableExprId >())

## Protected Attributes

TableExprNodeRep * | itsNode
TableExprNodeRep * | itsOperand
uInt | itsSeqnr

## Detailed Description

Abstract base class for classes calculating an aggregated group result.

### Intended use:

Internal

### Review Status

Test programs:
  tExprGroup

### Synopsis

The GROUPBY clause divides a table into groups for which aggregated results can be calculated like the mean or minimum. These results are calculated in classes derived from this abstract base class.
There is one such function object per aggregation per group. All aggregation objects of a group are combined in a std::vector. This vector is mapped to a TableExprGroupKeySet object to keep track of all groups and aggregations.
There are two types of aggregation function classes.

- Immediate classes implement the 'apply' function to immediately apply the operand's value in the aggregation. Such classes do not keep the operand's values.
- Lazy classes do not need the 'apply' function. Instead they read all values of the group in the 'getXXX' function and do the aggregation. Such classes are meant for aggregation functions like 'median' that need to keep all values. When applying it immediately, all groups need to keep their values which might need too much memory. Lazy classes need the values of only one group at a time, but have the disadvantage that reading the values from the table might be done in a non-sequential order.

Most derived classes are immediate classes.

Definition at line 199 of file ExprGroup.h.

## Constructor & Destructor Documentation

## TableExprGroupFuncBase() [1/2]

casacore::TableExprGroupFuncBase::TableExprGroupFuncBase | ( | TableExprNodeRep * | node | ) |

explicit

Construct from the TaQL aggregation node.

It keeps the operand of the aggregation node.

Referenced by operator=(), casacore::TableExprGroupFuncArrayBool::TableExprGroupFuncArrayBool(), casacore::TableExprGroupFuncArrayDate::TableExprGroupFuncArrayDate(), casacore::TableExprGroupFuncArrayDComplex::TableExprGroupFuncArrayDComplex(), casacore::TableExprGroupFuncArrayDouble::TableExprGroupFuncArrayDouble(), casacore::TableExprGroupFuncArrayInt::TableExprGroupFuncArrayInt(), casacore::TableExprGroupFuncArrayString::TableExprGroupFuncArrayString(), TableExprGroupFuncBase(), casacore::TableExprGroupFuncBool::TableExprGroupFuncBool(), casacore::TableExprGroupFuncBool::TableExprGroupFuncBool(), casacore::TableExprGroupFuncDate::TableExprGroupFuncDate(), casacore::TableExprGroupFuncDComplex::TableExprGroupFuncDComplex(), casacore::TableExprGroupFuncDouble::TableExprGroupFuncDouble(), casacore::TableExprGroupFuncInt::TableExprGroupFuncInt(), and casacore::TableExprGroupFuncString::TableExprGroupFuncString().

## ~TableExprGroupFuncBase()

virtual casacore::TableExprGroupFuncBase::~TableExprGroupFuncBase | ( |  | ) |

virtual

## TableExprGroupFuncBase() [2/2]

casacore::TableExprGroupFuncBase::TableExprGroupFuncBase | ( | const TableExprGroupFuncBase & |  | ) |

delete

Copying is not needed, thus not allowed.

References TableExprGroupFuncBase().

## Member Function Documentation

## apply()

virtual void casacore::TableExprGroupFuncBase::apply | ( | const TableExprId & | id | ) |

pure virtual

Get the operand's value for the given row and apply it to the aggregation.

This function should not be called for lazy classes.

Implemented in casacore::TableExprGroupAggr, casacore::TableExprGroupAll, casacore::TableExprGroupAny, casacore::TableExprGroupArrayAll, casacore::TableExprGroupArrayAlls, casacore::TableExprGroupArrayAny, casacore::TableExprGroupArrayAnys, casacore::TableExprGroupArrayNFalse, casacore::TableExprGroupArrayNFalses, casacore::TableExprGroupArrayNTrue, casacore::TableExprGroupArrayNTrues, casacore::TableExprGroupCount, casacore::TableExprGroupCountAll, casacore::TableExprGroupExprId, casacore::TableExprGroupFirst, casacore::TableExprGroupFractileArrayDouble, casacore::TableExprGroupFractileDouble, casacore::TableExprGroupHistDouble, casacore::TableExprGroupHistInt, casacore::TableExprGroupHistScalar, casacore::TableExprGroupLast, casacore::TableExprGroupMaxArrayDouble, casacore::TableExprGroupMaxArrayInt, casacore::TableExprGroupMaxDouble, casacore::TableExprGroupMaxInt, casacore::TableExprGroupMaxsArrayDouble, casacore::TableExprGroupMaxsArrayInt, casacore::TableExprGroupMeanArrayDComplex, casacore::TableExprGroupMeanArrayDouble, casacore::TableExprGroupMeanDComplex, casacore::TableExprGroupMeanDouble, casacore::TableExprGroupMeansArrayDComplex, casacore::TableExprGroupMeansArrayDouble, casacore::TableExprGroupMinArrayDouble, casacore::TableExprGroupMinArrayInt, casacore::TableExprGroupMinDouble, casacore::TableExprGroupMinInt, casacore::TableExprGroupMinsArrayDouble, casacore::TableExprGroupMinsArrayInt, casacore::TableExprGroupNFalse, casacore::TableExprGroupNTrue, casacore::TableExprGroupNull, casacore::TableExprGroupProductArrayDComplex, casacore::TableExprGroupProductArrayDouble, casacore::TableExprGroupProductArrayInt, casacore::TableExprGroupProductDComplex, casacore::TableExprGroupProductDouble, casacore::TableExprGroupProductInt, casacore::TableExprGroupProductsArrayDComplex, casacore::TableExprGroupProductsArrayDouble, casacore::TableExprGroupProductsArrayInt, casacore::TableExprGroupRmsArrayDouble, casacore::TableExprGroupRmsDouble, casacore::TableExprGroupRmssArrayDouble, casacore::TableExprGroupRowid, casacore::TableExprGroupSumArrayDComplex, casacore::TableExprGroupSumArrayDouble, casacore::TableExprGroupSumArrayInt, casacore::TableExprGroupSumDComplex, casacore::TableExprGroupSumDouble, casacore::TableExprGroupSumInt, casacore::TableExprGroupSumsArrayDComplex, casacore::TableExprGroupSumsArrayDouble, casacore::TableExprGroupSumsArrayInt, casacore::TableExprGroupSumSqrArrayDComplex, casacore::TableExprGroupSumSqrArrayDouble, casacore::TableExprGroupSumSqrArrayInt, casacore::TableExprGroupSumSqrDComplex, casacore::TableExprGroupSumSqrDouble, casacore::TableExprGroupSumSqrInt, casacore::TableExprGroupSumSqrsArrayDComplex, casacore::TableExprGroupSumSqrsArrayDouble, casacore::TableExprGroupSumSqrsArrayInt, casacore::TableExprGroupVarianceArrayDComplex, casacore::TableExprGroupVarianceArrayDouble, casacore::TableExprGroupVarianceDComplex, casacore::TableExprGroupVarianceDouble, casacore::TableExprGroupVariancesArrayDComplex, and casacore::TableExprGroupVariancesArrayDouble.

## finish()

virtual void casacore::TableExprGroupFuncBase::finish | ( |  | ) |

virtual

If needed, finish the aggregation.

By default nothing is done.

Reimplemented in casacore::TableExprGroupMaxsArrayDouble, casacore::TableExprGroupMaxsArrayInt, casacore::TableExprGroupMeanArrayDComplex, casacore::TableExprGroupMeanArrayDouble, casacore::TableExprGroupMeanDComplex, casacore::TableExprGroupMeanDouble, casacore::TableExprGroupMeansArrayDComplex, casacore::TableExprGroupMeansArrayDouble, casacore::TableExprGroupMinsArrayDouble, casacore::TableExprGroupMinsArrayInt, casacore::TableExprGroupProductsArrayDComplex, casacore::TableExprGroupProductsArrayDouble, casacore::TableExprGroupProductsArrayInt, casacore::TableExprGroupRmsArrayDouble, casacore::TableExprGroupRmsDouble, casacore::TableExprGroupRmssArrayDouble, casacore::TableExprGroupStdDevArrayDComplex, casacore::TableExprGroupStdDevArrayDouble, casacore::TableExprGroupStdDevDComplex, casacore::TableExprGroupStdDevDouble, casacore::TableExprGroupStdDevsArrayDComplex, casacore::TableExprGroupStdDevsArrayDouble, casacore::TableExprGroupVarianceArrayDComplex, casacore::TableExprGroupVarianceArrayDouble, casacore::TableExprGroupVarianceDComplex, casacore::TableExprGroupVarianceDouble, casacore::TableExprGroupVariancesArrayDComplex, and casacore::TableExprGroupVariancesArrayDouble.

## getArrayBool()

virtual MArray< Bool > casacore::TableExprGroupFuncBase::getArrayBool | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupAggr, casacore::TableExprGroupFirst, and casacore::TableExprGroupFuncArrayBool.

## getArrayDate()

virtual MArray< MVTime > casacore::TableExprGroupFuncBase::getArrayDate | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupAggr, casacore::TableExprGroupFirst, and casacore::TableExprGroupFuncArrayDate.

## getArrayDComplex()

virtual MArray< DComplex > casacore::TableExprGroupFuncBase::getArrayDComplex | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupAggr, casacore::TableExprGroupFirst, and casacore::TableExprGroupFuncArrayDComplex.

## getArrayDouble()

virtual MArray< Double > casacore::TableExprGroupFuncBase::getArrayDouble | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupAggr, casacore::TableExprGroupFirst, and casacore::TableExprGroupFuncArrayDouble.

## getArrayInt()

virtual MArray< Int64 > casacore::TableExprGroupFuncBase::getArrayInt | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupAggr, casacore::TableExprGroupFirst, casacore::TableExprGroupFuncArrayInt, casacore::TableExprGroupHistBase, and casacore::TableExprGroupRowid.

## getArrayString()

virtual MArray< String > casacore::TableExprGroupFuncBase::getArrayString | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupAggr, casacore::TableExprGroupFirst, and casacore::TableExprGroupFuncArrayString.

## getBool()

virtual Bool casacore::TableExprGroupFuncBase::getBool | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Get the aggregated value.

Immediate classes can return the already calculated value, while lazy classes will get the values of all rows given by the TableExprIds and do the aggregation.

Reimplemented in casacore::TableExprGroupFirst, and casacore::TableExprGroupFuncBool.

## getDate()

virtual MVTime casacore::TableExprGroupFuncBase::getDate | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupFirst, and casacore::TableExprGroupFuncDate.

## getDComplex()

virtual DComplex casacore::TableExprGroupFuncBase::getDComplex | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupFirst, and casacore::TableExprGroupFuncDComplex.

## getDouble()

virtual Double casacore::TableExprGroupFuncBase::getDouble | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupFirst, casacore::TableExprGroupFractileArrayDouble, casacore::TableExprGroupFractileDouble, casacore::TableExprGroupFuncDouble, and casacore::TableExprGroupFuncInt.

## getIds()

virtual std::shared_ptr< vector< TableExprId > > casacore::TableExprGroupFuncBase::getIds | ( |  | ) | const

virtual

Get the assembled TableExprIds of a group.

It is specifically meant for TableExprGroupExprId used for lazy aggregation.

Reimplemented in casacore::TableExprGroupExprId.

## getInt()

virtual Int64 casacore::TableExprGroupFuncBase::getInt | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupFirst, and casacore::TableExprGroupFuncInt.

## getString()

virtual String casacore::TableExprGroupFuncBase::getString | ( | const vector< TableExprId > & | = vector< TableExprId >() | ) |

virtual

Reimplemented in casacore::TableExprGroupFirst, and casacore::TableExprGroupFuncString.

## isLazy()

virtual Bool casacore::TableExprGroupFuncBase::isLazy | ( |  | ) | const

virtual

Does the aggregate function use lazy semantics?

The default implementation returns False.

Reimplemented in casacore::TableExprGroupAggr, casacore::TableExprGroupExprId, casacore::TableExprGroupFractileArrayDouble, casacore::TableExprGroupFractileDouble, casacore::TableExprGroupNull, and casacore::TableExprGroupRowid.

## operator=()

TableExprGroupFuncBase & casacore::TableExprGroupFuncBase::operator= | ( | const TableExprGroupFuncBase & |  | ) |

delete

References TableExprGroupFuncBase().

## seqnr()

uInt casacore::TableExprGroupFuncBase::seqnr | ( |  | ) | const

inline

Get the function's sequence nr.

Definition at line 213 of file ExprGroup.h.

References itsSeqnr.

Referenced by setSeqnr().

## setSeqnr()

void casacore::TableExprGroupFuncBase::setSeqnr | ( | uInt | seqnr | ) |

inline

Set the function's sequence nr.

Definition at line 216 of file ExprGroup.h.

References itsSeqnr, and seqnr().

## Member Data Documentation

## itsNode

TableExprNodeRep* casacore::TableExprGroupFuncBase::itsNode

protected

Definition at line 247 of file ExprGroup.h.

## itsOperand

TableExprNodeRep* casacore::TableExprGroupFuncBase::itsOperand

protected

Definition at line 248 of file ExprGroup.h.

Referenced by casacore::TableExprGroupAggr::getArray().

## itsSeqnr

uInt casacore::TableExprGroupFuncBase::itsSeqnr

protected

Definition at line 249 of file ExprGroup.h.

Referenced by seqnr(), and setSeqnr().

The documentation for this class was generated from the following file:

- tables/TaQL/ExprGroup.h