28 #ifndef TABLES_EXPRNODESET_H
29 #define TABLES_EXPRNODESET_H
44 template<
class T>
class Vector;
127 void show (ostream& os,
uInt indent)
const;
130 virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
133 virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
265 #define castItsElem(i) static_cast<TableExprNodeSetElem*>(itsElems[i].get())
266 #define castSetElem(shptr) static_cast<TableExprNodeSetElem*>(shptr.get())
346 void show (ostream& os,
uInt indent)
const;
349 virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
352 virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
436 { marr.
reference (node->getArrayBool (
id)); }
439 { marr.
reference (node->getArrayInt (
id)); }
442 { marr.
reference (node->getArrayDouble (
id)); }
445 { marr.
reference (node->getArrayDComplex (
id)); }
448 { marr.
reference (node->getArrayString (
id)); }
451 { marr.
reference (node->getArrayDate (
id)); }
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");
548 iter.array() = marr.
array();
556 }
else if (!
mask.empty()) {
567 for (
Int64 i=0; i<n; i++) {
A Vector of integers, for indexing into Array<T> objects.
Bool isSingle() const
Is a single value given?
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Class to handle an Array with an optional mask.
std::vector< double > Vector
void show(ostream &os, uInt indent) const
Show the node.
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
virtual MArray< Double > getArrayDouble(const TableExprId &id)
virtual Bool hasInt(const TableExprId &id, Int64 value)
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
Bool isNull() const
Is the array null?
virtual Bool hasString(const TableExprId &id, const String &value)
const TableExprNodeSetElem & operator[](uInt index) const
Get the i-th element.
Class to hold multiple table expression nodes.
Handle class for a table column expression tree.
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
Bool findClosedOpen(Double value)
void combineDoubleIntervals()
Bool isBounded() const
Is the set fully bounded (discrete and no undefined end values)?
void matchDouble(Bool *match, const Double *value, uInt nval, const TableExprId &id) const
void reference(const MArray< T > &other)
Reference another array.
Abstract base class for a node in a table column expression tree.
virtual MArray< Bool > hasArrayDouble(const TableExprId &id, const MArray< Double > &value)
void matchDComplex(Bool *match, const DComplex *value, uInt nval, const TableExprId &id) const
const TENShPtr & end() const
void checkTable()
Get the table of a node and check if the children use the same table.
virtual void adaptSetUnits(const Unit &)
Let a set node convert itself to the given unit.
Bool(TableExprNodeSet::* FindFuncPtr)(Double value)
Define the functions to find a double, which depend on open/closed-ness.
Bool hasArrays() const
Contains the set array values?
Iterate an Array cursor through another Array.
uInt size() const
Get the number of elements.
TableExprNodeSet & operator=(const TableExprNodeSet &)
A copy of a TableExprNodeSet cannot be made.
void matchDate(Bool *match, const MVTime *value, uInt nval, const TableExprId &id) const
virtual void adaptSetUnits(const Unit &)
Let a set node convert itself to the given unit.
virtual MArray< Bool > hasArrayString(const TableExprId &id, const MArray< String > &value)
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
void getArray(MArray< MVTime > &marr, const TENShPtr &node, const TableExprId &id) const
void checkEqualDataTypes() const
Check if the data type of the set elements are the same.
void matchString(Bool *match, const String *value, uInt nval, const TableExprId &id) const
void combineDateIntervals()
void combineIntIntervals()
Sort and combine intervals.
Bool findOpenOpen(Double value)
virtual Bool hasDComplex(const TableExprId &id, const DComplex &value)
MArray< T > toArray(const TableExprId &id) const
virtual MArray< String > getArrayString(const TableExprId &id)
virtual Bool hasBool(const TableExprId &id, Bool value)
Does a value occur in the set?
Class to hold the table expression nodes for an element in a set.
TableExprNodeSetElem * evaluate(const TableExprId &id) const
Evaluate the element for the given row and construct a new (constant) element from it...
void setFindFunc(Bool isLeftClosed, Bool isRightClosed)
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
std::complex< Double > DComplex
void getArray(MArray< DComplex > &marr, const TENShPtr &node, const TableExprId &id) const
void getArray(MArray< Double > &marr, const TENShPtr &node, const TableExprId &id) const
TableExprNodeSetElem(const TableExprNode &node)
Create the object for a single expression node.
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
Bool findClosedClosed(Double value)
#define DebugAssert(expr, exception)
TENShPtr setOrArray() const
Try to convert the set to an array.
Bool isRightClosed() const
Bool isDiscrete() const
Is it a discrete set element.
const TENShPtr & start() const
Get the start, end or increment expression.
virtual void next()
Move the cursor to the next position.
bool Bool
Define the standard types used by Casacore.
virtual MArray< Bool > hasArrayDComplex(const TableExprId &id, const MArray< DComplex > &value)
std::vector< TENShPtr > itsElems
void matchInt(Bool *match, const Int64 *value, uInt nval, const TableExprId &id) const
void setup(Bool isLeftClosed, const TableExprNode *start, const TableExprNode *end, Bool isRightClosed)
Setup the object for a continuous interval.
virtual MArray< Bool > hasArrayInt(const TableExprId &id, const MArray< Int64 > &value)
void getArray(MArray< String > &marr, const TENShPtr &node, const TableExprId &id) const
Bool isDiscrete() const
Contains the set only discrete elements? Discrete means that no continuous ranges are given...
Bool isSingle() const
Contains the set only single elements? Single means that only single values are given (thus end nor i...
template <class T, class U> class vector;
Specify which elements to extract from an n-dimensional array.
virtual Bool hasDate(const TableExprId &id, const MVTime &value)
void show(ostream &os, uInt indent) const
Show the node.
void getArray(MArray< Bool > &marr, const TENShPtr &node, const TableExprId &id) const
Get the array in a templated way.
const Array< T > & array() const
Get access to the array.
Bool findOpenClosed(Double value)
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...
virtual MArray< Bool > hasArrayBool(const TableExprId &id, const MArray< Bool > &value)
The identification of a TaQL selection subject.
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
Base class for all Casacore library errors.
const Double e
e and functions thereof:
const TENShPtr & increment() const
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...
Bool hasMask() const
Is there a mask?
String: the storage and methods of handling collections of characters.
virtual MArray< Bool > hasArrayDate(const TableExprId &id, const MArray< MVTime > &value)
void resize(uInt newSize, Bool copy=True)
Old values are copied on resize if copy==True.
TENShPtr toConstArray() const
Convert the const set to an array.
void resize(size_t len, Bool copyValues=False)
Class to handle date/time type conversions and I/O.
Bool isLeftClosed() const
Is the interval left or right closed?
TableExprNodeSetElem & operator=(const TableExprNodeSetElem &)
A copy of a TableExprNodeSetElem cannot be made.
Table error; invalid select expression.
const IPosition & shape() const
Get the shape.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Get an array value for this bounded set in the given row.
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
virtual Bool hasDouble(const TableExprId &id, Double value)
void add(const TableExprNodeSetElem &, Bool adaptType=False)
Add an element to the set.
uInt nelements() const
For backward compatibility.
const Array< Bool > & mask() const
Get the mask.
TableExprNodeSet()
Construct an empty set.
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.