26#ifndef TABLES_EXPRGROUP_H
27#define TABLES_EXPRGROUP_H
30#include <casacore/casa/aips.h>
31#include <casacore/casa/BasicSL/String.h>
32#include <casacore/tables/TaQL/ExprAggrNode.h>
148 (
const vector<std::shared_ptr<TableExprGroupFuncSet>>& funcSets);
152 (
const vector<std::shared_ptr<TableExprGroupFuncSet>>& funcSets,
153 const vector<std::shared_ptr<vector<TableExprId>>>&
ids);
161 const vector<TableExprId>&
ids (
uInt group)
const
162 {
return *
itsIds[group]; }
165 vector<std::shared_ptr<vector<TableExprId>>>
itsIds;
226 virtual std::shared_ptr<vector<TableExprId>>
getIds()
const;
232 virtual Bool getBool (
const vector<TableExprId>& = vector<TableExprId>());
233 virtual Int64 getInt (
const vector<TableExprId>& = vector<TableExprId>());
235 virtual DComplex
getDComplex (
const vector<TableExprId>& = vector<TableExprId>());
236 virtual MVTime getDate (
const vector<TableExprId>& = vector<TableExprId>());
341 virtual std::shared_ptr<vector<TableExprId>>
getIds()
const;
343 std::shared_ptr<vector<TableExprId>>
itsIds;
395 for (
size_t i=0; i<ids.size(); ++i) {
406 for (
id=0;
id<ids.size(); ++id) {
416 if (
id == ids.size()) {
423 std::shared_ptr<ArrayIterator<Bool>> miter;
428 for (;
id<ids.size(); ++id) {
436 miter->array() = values.
mask();
441 if (ndef < ids.size()) {
442 shp[shp.
size() - 1] = ndef;
553 const DComplex& initValue = DComplex())
813 void add (
const std::shared_ptr<TableExprGroupFuncBase>& func);
819 const vector<std::shared_ptr<TableExprGroupFuncBase>>&
getFuncs()
const
828 vector<std::shared_ptr<TableExprGroupFuncBase>>
itsFuncs;
Array< T > & array()
Return the cursor.
virtual void next() override
Move the cursor to the next position.
void resize()
Make this array a different shape.
void append(const IPosition &other)
Append this IPosition with another one (causing a resize).
Bool isNull() const
Is the array null?
uInt ndim() const
Get the dimensionality.
const Array< Bool > & mask() const
Get the mask.
Bool hasMask() const
Is there a mask?
const IPosition & shape() const
Get the shape.
const Array< T > & array() const
Get access to the array.
String: the storage and methods of handling collections of characters.
virtual MArray< String > getArrayString(const vector< TableExprId > &)
virtual Bool isLazy() const
Does the aggregate function use lazy semantics?
virtual MArray< DComplex > getArrayDComplex(const vector< TableExprId > &)
virtual MArray< MVTime > getArrayDate(const vector< TableExprId > &)
virtual MArray< Double > getArrayDouble(const vector< TableExprId > &)
virtual ~TableExprGroupAggr()
virtual MArray< Int64 > getArrayInt(const vector< TableExprId > &)
virtual MArray< Bool > getArrayBool(const vector< TableExprId > &)
MArray< T > getArray(const vector< TableExprId > &ids)
TableExprGroupAggr(TableExprNodeRep *node)
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
virtual Bool isLazy() const
Does the aggregate function use lazy semantics?
std::shared_ptr< vector< TableExprId > > itsIds
virtual std::shared_ptr< vector< TableExprId > > getIds() const
Get the assembled TableExprIds of a group.
TableExprGroupExprId(TableExprNodeRep *node)
virtual ~TableExprGroupExprId()
virtual Bool getBool(const vector< TableExprId > &)
Get the aggregated value.
virtual ~TableExprGroupFirst()
virtual MArray< String > getArrayString(const vector< TableExprId > &)
virtual MVTime getDate(const vector< TableExprId > &)
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
virtual MArray< MVTime > getArrayDate(const vector< TableExprId > &)
virtual DComplex getDComplex(const vector< TableExprId > &)
virtual Int64 getInt(const vector< TableExprId > &)
virtual String getString(const vector< TableExprId > &)
virtual MArray< Double > getArrayDouble(const vector< TableExprId > &)
TableExprGroupFirst(TableExprNodeRep *node)
virtual MArray< DComplex > getArrayDComplex(const vector< TableExprId > &)
virtual Double getDouble(const vector< TableExprId > &)
virtual MArray< Int64 > getArrayInt(const vector< TableExprId > &)
virtual MArray< Bool > getArrayBool(const vector< TableExprId > &)
virtual MArray< Bool > getArrayBool(const vector< TableExprId > &)
virtual ~TableExprGroupFuncArrayBool()
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
TableExprGroupFuncArrayBool(TableExprNodeRep *node)
MArray< DComplex > itsValue
TableExprGroupFuncArrayDComplex(TableExprNodeRep *node)
virtual MArray< DComplex > getArrayDComplex(const vector< TableExprId > &)
virtual ~TableExprGroupFuncArrayDComplex()
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
virtual MArray< MVTime > getArrayDate(const vector< TableExprId > &)
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
TableExprGroupFuncArrayDate(TableExprNodeRep *node)
virtual ~TableExprGroupFuncArrayDate()
MArray< MVTime > itsValue
MArray< Double > itsValue
virtual MArray< Double > getArrayDouble(const vector< TableExprId > &)
TableExprGroupFuncArrayDouble(TableExprNodeRep *node)
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
virtual ~TableExprGroupFuncArrayDouble()
virtual MArray< Int64 > getArrayInt(const vector< TableExprId > &)
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
virtual ~TableExprGroupFuncArrayInt()
TableExprGroupFuncArrayInt(TableExprNodeRep *node)
virtual MArray< String > getArrayString(const vector< TableExprId > &)
Bool checkShape(const MArrayBase &arr, const String &func)
If not empty, check if the shape matches that of itsValue.
MArray< String > itsValue
TableExprGroupFuncArrayString(TableExprNodeRep *node)
virtual ~TableExprGroupFuncArrayString()
virtual void finish()
If needed, finish the aggregation.
TableExprGroupFuncBase(TableExprNodeRep *node)
Construct from the TaQL aggregation node.
virtual void apply(const TableExprId &id)=0
Get the operand's value for the given row and apply it to the aggregation.
virtual std::shared_ptr< vector< TableExprId > > getIds() const
Get the assembled TableExprIds of a group.
virtual MArray< Bool > getArrayBool(const vector< TableExprId > &=vector< TableExprId >())
TableExprGroupFuncBase & operator=(const TableExprGroupFuncBase &)=delete
virtual Int64 getInt(const vector< TableExprId > &=vector< TableExprId >())
virtual MVTime getDate(const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< Int64 > getArrayInt(const vector< TableExprId > &=vector< TableExprId >())
virtual MArray< MVTime > getArrayDate(const vector< TableExprId > &=vector< TableExprId >())
uInt seqnr() const
Get the function's sequence nr.
virtual MArray< String > getArrayString(const vector< TableExprId > &=vector< TableExprId >())
virtual Double getDouble(const vector< TableExprId > &=vector< TableExprId >())
virtual Bool isLazy() const
Does the aggregate function use lazy semantics?
TableExprGroupFuncBase(const TableExprGroupFuncBase &)=delete
Copying is not needed, thus not allowed.
virtual MArray< Double > getArrayDouble(const vector< TableExprId > &=vector< TableExprId >())
TableExprNodeRep * itsNode
virtual DComplex getDComplex(const vector< TableExprId > &=vector< TableExprId >())
void setSeqnr(uInt seqnr)
Set the function's sequence nr.
TableExprNodeRep * itsOperand
virtual Bool getBool(const vector< TableExprId > &=vector< TableExprId >())
Get the aggregated value.
virtual MArray< DComplex > getArrayDComplex(const vector< TableExprId > &=vector< TableExprId >())
virtual ~TableExprGroupFuncBase()
virtual String getString(const vector< TableExprId > &=vector< TableExprId >())
virtual Bool getBool(const vector< TableExprId > &)
Get the aggregated value.
TableExprGroupFuncBool(TableExprNodeRep *node, Bool initValue)
virtual ~TableExprGroupFuncBool()
TableExprGroupFuncBool(TableExprNodeRep *node)
TableExprGroupFuncDComplex(TableExprNodeRep *node, const DComplex &initValue=DComplex())
virtual DComplex getDComplex(const vector< TableExprId > &)
virtual ~TableExprGroupFuncDComplex()
virtual MVTime getDate(const vector< TableExprId > &)
TableExprGroupFuncDate(TableExprNodeRep *node, const MVTime &initValue=MVTime())
virtual ~TableExprGroupFuncDate()
virtual ~TableExprGroupFuncDouble()
virtual Double getDouble(const vector< TableExprId > &)
TableExprGroupFuncDouble(TableExprNodeRep *node, Double initValue=0)
virtual ~TableExprGroupFuncInt()
virtual Double getDouble(const vector< TableExprId > &)
virtual Int64 getInt(const vector< TableExprId > &)
TableExprGroupFuncInt(TableExprNodeRep *node, Int64 initValue=0)
Class containing the results of aggregated values in a group.
const vector< std::shared_ptr< TableExprGroupFuncBase > > & getFuncs() const
Get the vector of functions.
const TableExprId & getId() const
Get the TableExprId.
TableExprGroupFuncSet(const vector< TableExprNodeRep * > &aggrNodes)
Let the aggregate node objects construct the function set.
void add(const std::shared_ptr< TableExprGroupFuncBase > &func)
Add a function object.
void apply(const TableExprId &id)
Apply the functions to the given row.
TableExprGroupFuncSet & operator=(const TableExprGroupFuncSet &)=delete
TableExprGroupFuncSet(const TableExprGroupFuncSet &)=delete
Copying is not needed, thus not allowed.
vector< std::shared_ptr< TableExprGroupFuncBase > > itsFuncs
TableExprGroupFuncString(TableExprNodeRep *node, const String &initValue=String())
virtual ~TableExprGroupFuncString()
virtual String getString(const vector< TableExprId > &)
TableExprGroupKeySet(const vector< TableExprNode > &nodes)
Form the object from the given groupby nodes.
bool operator<(const TableExprGroupKeySet &) const
void fill(const vector< TableExprNode > &nodes, const TableExprId &id)
Fill the keys with the values from the nodes for this rowid.
void addKey(TableExprNodeRep::NodeDataType dtype)
Add a key to end the set.
bool operator==(const TableExprGroupKeySet &) const
Compare all keys in the set.
vector< TableExprGroupKey > itsKeys
bool operator<(const TableExprGroupKey &) const
void set(const String &v)
TableExprGroupKey(TableExprNodeRep::NodeDataType dtype)
Construct for a given data type.
bool operator==(const TableExprGroupKey &) const
Compare this and that key.
TableExprNodeRep::NodeDataType itsDT
TableExprNodeRep::NodeDataType dataType() const
Get the data type.
void set(Bool v)
Set the key's value.
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
TableExprGroupLast(TableExprNodeRep *node)
virtual ~TableExprGroupLast()
TableExprGroupNull(TableExprNodeRep *node)
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
virtual ~TableExprGroupNull()
virtual Bool isLazy() const
Does the aggregate function use lazy semantics?
TableExprGroupResult(const vector< std::shared_ptr< TableExprGroupFuncSet > > &funcSets, const vector< std::shared_ptr< vector< TableExprId > > > &ids)
Create from the possible set of immediate aggregate functions and the set of TableExprIds per group f...
vector< std::shared_ptr< TableExprGroupFuncSet > > itsFuncSets
uInt ngroup() const
Get the nr of groups.
vector< std::shared_ptr< vector< TableExprId > > > itsIds
TableExprGroupFuncSet & funcSet(uInt group) const
Get the set of functions (and their results) for the given group.
TableExprGroupResult(const vector< std::shared_ptr< TableExprGroupFuncSet > > &funcSets)
Create from the possible set of immediate aggregate functions.
const vector< TableExprId > & ids(uInt group) const
Get the set of TableExprIds for the given group.
virtual Bool isLazy() const
Does the aggregate function use lazy semantics?
virtual MArray< Int64 > getArrayInt(const vector< TableExprId > &)
TableExprGroupRowid(TableExprNodeRep *node)
virtual void apply(const TableExprId &id)
Get the operand's value for the given row and apply it to the aggregation.
virtual ~TableExprGroupRowid()
Abstract base class for a node in a table column expression tree.
NodeDataType
Define the data types of a node.
this file contains all the compiler specific defines
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
bool Bool
Define the standard types used by Casacore.