Go to the documentation of this file.
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/Containers/Block.h>
44 template<
class T>
class Vector;
265 #define castItsElem(i) static_cast<TableExprNodeSetElem*>(itsElems[i].get())
266 #define castSetElem(shptr) static_cast<TableExprNodeSetElem*>(shptr.get())
526 maskShp[maskShp.
size()-1] = 1;
528 if (!
mask.empty()) {
536 for (
Int64 i=1; i<n; i++) {
545 if (! marr.shape().isEqual (iter.
array().shape())) {
546 throw TableInvExpr(
"Shapes of nested arrays do not match");
549 if (marr.hasMask()) {
555 mask(s,
e) = marr.mask().reform(maskShp);
556 }
else if (!
mask.empty()) {
567 for (
Int64 i=0; i<n; i++) {
virtual MArray< String > getArrayString(const TableExprId &id)
void fillVector(Vector< Double > &vec, Int64 &cnt, const TableExprId &id) const
virtual MArray< Bool > hasArrayDate(const TableExprId &id, const MArray< MVTime > &value)
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
void fillVector(Vector< Int64 > &vec, Int64 &cnt, const TableExprId &id) const
TableExprNodeSetElem(const TableExprNodeSetElem &)
Copy constructor (copy semantics).
void reference(const MArray< T > &other)
Reference another array.
Table error; invalid select expression.
TableExprNodeSet & operator=(const TableExprNodeSet &)
A copy of a TableExprNodeSet cannot be made.
TableExprNodeSetElem & operator=(const TableExprNodeSetElem &)
A copy of a TableExprNodeSetElem cannot be made.
TableExprNodeSetElem * evaluate(const TableExprId &id) const
Evaluate the element for the given row and construct a new (constant) element from it.
void matchDouble(Bool *match, const Double *value, uInt nval, const TableExprId &id) const
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Get an array value for this bounded set in the given row.
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...
TableExprNodeSet()
Construct an empty set.
void fillVector(Vector< DComplex > &vec, Int64 &cnt, const TableExprId &id) const
std::complex< Double > DComplex
virtual void adaptSetUnits(const Unit &)
Let a set node convert itself to the given unit.
void combineIntIntervals()
Sort and combine intervals.
const TableExprNodeSetElem & operator[](uInt index) const
Get the i-th element.
void checkEqualDataTypes() const
Check if the data type of the set elements are the same.
Bool hasArrays() const
Contains the set array values?
void getArray(MArray< DComplex > &marr, const TENShPtr &node, const TableExprId &id) const
Bool findOpenOpen(Double value)
virtual MArray< Bool > hasArrayBool(const TableExprId &id, const MArray< Bool > &value)
void matchDate(Bool *match, const MVTime *value, uInt nval, const TableExprId &id) const
MArray< T > toArray(const TableExprId &id) const
TableExprNodeSetElem(const TableExprNode &node)
Create the object for a single expression node.
virtual Bool hasDouble(const TableExprId &id, Double value)
Bool isSingle() const
Contains the set only single elements? Single means that only single values are given (thus end nor i...
virtual MArray< Bool > hasArrayString(const TableExprId &id, const MArray< String > &value)
virtual void resize()
Make this array a different shape.
void combineDateIntervals()
virtual MArray< Bool > hasArrayDComplex(const TableExprId &id, const MArray< DComplex > &value)
TableExprNodeSetElem(const TableExprNode *start, const TableExprNode *end, const TableExprNode *incr, Bool isEndExcl=False)
Create the object for a discrete interval.
std::vector< TENShPtr > itsElems
TENShPtr toConstArray() const
Convert the const set to an array.
TableExprNodeSet(const Vector< uInt > &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)
void matchBool(Bool *match, const Bool *value, uInt 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 getArray(MArray< Int64 > &marr, const TENShPtr &node, const TableExprId &id) const
void show(ostream &os, uInt indent) const
Show the node.
void resize(size_t len, Bool copyValues=False)
void getArray(MArray< Double > &marr, const TENShPtr &node, const TableExprId &id) const
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
virtual Bool hasDate(const TableExprId &id, const MVTime &value)
void checkTable()
Get the table of a node and check if the children use the same table.
uInt size() const
Get the number of elements.
TableExprNodeSetElem(Bool isLeftClosed, const TableExprNode &start, const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous bounded interval.
const IPosition & shape() const
The length of each axis.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
const TENShPtr & increment() const
#define DebugAssert(expr, exception)
TableExprNodeSetElem(const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous right-bounded interval.
void show(ostream &os, uInt indent) const
Show the node.
Bool findOpenClosed(Double value)
Bool isRightClosed() const
void getArray(MArray< String > &marr, const TENShPtr &node, const TableExprId &id) const
void matchInt(Bool *match, const Int64 *value, uInt nval, const TableExprId &id) const
Bool isBounded() const
Is the set fully bounded (discrete and no undefined end values)?
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
Bool isSingle() const
Is a single value given?
uInt nelements() const
For backward compatibility.
Bool findClosedOpen(Double value)
virtual void adaptSetUnits(const Unit &)
Let a set node convert itself to the given unit.
TableExprNodeSet(const TableExprNodeSet &)
virtual MArray< Double > getArrayDouble(const TableExprId &id)
virtual Bool hasInt(const TableExprId &id, Int64 value)
virtual MArray< Double > getArrayDouble(const TableExprId &id)
void setup(Bool isLeftClosed, const TableExprNode *start, const TableExprNode *end, Bool isRightClosed)
Setup the object for a continuous interval.
this file contains all the compiler specific defines
void matchString(Bool *match, const String *value, uInt nval, const TableExprId &id) const
virtual Bool hasDComplex(const TableExprId &id, const DComplex &value)
const Array< T > & array() const
Get access to the array.
const TENShPtr & start() const
Get the start, end or increment expression.
virtual Bool hasBool(const TableExprId &id, Bool value)
Does a value occur in the set?
virtual void next()
Move the cursor to the next position.
Class to hold multiple table expression nodes.
virtual MArray< Bool > hasArrayDouble(const TableExprId &id, const MArray< Double > &value)
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
void add(const TableExprNodeSetElem &, Bool adaptType=False)
Add an element to the set.
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.
const Double e
e and functions thereof:
TableExprNodeSet(const IPosition &)
Construct from an IPosition.
void fillVector(Vector< MVTime > &vec, Int64 &cnt, const TableExprId &id) const
TableExprNodeSet(const Slicer &)
Construct from a Slicer.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
Abstract base class for a node in a table column expression tree.
template <class T, class U> class vector;
void matchDComplex(Bool *match, const DComplex *value, uInt nval, const TableExprId &id) const
Array< T > & array()
Return the cursor.
Bool isDiscrete() const
Is it a discrete set element.
String: the storage and methods of handling collections of characters.
TableExprNodeSetElem(Bool isLeftClosed, const TableExprNode &start)
Create the object for a continuous left-bounded interval.
bool Bool
Define the standard types used by Casacore.
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
void getArray(MArray< MVTime > &marr, const TENShPtr &node, const TableExprId &id) const
void append(const IPosition &other)
Append this IPosition with another one (causing a resize).
void getArray(MArray< Bool > &marr, const TENShPtr &node, const TableExprId &id) const
Get the array in a templated way.
virtual Bool hasString(const TableExprId &id, const String &value)
TENShPtr setOrArray() const
Try to convert the set to an array.
Bool isLeftClosed() const
Is the interval left or right closed?
Bool isDiscrete() const
Contains the set only discrete elements? Discrete means that no continuous ranges are given,...
Bool findClosedClosed(Double value)
const TENShPtr & end() const
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
Bool(TableExprNodeSet::* FindFuncPtr)(Double value)
Define the functions to find a double, which depend on open/closed-ness.
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
void setFindFunc(Bool isLeftClosed, Bool isRightClosed)
void fillVector(Vector< String > &vec, Int64 &cnt, const TableExprId &id) const
virtual MArray< String > getArrayString(const TableExprId &id)
void combineDoubleIntervals()
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Get an array value for this node in the given row.