28 #ifndef TABLES_EXPRNODESET_H
29 #define TABLES_EXPRNODESET_H
32 #include <casacore/casa/aips.h>
33 #include <casacore/tables/TaQL/ExprNodeRep.h>
34 #include <casacore/tables/TaQL/ExprNodeArray.h>
35 #include <casacore/casa/Arrays/ArrayFwd.h>
36 #include <casacore/casa/Containers/Block.h>
264 #define castItsElem(i) static_cast<TableExprNodeSetElem*>(itsElems[i].get())
265 #define castSetElem(shptr) static_cast<TableExprNodeSetElem*>(shptr.get())
525 maskShp[maskShp.
size()-1] = 1;
527 if (!
mask.empty()) {
535 for (
Int64 i=1; i<n; i++) {
545 throw TableInvExpr(
"Shapes of nested arrays do not match");
555 }
else if (!
mask.empty()) {
566 for (
Int64 i=0; i<n; i++) {
#define DebugAssert(expr, exception)
const IPosition & shape() const
The length of each axis.
Array< T, Alloc > & 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, Alloc > 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 IPosition & shape() const
Get the shape.
const Array< Bool > & mask() const
Get the mask.
Bool hasMask() const
Is there a mask?
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.
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Get an array value for this node in the given row.
virtual MArray< String > getArrayString(const TableExprId &id)
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
virtual MArray< Double > getArrayDouble(const TableExprId &id)
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
TableExprNodeSetElem(const TableExprNodeSetElem &)
Copy constructor (copy semantics).
TableExprNodeSetElem(Bool isLeftClosed, const TableExprNode &start, const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous bounded interval.
TableExprNodeSetElem(const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous right-bounded interval.
void matchBool(Bool *match, const Bool *value, size_t nval, const TableExprId &id) const
Set a flag in the match output array if the corresponding element in the value array is included in t...
void fillVector(Vector< Double > &vec, Int64 &cnt, const TableExprId &id) const
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
TableExprNodeSetElem * evaluate(const TableExprId &id) const
Evaluate the element for the given row and construct a new (constant) element from it.
Bool isRightClosed() const
void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const
void checkTable()
Get the table of a node and check if the children use the same table.
void setup(Bool isLeftClosed, const TableExprNode *start, const TableExprNode *end, Bool isRightClosed)
Setup the object for a continuous interval.
void fillVector(Vector< String > &vec, Int64 &cnt, const TableExprId &id) const
TableExprNodeSetElem & operator=(const TableExprNodeSetElem &)
A copy of a TableExprNodeSetElem cannot be made.
const TENShPtr & end() const
void fillVector(Vector< DComplex > &vec, Int64 &cnt, const TableExprId &id) const
void fillVector(Vector< MVTime > &vec, Int64 &cnt, const TableExprId &id) const
TableExprNodeSetElem(const TableExprNode *start, const TableExprNode *end, const TableExprNode *incr, Bool isEndExcl=False)
Create the object for a discrete interval.
void matchDComplex(Bool *match, const DComplex *value, size_t nval, const TableExprId &id) const
void matchInt(Bool *match, const Int64 *value, size_t nval, const TableExprId &id) const
Bool isDiscrete() const
Is it a discrete set element.
const TENShPtr & increment() const
TableExprNodeSetElem(const TableExprNodeSetElem &that, const TENShPtr &start, const TENShPtr &end, const TENShPtr &incr)
Construct an element from the given parts and take over their pointers.
void fillVector(Vector< Bool > &vec, Int64 &cnt, const TableExprId &id) const
Fill a vector with the value(s) from this element by appending them at the end of the vector; the end...
void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const
Bool isSingle() const
Is a single value given?
virtual void adaptSetUnits(const Unit &)
Let a set node convert itself to the given unit.
Bool isLeftClosed() const
Is the interval left or right closed?
void show(ostream &os, uInt indent) const
Show the node.
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
void matchString(Bool *match, const String *value, size_t nval, const TableExprId &id) const
const TENShPtr & start() const
Get the start, end or increment expression.
TableExprNodeSetElem(const TableExprNode &node)
Create the object for a single expression node.
TableExprNodeSetElem(Bool isLeftClosed, const TableExprNode &start)
Create the object for a continuous left-bounded interval.
void fillVector(Vector< Int64 > &vec, Int64 &cnt, const TableExprId &id) const
Class to hold multiple table expression nodes.
TableExprNodeSet(const Vector< rownr_t > &rownrs, const TableExprNodeSet &)
Construct a set with n*set.size() elements where n is the number of rows.
virtual MArray< Bool > hasArrayInt(const TableExprId &id, const MArray< Int64 > &value)
virtual MArray< Bool > hasArrayDComplex(const TableExprId &id, const MArray< DComplex > &value)
Bool(TableExprNodeSet::* FindFuncPtr)(Double value)
Define the functions to find a double, which depend on open/closed-ness.
void add(const TableExprNodeSetElem &, Bool adaptType=False)
Add an element to the set.
virtual Bool hasInt(const TableExprId &id, Int64 value)
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Get an array value for this bounded set in the given row.
TENShPtr toConstArray() const
Convert the const set to an array.
void show(ostream &os, uInt indent) const
Show the node.
void getArray(MArray< DComplex > &marr, const TENShPtr &node, const TableExprId &id) const
Bool findOpenClosed(Double value)
void checkEqualDataTypes() const
Check if the data type of the set elements are the same.
virtual MArray< Bool > hasArrayDate(const TableExprId &id, const MArray< MVTime > &value)
TableExprNodeSet(const TableExprNodeSet &)
Bool isSingle() const
Contains the set only single elements? Single means that only single values are given (thus end nor i...
virtual MArray< Bool > hasArrayBool(const TableExprId &id, const MArray< Bool > &value)
void setFindFunc(Bool isLeftClosed, Bool isRightClosed)
Bool findClosedOpen(Double value)
void combineIntIntervals()
Sort and combine intervals.
Bool findClosedClosed(Double value)
void getArray(MArray< Int64 > &marr, const TENShPtr &node, const TableExprId &id) const
Bool findOpenOpen(Double value)
virtual Bool hasDate(const TableExprId &id, const MVTime &value)
const TableExprNodeSetElem & operator[](size_t index) const
Get the i-th element.
virtual MArray< Double > getArrayDouble(const TableExprId &id)
virtual Bool hasDComplex(const TableExprId &id, const DComplex &value)
virtual Bool hasBool(const TableExprId &id, Bool value)
Does a value occur in the set?
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
TableExprNodeSet(const Slicer &)
Construct from a Slicer.
void getArray(MArray< Double > &marr, const TENShPtr &node, const TableExprId &id) const
void combineDoubleIntervals()
void getArray(MArray< String > &marr, const TENShPtr &node, const TableExprId &id) const
virtual MArray< String > getArrayString(const TableExprId &id)
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
virtual MArray< Bool > hasArrayString(const TableExprId &id, const MArray< String > &value)
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
virtual void adaptSetUnits(const Unit &)
Let a set node convert itself to the given unit.
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?
void combineDateIntervals()
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)?
virtual Bool hasString(const TableExprId &id, const String &value)
MArray< T > toArray(const TableExprId &id) const
size_t nelements() const
For backward compatibility.
size_t size() const
Get the number of elements.
virtual Bool hasDouble(const TableExprId &id, Double value)
std::vector< TENShPtr > itsElems
TableExprNodeSet & operator=(const TableExprNodeSet &)
A copy of a TableExprNodeSet cannot be made.
void getArray(MArray< MVTime > &marr, const TENShPtr &node, const TableExprId &id) const
virtual MArray< Bool > hasArrayDouble(const TableExprId &id, const MArray< Double > &value)
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)
std::complex< Double > DComplex
const Double e
e and functions thereof:
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.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.