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