casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExprNodeSet.h
Go to the documentation of this file.
1 //# ExprNodeSet.h: Classes representing a set in table select expression
2 //# Copyright (C) 1997,2000,2001,2002,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: ExprNodeSet.h 21262 2012-09-07 12:38:36Z gervandiepen $
27 
28 #ifndef TABLES_EXPRNODESET_H
29 #define TABLES_EXPRNODESET_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
37 #include <vector>
38 
39 namespace casacore { //# NAMESPACE CASACORE - BEGIN
40 
41 //# Forward Declarations
42 class TableExprNode;
43 class IPosition;
44 class Slicer;
45 
46 // <summary>
47 // Class to hold the table expression nodes for an element in a set.
48 // </summary>
49 
50 // <use visibility=export>
51 
52 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
53 // </reviewed>
54 
55 // <prerequisite>
56 //# Classes you should understand before using this one.
57 // <li> TableExprNodeSet
58 // <li> TableExprNodeRep
59 // </prerequisite>
60 
61 // <synopsis>
62 // This class is used to assemble the table expression nodes
63 // representing an element in a set. A set element can be of 3 types:
64 // <ol>
65 // <li> A single discrete value, which can be of any type.
66 // It can be used for 3 purposes:
67 // <br>- A function argument.
68 // <br>- A single index in an array indexing operation.
69 // <br>- A single value in a set (used with the IN operator).
70 // This is in fact a bounded discrete interval (see below).
71 // <li> A discrete interval consisting of start, end and increment.
72 // Each of those has to be an int scalar. Increment defaults to 1.
73 // It can be used for 2 purposes:
74 // <br>- A slice in an array indexing operation. In that case start
75 // defaults to the beginning of the dimension and end defaults to the end.
76 // <br>- A discrete interval in a set. Start has to be given.
77 // When end is not given, the result is an unbounded discrete interval.
78 // For a discrete interval, the type of start and end can also be
79 // a datetime scalar.
80 // <li> A continuous interval, which can only be used in a set.
81 // It consists of a start and/or an end scalar value of type int, double,
82 // datetime, or string. The interval can be open or closed on one or
83 // both sides.
84 // </ol>
85 // Note the difference between a discrete and a continuous interval.
86 // E.g. the discrete interval 2,6 consists of the five values 2,3,4,5,6.
87 // The continuous interval 2,6 consists of all values between them.
88 // <br>Further note that a bounded discrete interval is automatically
89 // converted to a vector, which makes it possible to apply array
90 // functions to it.
91 // </synopsis>
92 
94 {
95 public:
96  // Create the object for a single expression node.
97  explicit TableExprNodeSetElem (const TableExprNode& node);
98 
99  // Create the object for a discrete interval.
100  // Each of the start, end, and incr pointers can be zero meaning
101  // that they are not given (see the synopsis for an explanation).
102  // Optionally the end is inclusive (C++ and Glish style) or exclusive
103  // (Python style).
105  const TableExprNode* end,
106  const TableExprNode* incr,
107  Bool isEndExcl = False);
108 
109  // Create the object for a continuous bounded interval. It can be
110  // open or closed on either side.
112  const TableExprNode& end, Bool isRightClosed);
113 
114  // Create the object for a continuous left-bounded interval.
115  TableExprNodeSetElem (Bool isLeftClosed, const TableExprNode& start);
116 
117  // Create the object for a continuous right-bounded interval.
118  TableExprNodeSetElem (const TableExprNode& end, Bool isRightClosed);
119 
120  // Copy constructor (copy semantics).
122 
124 
125  // Show the node.
126  void show (ostream& os, uInt indent) const;
127 
128  // Get the nodes representing an aggregate function.
129  virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
130 
131  // Get the nodes representing a table column.
132  virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
133 
134  // Is it a discrete set element.
135  Bool isDiscrete() const;
136 
137  // Is a single value given?
138  Bool isSingle() const;
139 
140  // Is the interval left or right closed?
141  // <group>
142  Bool isLeftClosed() const;
143  Bool isRightClosed() const;
144  // </group>
145 
146  // Get the start, end or increment expression.
147  // Note that the pointer returned can be zero indicating that that
148  // value was not given.
149  // <group>
150  const TENShPtr& start() const;
151  const TENShPtr& end() const;
152  const TENShPtr& increment() const;
153  // </group>
154 
155  // Fill a vector with the value(s) from this element by appending them
156  // at the end of the vector; the end is given by argument <src>cnt</src>
157  // which gets incremented with the number of values appended.
158  // This is used by the system to convert a set to a vector.
159  // <group>
160  void fillVector (Vector<Bool>& vec, Int64& cnt,
161  const TableExprId& id) const;
162  void fillVector (Vector<Int64>& vec, Int64& cnt,
163  const TableExprId& id) const;
164  void fillVector (Vector<Double>& vec, Int64& cnt,
165  const TableExprId& id) const;
166  void fillVector (Vector<DComplex>& vec, Int64& cnt,
167  const TableExprId& id) const;
168  void fillVector (Vector<String>& vec, Int64& cnt,
169  const TableExprId& id) const;
170  void fillVector (Vector<MVTime>& vec, Int64& cnt,
171  const TableExprId& id) const;
172  // </group>
173 
174  // Set a flag in the match output array if the corresponding element
175  // in the value array is included in this set element.
176  // This is used by the system to implement the IN operator.
177  // <br>Note that it does NOT set match values to False; it is assumed they
178  // are initialized that way.
179  // <group>
180  void matchBool (Bool* match, const Bool* value, size_t nval,
181  const TableExprId& id) const;
182  void matchInt (Bool* match, const Int64* value, size_t nval,
183  const TableExprId& id) const;
184  void matchDouble (Bool* match, const Double* value, size_t nval,
185  const TableExprId& id) const;
186  void matchDComplex (Bool* match, const DComplex* value, size_t nval,
187  const TableExprId& id) const;
188  void matchString (Bool* match, const String* value, size_t nval,
189  const TableExprId& id) const;
190  void matchDate (Bool* match, const MVTime* value, size_t nval,
191  const TableExprId& id) const;
192  // </group>
193 
194  // Evaluate the element for the given row and construct a new
195  // (constant) element from it.
196  // This is used by the system to implement a set in a GIVING clause.
197  TableExprNodeSetElem* evaluate (const TableExprId& id) const;
198 
199  // Get the table of a node and check if the children use the same table.
200  void checkTable();
201 
202  // Let a set node convert itself to the given unit.
203  virtual void adaptSetUnits (const Unit&);
204 
205 private:
206  // A copy of a TableExprNodeSetElem cannot be made.
208 
209  // Construct an element from the given parts and take over their pointers.
210  // It is used by evaluate to construct an element in a rather cheap way.
212  const TENShPtr& start, const TENShPtr& end,
213  const TENShPtr& incr);
214 
215  // Setup the object for a continuous interval.
216  void setup (Bool isLeftClosed, const TableExprNode* start,
217  const TableExprNode* end, Bool isRightClosed);
218 
219 
228 };
229 
230 
231 
233 {
234  return itsDiscrete;
235 }
237 {
238  return itsSingle;
239 }
241 {
242  return itsLeftClosed;
243 }
245 {
246  return itsRightClosed;
247 }
249 {
250  return itsStart;
251 }
252 inline const TENShPtr& TableExprNodeSetElem::end() const
253 {
254  return itsEnd;
255 }
257 {
258  return itsIncr;
259 }
260 
261 
262 
263 //# Define a macro to cast an itsElems to a TableExprNodeSetElem*.
264 #define castItsElem(i) static_cast<TableExprNodeSetElem*>(itsElems[i].get())
265 #define castSetElem(shptr) static_cast<TableExprNodeSetElem*>(shptr.get())
266 
267 
268 // <summary>
269 // Class to hold multiple table expression nodes.
270 // </summary>
271 
272 // <use visibility=export>
273 
274 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
275 // </reviewed>
276 
277 // <prerequisite>
278 //# Classes you should understand before using this one.
279 // <li> TableExprNode
280 // <li> TableExprNodeRep
281 // <li> TableExprNodeBinary
282 // </prerequisite>
283 
284 // <synopsis>
285 // This class is used to assemble several table expression nodes.
286 // It is used for 3 purposes:
287 // <ol>
288 // <li> To hold the arguments of a function.
289 // All set elements must be single.
290 // <li> To hold the variables of an index for an array slice.
291 // All set elements must be of type int scalar and they must
292 // represent a discrete interval (which includes single).
293 // <li> To hold the elements of a set used with the IN operator.
294 // All set elements must be scalars of any type.
295 // </ol>
296 // The type of all set elements has to be the same.
297 // The set consists of
298 // <linkto class=TableExprNodeSetElem>TableExprNodeSetElem</linkto>
299 // elements. The <src>add</src> function has to be used to
300 // add an element to the set.
301 // <p>
302 // It is possible to construct the object directly from an
303 // <linkto class=IPosition>IPosition</linkto> object.
304 // In that case all elements are single.
305 // Furthermore it is possible to construct it directly from a
306 // <linkto class=Slicer>Slicer</linkto> object.
307 // In that case all elements represent a discrete interval.
308 // </synopsis>
309 
311 {
312 public:
313  // Construct an empty set.
315 
316  // Construct from an <src>IPosition</src>.
317  // The number of elements in the set is the number of elements
318  // in the <src>IPosition</src>. All set elements are single values.
319  TableExprNodeSet (const IPosition&);
320 
321  // Construct from a <src>Slicer</src>.
322  // The number of elements in the set is the dimensionality
323  // of the <src>Slicer</src>. All set elements are discrete intervals.
324  // Their start and/or end is undefined if it is was not defined
325  // (i.e. Slicer::MimicSource used) in the <src>Slicer</src> object.
326  TableExprNodeSet (const Slicer&);
327 
328  // Construct a set with n*set.size() elements where n is the number
329  // of rows.
330  // Element i is constructed by evaluating the input element
331  // for row rownr[i].
332  TableExprNodeSet (const Vector<rownr_t>& rownrs, const TableExprNodeSet&);
333 
335 
337 
338  // Add an element to the set.
339  // If adaptType=True, the data type is the highest of the elements added.
340  // Otherwise it is that of the first element.
341  // True is meant for a set of values, False for function arguments.
342  void add (const TableExprNodeSetElem&, Bool adaptType=False);
343 
344  // Show the node.
345  void show (ostream& os, uInt indent) const;
346 
347  // Get the nodes representing an aggregate function.
348  virtual void getAggrNodes (std::vector<TableExprNodeRep*>& aggr);
349 
350  // Get the nodes representing a table column.
351  virtual void getColumnNodes (std::vector<TableExprNodeRep*>& cols);
352 
353  // Check if the data type of the set elements are the same.
354  // If not, an exception is thrown.
355  //# Note that if itsCheckTypes is set, the data types are already
356  //# known to be equal.
357  void checkEqualDataTypes() const;
358 
359  // Contains the set only single elements?
360  // Single means that only single values are given (thus end nor incr).
361  Bool isSingle() const;
362 
363  // Contains the set only discrete elements?
364  // Discrete means that no continuous ranges are given, but discrete
365  // ranges (using :) are possible.
366  Bool isDiscrete() const;
367 
368  // Is the set fully bounded (discrete and no undefined end values)?
369  Bool isBounded() const;
370 
371  // Get the number of elements.
372  size_t size() const;
373  // For backward compatibility.
374  size_t nelements() const {return size();}
375 
376  // Get the i-th element.
377  const TableExprNodeSetElem& operator[] (size_t index) const;
378 
379  // Contains the set array values?
380  Bool hasArrays() const;
381 
382  // Try to convert the set to an array.
383  // If not possible, a copy of the set is returned.
384  TENShPtr setOrArray() const;
385 
386  template<typename T>
387  MArray<T> toArray (const TableExprId& id) const;
388 
389  // Get an array value for this bounded set in the given row.
390  // <group>
391  virtual MArray<Bool> getArrayBool (const TableExprId& id);
392  virtual MArray<Int64> getArrayInt (const TableExprId& id);
393  virtual MArray<Double> getArrayDouble (const TableExprId& id);
394  virtual MArray<DComplex> getArrayDComplex (const TableExprId& id);
395  virtual MArray<String> getArrayString (const TableExprId& id);
396  virtual MArray<MVTime> getArrayDate (const TableExprId& id);
397  // </group>
398 
399  // Does a value occur in the set?
400  // <group>
401  virtual Bool hasBool (const TableExprId& id, Bool value);
402  virtual Bool hasInt (const TableExprId& id, Int64 value);
403  virtual Bool hasDouble (const TableExprId& id, Double value);
404  virtual Bool hasDComplex (const TableExprId& id, const DComplex& value);
405  virtual Bool hasString (const TableExprId& id, const String& value);
406  virtual Bool hasDate (const TableExprId& id, const MVTime& value);
407  virtual MArray<Bool> hasArrayBool (const TableExprId& id,
408  const MArray<Bool>& value);
409  virtual MArray<Bool> hasArrayInt (const TableExprId& id,
410  const MArray<Int64>& value);
411  virtual MArray<Bool> hasArrayDouble (const TableExprId& id,
412  const MArray<Double>& value);
413  virtual MArray<Bool> hasArrayDComplex (const TableExprId& id,
414  const MArray<DComplex>& value);
415  virtual MArray<Bool> hasArrayString (const TableExprId& id,
416  const MArray<String>& value);
417  virtual MArray<Bool> hasArrayDate (const TableExprId& id,
418  const MArray<MVTime>& value);
419  // </group>
420 
421  // Let a set node convert itself to the given unit.
422  virtual void adaptSetUnits (const Unit&);
423 
424 private:
425  // A copy of a TableExprNodeSet cannot be made.
427 
428  // Convert the const set to an array.
429  TENShPtr toConstArray() const;
430 
431  // Get the array in a templated way.
432  // <group>
433  void getArray (MArray<Bool>& marr, const TENShPtr& node,
434  const TableExprId& id) const
435  { marr.reference (node->getArrayBool (id)); }
436  void getArray (MArray<Int64>& marr, const TENShPtr& node,
437  const TableExprId& id) const
438  { marr.reference (node->getArrayInt (id)); }
439  void getArray (MArray<Double>& marr, const TENShPtr& node,
440  const TableExprId& id) const
441  { marr.reference (node->getArrayDouble (id)); }
442  void getArray (MArray<DComplex>& marr, const TENShPtr& node,
443  const TableExprId& id) const
444  { marr.reference (node->getArrayDComplex (id)); }
445  void getArray (MArray<String>& marr, const TENShPtr& node,
446  const TableExprId& id) const
447  { marr.reference (node->getArrayString (id)); }
448  void getArray (MArray<MVTime>& marr, const TENShPtr& node,
449  const TableExprId& id) const
450  { marr.reference (node->getArrayDate (id)); }
451  // </group>
452 
453  // Sort and combine intervals.
454  // <group>
455  void combineIntIntervals();
456  void combineDoubleIntervals();
457  void combineDateIntervals();
458  // </group>
459 
460  // Define the functions to find a double, which depend on open/closed-ness.
461  // In this way a test on open/closed is done only once.
462  // <group>
468  void setFindFunc (Bool isLeftClosed, Bool isRightClosed);
469  // </group>
470 
471  std::vector<TENShPtr> itsElems;
474  Bool itsBounded; //# Set is discrete and all starts/ends are defined
475  Bool itsCheckTypes; //# True = checking data types is not needed
476  Bool itsAllIntervals; //# True = all elements are const intervals (sorted)
477  Block<Double> itsStart; //# Start values of const intervals
478  Block<Double> itsEnd; //# End values of const intervals
479  FindFuncPtr itsFindFunc; //# Function to find a matching const interval
480 };
481 
482 
484 {
485  return itsSingle;
486 }
488 {
489  return itsDiscrete;
490 }
492 {
493  return itsBounded;
494 }
495 inline size_t TableExprNodeSet::size() const
496 {
497  return itsElems.size();
498 }
499 inline const TableExprNodeSetElem&
500  TableExprNodeSet::operator[] (size_t index) const
501 {
502  return *castItsElem(index);
503 }
504 
505 
506 template<typename T>
508 {
511  Int64 n = size();
512  if (hasArrays()) {
513  // Handle a nested array; this is done recursively.
514  MArray<T> marr;
515  getArray (marr, castItsElem(0)->start(), id);
516  if (marr.isNull()) {
517  return marr;
518  }
519  Array<T> result (marr.array());
520  Array<Bool> mask (marr.mask());
521  IPosition shp = result.shape();
522  uInt naxes = shp.size();
523  shp.append (IPosition(1,n));
524  IPosition maskShp(shp);
525  maskShp[maskShp.size()-1] = 1;
526  result.resize (shp, True);
527  if (! mask.empty()) {
528  mask.resize (shp, True);
529  }
530  // Iterate through the remaining arrays.
531  ArrayIterator<T> iter(result, shp.size()-1);
532  IPosition s(shp.size(), 0);
533  IPosition e(shp-1);
534  e[naxes] = 0;
535  for (Int64 i=1; i<n; i++) {
536  iter.next();
537  s[naxes]++;
538  e[naxes]++;
539  MArray<T> marr;
540  getArray (marr, castItsElem(i)->start(), id);
541  if (marr.isNull()) {
542  return marr;
543  }
544  if (! marr.shape().isEqual (iter.array().shape())) {
545  throw TableInvExpr("Shapes of nested arrays do not match");
546  }
547  iter.array() = marr.array();
548  if (marr.hasMask()) {
549  if (mask.empty()) {
550  // The first time a mask was found, so create the resulting mask.
551  mask.resize (shp);
552  mask = False;
553  }
554  mask(s,e) = marr.mask().reform(maskShp);
555  } else if (! mask.empty()) {
556  // This array has no mask, so set to False in resulting mask.
557  mask(s,e) = False;
558  }
559  }
560  return MArray<T>(result, mask);
561  } else {
562  // Combine scalars.
563  Int64 n = size();
564  Int64 cnt = 0;
565  Vector<T> result (n);
566  for (Int64 i=0; i<n; i++) {
567  castItsElem(i)->fillVector (result, cnt, id);
568  }
569  result.resize (cnt, True);
570  return MArray<T>(result);
571  }
572 }
573 
574 
575 
576 } //# NAMESPACE CASACORE - END
577 
578 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
Bool isSingle() const
Is a single value given?
Definition: ExprNodeSet.h:236
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
Class to handle an Array with an optional mask.
Definition: ExprNode.h:57
void matchDComplex(Bool *match, const DComplex *value, size_t nval, const TableExprId &id) const
void show(ostream &os, uInt indent) const
Show the node.
virtual void getColumnNodes(std::vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
Block< Double > itsEnd
Definition: ExprNodeSet.h:478
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.
size_t nelements() const
For backward compatibility.
Definition: ExprNodeSet.h:374
Bool isNull() const
Is the array null?
Definition: MArrayBase.h:111
virtual Bool hasString(const TableExprId &id, const String &value)
void matchInt(Bool *match, const Int64 *value, size_t nval, const TableExprId &id) const
virtual MArray< Bool > getArrayBool(const TableExprId &id)
Get an array value for this node in the given row.
Class to hold multiple table expression nodes.
Definition: ExprNodeSet.h:310
Handle class for a table column expression tree.
Definition: ExprNode.h:156
virtual MArray< MVTime > getArrayDate(const TableExprId &id)
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
Bool findClosedOpen(Double value)
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...
void matchString(Bool *match, const String *value, size_t nval, const TableExprId &id) const
Bool isBounded() const
Is the set fully bounded (discrete and no undefined end values)?
Definition: ExprNodeSet.h:491
#define castItsElem(i)
Definition: ExprNodeSet.h:264
void reference(const MArray< T > &other)
Reference another array.
Definition: MArray.h:114
void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const
Abstract base class for a node in a table column expression tree.
Definition: ExprNodeRep.h:157
virtual MArray< Bool > hasArrayDouble(const TableExprId &id, const MArray< Double > &value)
const TableExprNodeSetElem & operator[](size_t index) const
Get the i-th element.
Definition: ExprNodeSet.h:500
const TENShPtr & end() const
Definition: ExprNodeSet.h:252
void checkTable()
Get the table of a node and check if the children use the same table.
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...
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.
Definition: ExprNodeSet.h:463
Bool hasArrays() const
Contains the set array values?
Iterate an Array cursor through another Array.
Definition: ArrayFwd.h:18
TableExprNodeSet & operator=(const TableExprNodeSet &)
A copy of a TableExprNodeSet cannot be made.
virtual void next() override
Move the cursor to the next position.
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)
defines physical units
Definition: Unit.h:189
virtual MArray< Double > getArrayDouble(const TableExprId &id)
virtual MArray< DComplex > getArrayDComplex(const TableExprId &id)
size_t size() const
Definition: IPosition.h:572
void getArray(MArray< MVTime > &marr, const TENShPtr &node, const TableExprId &id) const
Definition: ExprNodeSet.h:448
void checkEqualDataTypes() const
Check if the data type of the set elements are the same.
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
Definition: ExprNodeSet.h:507
virtual MArray< String > getArrayString(const TableExprId &id)
virtual MArray< DComplex > getArrayDComplex(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.
Definition: ExprNodeSet.h:93
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.
double Double
Definition: aipstype.h:55
void getArray(MArray< DComplex > &marr, const TENShPtr &node, const TableExprId &id) const
Definition: ExprNodeSet.h:442
void getArray(MArray< Double > &marr, const TENShPtr &node, const TableExprId &id) const
Definition: ExprNodeSet.h:439
TableExprNodeSetElem(const TableExprNode &node)
Create the object for a single expression node.
void getArray(MArray< Int64 > &marr, const TENShPtr &node, const TableExprId &id) const
Definition: ExprNodeSet.h:436
Bool findClosedClosed(Double value)
#define DebugAssert(expr, exception)
Definition: Assert.h:185
TENShPtr setOrArray() const
Try to convert the set to an array.
Bool isDiscrete() const
Is it a discrete set element.
Definition: ExprNodeSet.h:232
const TENShPtr & start() const
Get the start, end or increment expression.
Definition: ExprNodeSet.h:248
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Block< Double > itsStart
Definition: ExprNodeSet.h:477
virtual MArray< Bool > hasArrayDComplex(const TableExprId &id, const MArray< DComplex > &value)
std::vector< TENShPtr > itsElems
Definition: ExprNodeSet.h:471
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
Definition: ExprNodeSet.h:445
Bool isDiscrete() const
Contains the set only discrete elements? Discrete means that no continuous ranges are given...
Definition: ExprNodeSet.h:487
const Bool False
Definition: aipstype.h:44
Bool isSingle() const
Contains the set only single elements? Single means that only single values are given (thus end nor i...
Definition: ExprNodeSet.h:483
virtual MArray< Int64 > getArrayInt(const TableExprId &id)
size_t size() const
Get the number of elements.
Definition: ExprNodeSet.h:495
void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:288
void resize(size_t len, bool copyValues=false)
Definition: Vector.h:168
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.
Definition: ExprNodeSet.h:433
const Array< T > & array() const
Get access to the array.
Definition: MArray.h:153
Bool findOpenClosed(Double value)
virtual MArray< Bool > hasArrayBool(const TableExprId &id, const MArray< Bool > &value)
The identification of a TaQL selection subject.
Definition: TableExprId.h:97
virtual void getAggrNodes(std::vector< TableExprNodeRep * > &aggr)
Get the nodes representing an aggregate function.
Base class for all Casacore library errors.
Definition: Error.h:134
const Double e
e and functions thereof:
void resize(size_t newSize, bool copy=true)
Old values are copied on resize if copy==true.
const TENShPtr & increment() const
Definition: ExprNodeSet.h:256
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?
Definition: MArrayBase.h:119
virtual MArray< String > getArrayString(const TableExprId &id)
String: the storage and methods of handling collections of characters.
Definition: String.h:225
virtual MArray< Bool > hasArrayDate(const TableExprId &id, const MArray< MVTime > &value)
TENShPtr toConstArray() const
Convert the const set to an array.
size_t size() const
Definition: ArrayBase.h:105
Class to handle date/time type conversions and I/O.
Definition: MVTime.h:270
Bool isLeftClosed() const
Is the interval left or right closed?
Definition: ExprNodeSet.h:240
TableExprNodeSetElem & operator=(const TableExprNodeSetElem &)
A copy of a TableExprNodeSetElem cannot be made.
const Bool True
Definition: aipstype.h:43
Table error; invalid select expression.
Definition: TableError.h:460
const IPosition & shape() const
Get the shape.
Definition: MArrayBase.h:147
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)
unsigned int uInt
Definition: aipstype.h:51
void add(const TableExprNodeSetElem &, Bool adaptType=False)
Add an element to the set.
const Array< Bool > & mask() const
Get the mask.
Definition: MArrayBase.h:126
TableExprNodeSet()
Construct an empty set.