26#ifndef TABLES_EXPRNODESET_H
27#define TABLES_EXPRNODESET_H
30#include <casacore/casa/aips.h>
31#include <casacore/tables/TaQL/ExprNodeSetElem.h>
32#include <casacore/tables/Tables/TableError.h>
33#include <casacore/casa/Arrays/ArrayFwd.h>
129 void show (ostream& os,
uInt indent)
const override;
132 virtual void flattenTree (std::vector<TableExprNodeRep*>&)
override;
222 { marr.
reference (node->getArrayBool (
id)); }
225 { marr.
reference (node->getArrayInt (
id)); }
228 { marr.
reference (node->getArrayDouble (
id)); }
231 { marr.
reference (node->getArrayDComplex (
id)); }
234 { marr.
reference (node->getArrayString (
id)); }
237 { marr.
reference (node->getArrayDate (
id)); }
279 throw TableInvExpr(
"scalar value cannot be given in a nested array");
293 maskShp[maskShp.
size()-1] = 1;
295 if (!
mask.empty()) {
303 for (
Int64 i=1; i<n; i++) {
305 throw TableInvExpr(
"scalar value cannot be given in a nested array");
316 throw TableInvExpr(
"Shapes of nested arrays do not match");
326 }
else if (!
mask.empty()) {
337 for (
Int64 i=0; i<n; i++) {
338 itsElems[i]->fillVector (result, cnt,
id);
#define DebugAssert(expr, exception)
const IPosition & shape() const
The length of each axis.
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.
Array< T > reform(const IPosition &shape) const
It is occasionally useful to have an array which access the same storage appear to have a different s...
bool isEqual(const IPosition &other) const
Element-by-element comparison for equality.
void append(const IPosition &other)
Append this IPosition with another one (causing a resize).
Bool isNull() const
Is the array null?
const Array< Bool > & mask() const
Get the mask.
Bool hasMask() const
Is there a mask?
const IPosition & shape() const
Get the shape.
void reference(const MArray< T > &other)
Reference another array.
const Array< T > & array() const
Get access to the array.
String: the storage and methods of handling collections of characters.
Abstract base class for a node in a table column expression tree.
ValueType valueType() const
Get the value type.
Class to hold the table expression nodes for an element in a set.
const TENSEBShPtr & getElem() const
Get the internal pointer to the underlying TableExprNodeSetElemBase.
MArray< Bool > contains(const TableExprId &id, const MArray< MVTime > &value) override
TableExprNodeSet(const Vector< rownr_t > &rownrs, const TableExprNodeSet &)
Construct a set with n*set.size() elements where n is the number of rows.
MArray< Bool > getArrayBool(const TableExprId &id) override
Get an array value for this bounded set in the given row.
MArray< String > getArrayString(const TableExprId &id) override
TENShPtr toConstArray() const
Convert the const set to an array.
void setShape()
Try to set the set's shape for a bounded set with single elements.
MArray< Int64 > getArrayInt(const TableExprId &id) override
void getArray(MArray< DComplex > &marr, const TENShPtr &node, const TableExprId &id) const
MArray< Bool > contains(const TableExprId &id, const MArray< Bool > &value) override
void checkEqualDataTypes() const
Check if the data type of the set elements are the same.
virtual void flattenTree(std::vector< TableExprNodeRep * > &) override
Flatten the node tree by adding the node and its children to the vector.
TableExprNodeSet(const TableExprNodeSet &)
Bool isSingle() const
Contains the set only single elements? Single means that only single values are given (thus no end no...
Bool contains(const TableExprId &id, String value) override
MArray< Bool > contains(const TableExprId &id, const MArray< String > &value) override
MArray< MVTime > getArrayDate(const TableExprId &id) override
MArray< Bool > contains(const TableExprId &id, const MArray< Int64 > &value) override
void getArray(MArray< Int64 > &marr, const TENShPtr &node, const TableExprId &id) const
Bool contains(const TableExprId &id, MVTime value) override
Bool contains(const TableExprId &id, Bool value) override
Does a value occur in the set?
MArray< Bool > contains(const TableExprId &id, const MArray< DComplex > &value) override
MArray< DComplex > getArrayDComplex(const TableExprId &id) override
void show(ostream &os, uInt indent) const override
Show the node.
Bool contains(const TableExprId &id, const char *value)
TableExprNodeSet(const Slicer &)
Construct from a Slicer.
void getArray(MArray< Double > &marr, const TENShPtr &node, const TableExprId &id) const
Bool contains(const TableExprId &id, Int64 value) override
void getArray(MArray< String > &marr, const TENShPtr &node, const TableExprId &id) const
void add(const TENSEBShPtr &, Bool adaptType=False)
Add an element to the set.
std::vector< TENSEBShPtr > itsElems
Bool contains(const TableExprId &id, int value)
Useful to make overloading clearer (mainly for test programs).
Bool contains(const TableExprId &id, Double value) override
Bool isDiscrete() const
Contains the set only discrete elements? Discrete means that no continuous ranges are given,...
Bool hasArrays() const
Contains the set array values?
MArray< Double > getArrayDouble(const TableExprId &id) override
void getArray(MArray< Bool > &marr, const TENShPtr &node, const TableExprId &id) const
Get the array in a templated way.
Bool isBounded() const
Is the set fully bounded (discrete and no undefined end values)?
const TENSEBShPtr & operator[](size_t index) const
Get the i-th element.
MArray< T > toArray(const TableExprId &id) const
size_t nelements() const
For backward compatibility.
size_t size() const
Get the number of elements.
void adaptSetUnits(const Unit &) override
Let a set node convert itself to the given unit.
void add(const TableExprNodeSetElem &elem, Bool adaptType=False)
void getArray(MArray< MVTime > &marr, const TENShPtr &node, const TableExprId &id) const
TableExprNodeSet & operator=(const TableExprNodeSet &)=delete
A copy of a TableExprNodeSet cannot be assigned.
Bool contains(const TableExprId &id, DComplex value) override
MArray< Bool > contains(const TableExprId &id, const MArray< Double > &value) override
TENShPtr setOrArray() const
Try to convert the set to an array.
TableExprNodeSet(const IPosition &)
Construct from an IPosition.
TableExprNodeSet()
Construct an empty set.
Table error; invalid select expression.
void resize(size_t len, bool copyValues=false)
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)
std::shared_ptr< TableExprNodeRep > TENShPtr
std::shared_ptr< TableExprNodeSetElemBase > TENSEBShPtr
bool Bool
Define the standard types used by Casacore.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.