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