casacore
ExprNodeArray.h
Go to the documentation of this file.
1 //# ExprNodeArray.h: Classes representing an array in table select expression
2 //# Copyright (C) 1997,1999,2000,2001
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$
27 
28 #ifndef TABLES_EXPRNODEARRAY_H
29 #define TABLES_EXPRNODEARRAY_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/tables/TaQL/ExprNodeRep.h>
34 #include <casacore/tables/TaQL/TaQLStyle.h>
35 #include <casacore/tables/Tables/Table.h>
36 #include <casacore/tables/Tables/ArrayColumn.h>
37 #include <casacore/casa/Arrays/Slicer.h>
38 
39 namespace casacore { //# NAMESPACE CASACORE - BEGIN
40 
41 //# Forward Declarations
42 class TableExprNodeSet;
43 
44 
45 // <summary>
46 // Base class for arrays in table select expression
47 // </summary>
48 
49 // <use visibility=local>
50 
51 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
52 // </reviewed>
53 
54 // <prerequisite>
55 //# Classes you should understand before using this one.
56 // <li> TableExprNode
57 // <li> TableExprNodeRep
58 // <li> TableExprNodeBinary
59 // </prerequisite>
60 
61 // <synopsis>
62 // This class is the base class to represent an array.
63 // The actual storing of the array column is done by its derivations.
64 // </synopsis>
65 
67 {
68 public:
69  // Create the object.
70  // <group>
74  // </group>
75 
77 
78  // Turn a constant array with one element into a scalar.
79  // It returns a zero pointer if not possible.
80  // The default implementation returns 0.
82 
83  // Get the shape of the array in the given row.
84  // This default implementation evaluates the value and returns its shape.
85  virtual const IPosition& getShape (const TableExprId& id);
86 
87  // The default implementation of getArrayDouble does
88  // getArrayInt and converts the result.
89  virtual Array<Double> getArrayDouble (const TableExprId& id);
90 
91  // The default implementation of getArrayDComplex does
92  // getArrayDouble and converts the result.
93  virtual Array<DComplex> getArrayDComplex (const TableExprId& id);
94 
95  // Does a value occur in the set?
96  // <group>
97  virtual Bool hasBool (const TableExprId& id, Bool value);
98  virtual Bool hasInt (const TableExprId& id, Int64 value);
99  virtual Bool hasDouble (const TableExprId& id, Double value);
100  virtual Bool hasDComplex (const TableExprId& id, const DComplex& value);
101  virtual Bool hasString (const TableExprId& id, const String& value);
102  virtual Bool hasDate (const TableExprId& id, const MVTime& value);
103  virtual Array<Bool> hasArrayBool (const TableExprId& id,
104  const Array<Bool>& value);
105  virtual Array<Bool> hasArrayInt (const TableExprId& id,
106  const Array<Int64>& value);
107  virtual Array<Bool> hasArrayDouble (const TableExprId& id,
108  const Array<Double>& value);
109  virtual Array<Bool> hasArrayDComplex (const TableExprId& id,
110  const Array<DComplex>& value);
111  virtual Array<Bool> hasArrayString (const TableExprId& id,
112  const Array<String>& value);
113  virtual Array<Bool> hasArrayDate (const TableExprId& id,
114  const Array<MVTime>& value);
115  // </group>
116 
117  // Get a single element from the array in the given row.
118  // <group>
119  virtual Bool getElemBool (const TableExprId& id,
120  const Slicer& index);
121  virtual Int64 getElemInt (const TableExprId& id,
122  const Slicer& index);
123  virtual Double getElemDouble (const TableExprId& id,
124  const Slicer& index);
125  virtual DComplex getElemDComplex (const TableExprId& id,
126  const Slicer& index);
127  virtual String getElemString (const TableExprId& id,
128  const Slicer& index);
129  virtual MVTime getElemDate (const TableExprId& id,
130  const Slicer& index);
131  // </group>
132 
133  // Get a slice of the array in the given row.
134  // <group>
135  virtual Array<Bool> getSliceBool (const TableExprId& id,
136  const Slicer&);
137  virtual Array<Int64> getSliceInt (const TableExprId& id,
138  const Slicer&);
139  virtual Array<Double> getSliceDouble (const TableExprId& id,
140  const Slicer&);
141  virtual Array<DComplex> getSliceDComplex (const TableExprId& id,
142  const Slicer&);
143  virtual Array<String> getSliceString (const TableExprId& id,
144  const Slicer&);
145  virtual Array<MVTime> getSliceDate (const TableExprId& id,
146  const Slicer&);
147  // </group>
148 
149  // Get a single element for the entire column (used by sort).
150  // <group>
151  virtual Array<Bool> getElemColumnBool (const Vector<uInt>& rownrs,
152  const Slicer&);
153  virtual Array<uChar> getElemColumnuChar (const Vector<uInt>& rownrs,
154  const Slicer&);
155  virtual Array<Short> getElemColumnShort (const Vector<uInt>& rownrs,
156  const Slicer&);
157  virtual Array<uShort> getElemColumnuShort (const Vector<uInt>& rownrs,
158  const Slicer&);
159  virtual Array<Int> getElemColumnInt (const Vector<uInt>& rownrs,
160  const Slicer&);
161  virtual Array<uInt> getElemColumnuInt (const Vector<uInt>& rownrs,
162  const Slicer&);
163  virtual Array<Float> getElemColumnFloat (const Vector<uInt>& rownrs,
164  const Slicer&);
165  virtual Array<Double> getElemColumnDouble (const Vector<uInt>& rownrs,
166  const Slicer&);
167  virtual Array<Complex> getElemColumnComplex (const Vector<uInt>& rownrs,
168  const Slicer&);
169  virtual Array<DComplex> getElemColumnDComplex (const Vector<uInt>& rownrs,
170  const Slicer&);
171  virtual Array<String> getElemColumnString (const Vector<uInt>& rownrs,
172  const Slicer&);
173  // </group>
174 
175  // Make an array with the given shape and fill it with the value.
176  static Array<Int64> makeArray (const IPosition& shape, Int64 value);
177  static Array<Double> makeArray (const IPosition& shape, Double value);
178  static Array<DComplex> makeArray (const IPosition& shape,
179  const DComplex& value);
180 
181 protected:
183 };
184 
185 
186 
187 // <summary>
188 // Base class for Array column in table select expression
189 // </summary>
190 
191 // <use visibility=local>
192 
193 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
194 // </reviewed>
195 
196 // <prerequisite>
197 //# Classes you should understand before using this one.
198 // <li> TableExprNodeArray
199 // </prerequisite>
200 
201 // <synopsis>
202 // This class is the base class to store an array column.
203 // The actual storing of the array column is done by its derivations.
204 // </synopsis>
205 
207 {
208 public:
209  // Create the object for the given column and table.
210  TableExprNodeArrayColumn (const TableColumn& tablecol,
211  const Table& table);
212 
214 
215  // This node represents a table column.
216  virtual void getColumnNodes (vector<TableExprNodeRep*>& cols);
217 
218  // Do not apply the selection.
219  virtual void disableApplySelection();
220 
221  // Re-create the column object for a selection of rows.
222  virtual void applySelection (const Vector<uInt>& rownrs);
223 
224  // Get the TableColumn object.
225  const TableColumn& getColumn() const;
226 
227  // Get the shape of the array in the given row.
228  virtual const IPosition& getShape (const TableExprId& id);
229 
230  // Is the value in the given row defined?
231  virtual Bool isDefined (const TableExprId& id);
232 
233  // Get the data type of this column.
234  // It returns with a True status.
235  virtual Bool getColumnDataType (DataType&) const;
236 
237 protected:
241 };
242 
243 
244 
245 // <summary>
246 // Bool array column in table select expression
247 // </summary>
248 
249 // <use visibility=local>
250 
251 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
252 // </reviewed>
253 
254 // <prerequisite>
255 //# Classes you should understand before using this one.
256 // <li> TableExprNodeArrayColumn
257 // </prerequisite>
258 
259 // <synopsis>
260 // These classes store an array column of type X.
261 // </synopsis>
262 
264 {
265 public:
267  const Table&);
269 
270  // Re-create the column object for a selection of rows.
271  virtual void applySelection (const Vector<uInt>& rownrs);
272 
273  virtual Bool getElemBool (const TableExprId& id, const Slicer& index);
274  virtual Array<Bool> getArrayBool (const TableExprId& id);
275  virtual Array<Bool> getSliceBool (const TableExprId& id, const Slicer&);
276  virtual Array<Bool> getElemColumnBool (const Vector<uInt>& rownrs,
277  const Slicer&);
278 protected:
280 };
281 
282 
283 // <summary>
284 // uChar array column in table select expression
285 // </summary>
286 
287 // <use visibility=local>
288 
289 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
290 // </reviewed>
291 
292 // <prerequisite>
293 //# Classes you should understand before using this one.
294 // <li> TableExprNodeArrayColumn
295 // </prerequisite>
296 
297 // <synopsis>
298 // These classes store an array column of type X.
299 // </synopsis>
300 
302 {
303 public:
305  const Table&);
307 
308  // Re-create the column object for a selection of rows.
309  virtual void applySelection (const Vector<uInt>& rownrs);
310 
311  virtual Int64 getElemInt (const TableExprId& id, const Slicer& index);
312  virtual Array<Int64> getArrayInt (const TableExprId& id);
313  virtual Array<Int64> getSliceInt (const TableExprId& id,
314  const Slicer&);
315  virtual Array<uChar> getElemColumnuChar (const Vector<uInt>& rownrs,
316  const Slicer&);
317 protected:
319 };
320 
321 
322 // <summary>
323 // Short array column in table select expression
324 // </summary>
325 
326 // <use visibility=local>
327 
328 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
329 // </reviewed>
330 
331 // <prerequisite>
332 //# Classes you should understand before using this one.
333 // <li> TableExprNodeArrayColumn
334 // </prerequisite>
335 
336 // <synopsis>
337 // These classes store an array column of type X.
338 // </synopsis>
339 
341 {
342 public:
344  const Table&);
346 
347  // Re-create the column object for a selection of rows.
348  virtual void applySelection (const Vector<uInt>& rownrs);
349 
350  virtual Int64 getElemInt (const TableExprId& id, const Slicer& index);
351  virtual Array<Int64> getArrayInt (const TableExprId& id);
352  virtual Array<Int64> getSliceInt (const TableExprId& id,
353  const Slicer&);
354  virtual Array<Short> getElemColumnShort (const Vector<uInt>& rownrs,
355  const Slicer&);
356 protected:
358 };
359 
360 
361 // <summary>
362 // uShort array column in table select expression
363 // </summary>
364 
365 // <use visibility=local>
366 
367 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
368 // </reviewed>
369 
370 // <prerequisite>
371 //# Classes you should understand before using this one.
372 // <li> TableExprNodeArrayColumn
373 // </prerequisite>
374 
375 // <synopsis>
376 // These classes store an array column of type X.
377 // </synopsis>
378 
380 {
381 public:
383  const Table&);
385 
386  // Re-create the column object for a selection of rows.
387  virtual void applySelection (const Vector<uInt>& rownrs);
388 
389  virtual Int64 getElemInt (const TableExprId& id, const Slicer& index);
390  virtual Array<Int64> getArrayInt (const TableExprId& id);
391  virtual Array<Int64> getSliceInt (const TableExprId& id,
392  const Slicer&);
393  virtual Array<uShort> getElemColumnuShort (const Vector<uInt>& rownrs,
394  const Slicer&);
395 protected:
397 };
398 
399 
400 // <summary>
401 // Int array column in table select expression
402 // </summary>
403 
404 // <use visibility=local>
405 
406 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
407 // </reviewed>
408 
409 // <prerequisite>
410 //# Classes you should understand before using this one.
411 // <li> TableExprNodeArrayColumn
412 // </prerequisite>
413 
414 // <synopsis>
415 // These classes store an array column of type X.
416 // </synopsis>
417 
419 {
420 public:
422  const Table&);
424 
425  // Re-create the column object for a selection of rows.
426  virtual void applySelection (const Vector<uInt>& rownrs);
427 
428  virtual Int64 getElemInt (const TableExprId& id, const Slicer& index);
429  virtual Array<Int64> getArrayInt (const TableExprId& id);
430  virtual Array<Int64> getSliceInt (const TableExprId& id,
431  const Slicer&);
432  virtual Array<Int> getElemColumnInt (const Vector<uInt>& rownrs,
433  const Slicer&);
434 protected:
436 };
437 
438 
439 // <summary>
440 // uInt array column in table select expression
441 // </summary>
442 
443 // <use visibility=local>
444 
445 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
446 // </reviewed>
447 
448 // <prerequisite>
449 //# Classes you should understand before using this one.
450 // <li> TableExprNodeArrayColumn
451 // </prerequisite>
452 
453 // <synopsis>
454 // These classes store an array column of type X.
455 // </synopsis>
456 
458 {
459 public:
461  const Table&);
463 
464  // Re-create the column object for a selection of rows.
465  virtual void applySelection (const Vector<uInt>& rownrs);
466 
467  virtual Int64 getElemInt (const TableExprId& id, const Slicer& index);
468  virtual Array<Int64> getArrayInt (const TableExprId& id);
469  virtual Array<Int64> getSliceInt (const TableExprId& id,
470  const Slicer&);
471  virtual Array<uInt> getElemColumnuInt (const Vector<uInt>& rownrs,
472  const Slicer&);
473 protected:
475 };
476 
477 
478 // <summary>
479 // Float array column in table select expression
480 // </summary>
481 
482 // <use visibility=local>
483 
484 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
485 // </reviewed>
486 
487 // <prerequisite>
488 //# Classes you should understand before using this one.
489 // <li> TableExprNodeArrayColumn
490 // </prerequisite>
491 
492 // <synopsis>
493 // These classes store an array column of type X.
494 // </synopsis>
495 
497 {
498 public:
500  const Table&);
502 
503  // Re-create the column object for a selection of rows.
504  virtual void applySelection (const Vector<uInt>& rownrs);
505 
506  virtual Double getElemDouble (const TableExprId& id, const Slicer& index);
507  virtual Array<Double> getArrayDouble (const TableExprId& id);
508  virtual Array<Double> getSliceDouble (const TableExprId& id,
509  const Slicer&);
510  virtual Array<Float> getElemColumnFloat (const Vector<uInt>& rownrs,
511  const Slicer&);
512 protected:
514 };
515 
516 
517 // <summary>
518 // Double array column in table select expression
519 // </summary>
520 
521 // <use visibility=local>
522 
523 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
524 // </reviewed>
525 
526 // <prerequisite>
527 //# Classes you should understand before using this one.
528 // <li> TableExprNodeArrayColumn
529 // </prerequisite>
530 
531 // <synopsis>
532 // These classes store an array column of type X.
533 // </synopsis>
534 
536 {
537 public:
539  const Table&);
541 
542  // Re-create the column object for a selection of rows.
543  virtual void applySelection (const Vector<uInt>& rownrs);
544 
545  virtual Double getElemDouble (const TableExprId& id, const Slicer& index);
546  virtual Array<Double> getArrayDouble (const TableExprId& id);
547  virtual Array<Double> getSliceDouble (const TableExprId& id,
548  const Slicer&);
549  virtual Array<Double> getElemColumnDouble (const Vector<uInt>& rownrs,
550  const Slicer&);
551 protected:
553 };
554 
555 
556 // <summary>
557 // Complex array column in table select expression
558 // </summary>
559 
560 // <use visibility=local>
561 
562 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
563 // </reviewed>
564 
565 // <prerequisite>
566 //# Classes you should understand before using this one.
567 // <li> TableExprNodeArrayColumn
568 // </prerequisite>
569 
570 // <synopsis>
571 // These classes store an array column of type X.
572 // </synopsis>
573 
575 {
576 public:
578  const Table&);
580 
581  // Re-create the column object for a selection of rows.
582  virtual void applySelection (const Vector<uInt>& rownrs);
583 
584  virtual DComplex getElemDComplex (const TableExprId& id, const Slicer& index);
585  virtual Array<DComplex> getArrayDComplex (const TableExprId& id);
586  virtual Array<DComplex> getSliceDComplex (const TableExprId& id,
587  const Slicer&);
588  virtual Array<Complex> getElemColumnComplex (const Vector<uInt>& rownrs,
589  const Slicer&);
590 protected:
592 };
593 
594 
595 // <summary>
596 // DComplex array column in table select expression
597 // </summary>
598 
599 // <use visibility=local>
600 
601 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
602 // </reviewed>
603 
604 // <prerequisite>
605 //# Classes you should understand before using this one.
606 // <li> TableExprNodeArrayColumn
607 // </prerequisite>
608 
609 // <synopsis>
610 // These classes store an array column of type X.
611 // </synopsis>
612 
614 {
615 public:
617  const Table&);
619 
620  // Re-create the column object for a selection of rows.
621  virtual void applySelection (const Vector<uInt>& rownrs);
622 
623  virtual DComplex getElemDComplex (const TableExprId& id, const Slicer& index);
624  virtual Array<DComplex> getArrayDComplex (const TableExprId& id);
625  virtual Array<DComplex> getSliceDComplex (const TableExprId& id,
626  const Slicer&);
627  virtual Array<DComplex> getElemColumnDComplex (const Vector<uInt>& rownrs,
628  const Slicer&);
629 protected:
631 };
632 
633 
634 // <summary>
635 // String array column in table select expression
636 // </summary>
637 
638 // <use visibility=local>
639 
640 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
641 // </reviewed>
642 
643 // <prerequisite>
644 //# Classes you should understand before using this one.
645 // <li> TableExprNodeArrayColumn
646 // </prerequisite>
647 
648 // <synopsis>
649 // These classes store an array column of type X.
650 // </synopsis>
651 
653 {
654 public:
656  const Table&);
658 
659  // Re-create the column object for a selection of rows.
660  virtual void applySelection (const Vector<uInt>& rownrs);
661 
662  virtual String getElemString (const TableExprId& id, const Slicer& index);
663  virtual Array<String> getArrayString (const TableExprId& id);
664  virtual Array<String> getSliceString (const TableExprId& id,
665  const Slicer&);
666  virtual Array<String> getElemColumnString (const Vector<uInt>& rownrs,
667  const Slicer&);
668 protected:
670 };
671 
672 
673 
674 
675 // <summary>
676 // The index of an array element in a table select expression
677 // </summary>
678 
679 // <use visibility=local>
680 
681 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
682 // </reviewed>
683 
684 // <prerequisite>
685 //# Classes you should understand before using this one.
686 // <li> TableExprNodeMulti
687 // </prerequisite>
688 
689 // <etymology>
690 // TableExprNodeIndex is used to store an index.
691 // All the operands must be Int.
692 // </etymology>
693 
694 // <synopsis>
695 // TableExprNodeIndex is a derivation of TableExprNodeMulti
696 // expression tree that represents an index.
697 // </synopsis>
698 
699 // <motivation>
700 // All operands of TableExprNodeIndex must be Int,
701 // therefore it is a derivation of TableExprNodeMulti.
702 // </motivation>
703 
704 // <todo asof="$DATE:$">
705 //# A List of bugs, limitations, extensions or planned refinements.
706 // <li> to be filled in
707 // </todo>
708 
710 {
711 public:
712  // Constructor
713  explicit TableExprNodeIndex (const TableExprNodeSet& indices,
714  const TaQLStyle& = TaQLStyle(0));
715 
716  // Destructor
717  virtual ~TableExprNodeIndex();
718 
719  // Link all the operands and check datatype.
720  // Calculate the IPosition values for the const operands.
721  void fillIndex (const TableExprNodeSet& indices);
722 
723  // Check if the index values match the dimensionality and shape
724  // of fixed-shaped array.
725  void checkIndexValues (const TableExprNodeRep* arrayNode);
726 
727  // Get the Slicer value for a constant index.
728  const Slicer& getConstantSlicer() const;
729 
730  // Get the Slicer value for the slice.
731  const Slicer& getSlicer (const TableExprId& id);
732 
733  // Does it index a single element?
734  Bool isSingle() const;
735 
736 protected:
737  Int origin_p; //# origin 0 for C++/Python; 1 for Glish
738  Int endMinus_p; //# subtract from end (origin and endExcl)
739  Bool isCOrder_p; //# True for Python
740  IPosition start_p; //# precalculated start values
741  IPosition end_p; //# precalculated end values (<0 = till end)
742  IPosition incr_p; //# precalculated increment values
743  Slicer slicer_p; //# combined start, end, and incr
744  Block<Bool> varIndex_p; //# is the start for the axes variable?
745  Bool isSingle_p; //# Index a single value?
746 
747  // Precalculate the constant indices and store them.
748  void convertConstIndex();
749 
750  // Fill the slicer for this row.
751  void fillSlicer (const TableExprId& id);
752 
753  // Get the shape of the node involved. Reverse axes if needed.
754  IPosition getNodeShape (const TableExprNodeRep* arrayNode) const;
755 };
756 
757 
758 
759 
760 // <summary>
761 // Array column part in table select expression
762 // </summary>
763 
764 // <use visibility=local>
765 
766 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
767 // </reviewed>
768 
769 // <prerequisite>
770 //# Classes you should understand before using this one.
771 // <li> TableExprNode
772 // <li> TableExprNodeRep
773 // <li> TableExprNodeBinary
774 // </prerequisite>
775 
776 // <synopsis>
777 // This class handles a part of an array.
778 // It uses a TableExprNodeArray to handle the array
779 // and a TableExprNodeIndex to store the index.
780 // </synopsis>
781 
783 {
784 public:
787 
788  // Show the node.
789  void show (ostream& os, uInt indent) const;
790 
791  Bool getBool (const TableExprId& id);
792  Int64 getInt (const TableExprId& id);
793  Double getDouble (const TableExprId& id);
794  DComplex getDComplex (const TableExprId& id);
795  String getString (const TableExprId& id);
796  MVTime getDate (const TableExprId& id);
797 
804 
805  // Get the data type of this column (if possible).
806  // It returns with a False status when the index is not constant
807  // (that means that the index can vary with row number).
808  Bool getColumnDataType (DataType&) const;
809 
810  Array<Bool> getColumnBool (const Vector<uInt>& rownrs);
811  Array<uChar> getColumnuChar (const Vector<uInt>& rownrs);
812  Array<Short> getColumnShort (const Vector<uInt>& rownrs);
814  Array<Int> getColumnInt (const Vector<uInt>& rownrs);
815  Array<uInt> getColumnuInt (const Vector<uInt>& rownrs);
816  Array<Float> getColumnFloat (const Vector<uInt>& rownrs);
821 
822  // Get the index node.
823  const TableExprNodeIndex* getIndexNode() const;
824 
825  // Get the array column node.
826  // It returns 0 if the parent object is no array column.
827  const TableExprNodeArrayColumn* getColumnNode() const;
828 
829 private:
832  TableExprNodeArrayColumn* colNode_p; //# 0 if arrNode is no arraycolumn
833 };
834 
835 
836 
837 
839 {
840  return isSingle_p;
841 }
843 {
844  return slicer_p;
845 }
847 {
848  if (!isConstant()) {
849  fillSlicer (id);
850  }
851  return slicer_p;
852 }
853 
855 {
856  return tabCol_p;
857 }
858 
860 {
861  return indexNode_p;
862 }
863 
864 inline const TableExprNodeArrayColumn*
866 {
867  return colNode_p;
868 }
869 
870 
871 
872 } //# NAMESPACE CASACORE - END
873 
874 #endif
875 
A Vector of integers, for indexing into Array<T> objects.
Definition: IPosition.h:119
const Slicer & getSlicer(const TableExprId &id)
Get the Slicer value for the slice.
virtual Bool isDefined(const TableExprId &id)
Is the value in the given row defined? The default implementation returns True.
virtual TableExprNodeRep * makeConstantScalar()
Turn a constant array with one element into a scalar.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
virtual Array< String > getArrayString(const TableExprId &id)
virtual String getElemString(const TableExprId &id, const Slicer &index)
int Int
Definition: aipstype.h:47
Bool isSingle() const
Does it index a single element?
virtual Array< Bool > getElemColumnBool(const Vector< uInt > &rownrs, const Slicer &)
Get a single element for the entire column (used by sort).
virtual Array< Bool > hasArrayInt(const TableExprId &id, const Array< Int64 > &value)
virtual Array< uInt > getColumnuInt(const Vector< uInt > &rownrs)
virtual DComplex getElemDComplex(const TableExprId &id, const Slicer &index)
virtual Array< Bool > hasArrayDouble(const TableExprId &id, const Array< Double > &value)
virtual Bool hasString(const TableExprId &id, const String &value)
TableExprNodeIndex * indexNode_p
virtual Array< Bool > getColumnBool(const Vector< uInt > &rownrs)
Get the value of the expression evaluated for the entire column.
virtual Array< Bool > hasArrayDComplex(const TableExprId &id, const Array< DComplex > &value)
Main interface class to a read/write table.
Definition: Table.h:149
const TableColumn & getColumn() const
Get the TableColumn object.
uInt array column in table select expression
virtual const IPosition & getShape(const TableExprId &id)
Get the shape of the array in the given row.
Short array column in table select expression.
virtual Array< MVTime > getArrayDate(const TableExprId &id)
TableExprNodeArrayColumn * colNode_p
Class to hold multiple table expression nodes.
Definition: ExprNodeSet.h:305
Double array column in table select expression.
virtual MVTime getDate(const TableExprId &id)
virtual Array< uShort > getElemColumnuShort(const Vector< uInt > &rownrs, const Slicer &)
Base class for Array column in table select expression.
Bool isConstant() const
Is the expression a constant?
Definition: ExprNodeRep.h:718
virtual Double getElemDouble(const TableExprId &id, const Slicer &index)
virtual Int64 getElemInt(const TableExprId &id, const Slicer &index)
virtual Int64 getInt(const TableExprId &id)
virtual Array< Double > getColumnDouble(const Vector< uInt > &rownrs)
virtual Array< uShort > getColumnuShort(const Vector< uInt > &rownrs)
virtual Array< uInt > getElemColumnuInt(const Vector< uInt > &rownrs, const Slicer &)
virtual Array< Float > getColumnFloat(const Vector< uInt > &rownrs)
Base class for arrays in table select expression.
Definition: ExprNodeArray.h:66
NodeDataType
Define the data types of a node.
Definition: ExprNodeRep.h:154
virtual Array< DComplex > getColumnDComplex(const Vector< uInt > &rownrs)
Abstract base class for a node in a table column expression tree.
Definition: ExprNodeRep.h:150
virtual Array< uChar > getElemColumnuChar(const Vector< uInt > &rownrs, const Slicer &)
virtual Array< Double > getArrayDouble(const TableExprId &id)
The default implementation of getArrayDouble does getArrayInt and converts the result.
DComplex array column in table select expression.
virtual void applySelection(const Vector< uInt > &rownrs)
Re-create the column object for a selection of rows.
const TableExprNodeIndex * getIndexNode() const
Get the index node.
virtual Array< Int > getColumnInt(const Vector< uInt > &rownrs)
virtual MVTime getElemDate(const TableExprId &id, const Slicer &index)
virtual Double getDouble(const TableExprId &id)
const TableExprNodeArrayColumn * getColumnNode() const
Get the array column node.
virtual Array< String > getElemColumnString(const Vector< uInt > &rownrs, const Slicer &)
Abstract base class for a node having multiple child nodes.
Definition: ExprNodeRep.h:656
double Double
Definition: aipstype.h:52
OperType
Define the operator types.
Definition: ExprNodeRep.h:180
TableExprNodeArray * arrNode_p
Class with static members defining the TaQL style.
Definition: TaQLStyle.h:64
virtual void show(ostream &, uInt indent) const
Show the expression tree.
virtual Array< String > getColumnString(const Vector< uInt > &rownrs)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:39
virtual Array< DComplex > getArrayDComplex(const TableExprId &id)
The default implementation of getArrayDComplex does getArrayDouble and converts the result...
Int array column in table select expression.
String array column in table select expression.
virtual Array< DComplex > getSliceDComplex(const TableExprId &id, const Slicer &)
Read/write access to a table column.
Definition: TableColumn.h:98
virtual Array< Bool > getSliceBool(const TableExprId &id, const Slicer &)
Get a slice of the array in the given row.
virtual Bool hasBool(const TableExprId &id, Bool value)
Does a value occur in the set?
virtual Bool getBool(const TableExprId &id)
Get a scalar value for this node in the given row.
virtual Array< Double > getElemColumnDouble(const Vector< uInt > &rownrs, const Slicer &)
Float array column in table select expression.
virtual Bool hasInt(const TableExprId &id, Int64 value)
virtual Array< Int > getElemColumnInt(const Vector< uInt > &rownrs, const Slicer &)
virtual Array< Bool > hasArrayBool(const TableExprId &id, const Array< Bool > &value)
virtual void disableApplySelection()
Do not apply the selection.
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:275
virtual Bool hasDate(const TableExprId &id, const MVTime &value)
virtual Array< Complex > getColumnComplex(const Vector< uInt > &rownrs)
Array column part in table select expression.
virtual Bool hasDComplex(const TableExprId &id, const DComplex &value)
virtual Array< Bool > hasArrayDate(const TableExprId &id, const Array< MVTime > &value)
virtual Array< Int64 > getArrayInt(const TableExprId &id)
The identification of a TaQL selection subject.
Definition: TableExprId.h:98
TableExprNodeArray(NodeDataType, OperType)
Create the object.
virtual String getString(const TableExprId &id)
Table & table()
Get table.
Definition: ExprNodeRep.h:734
virtual Array< DComplex > getElemColumnDComplex(const Vector< uInt > &rownrs, const Slicer &)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual Array< Float > getElemColumnFloat(const Vector< uInt > &rownrs, const Slicer &)
uShort array column in table select expression
uChar array column in table select expression
virtual DComplex getDComplex(const TableExprId &id)
virtual Array< uChar > getColumnuChar(const Vector< uInt > &rownrs)
Class to handle date/time type conversions and I/O.
Definition: MVTime.h:266
virtual Array< Complex > getElemColumnComplex(const Vector< uInt > &rownrs, const Slicer &)
virtual Array< Int64 > getSliceInt(const TableExprId &id, const Slicer &)
virtual Bool getColumnDataType(DataType &) const
Get the data type of the column.
static Array< Int64 > makeArray(const IPosition &shape, Int64 value)
Make an array with the given shape and fill it with the value.
virtual void getColumnNodes(vector< TableExprNodeRep * > &cols)
Get the nodes representing a table column.
The index of an array element in a table select expression.
const IPosition & shape() const
Get the fixed shape (same for all rows).
Definition: ExprNodeRep.h:730
virtual Bool hasDouble(const TableExprId &id, Double value)
Complex array column in table select expression.
const Slicer & getConstantSlicer() const
Get the Slicer value for a constant index.
Abstract base class for a node having 0, 1, or 2 child nodes.
Definition: ExprNodeRep.h:549
virtual Array< String > getSliceString(const TableExprId &id, const Slicer &)
virtual Array< Double > getSliceDouble(const TableExprId &id, const Slicer &)
virtual Array< MVTime > getSliceDate(const TableExprId &id, const Slicer &)
this file contains all the compiler specific defines
Definition: mainpage.dox:28
virtual Array< Short > getColumnShort(const Vector< uInt > &rownrs)
Bool array column in table select expression.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
unsigned int uInt
Definition: aipstype.h:48
virtual Array< Short > getElemColumnShort(const Vector< uInt > &rownrs, const Slicer &)
virtual Bool getElemBool(const TableExprId &id, const Slicer &index)
Get a single element from the array in the given row.
virtual Array< Bool > getArrayBool(const TableExprId &id)
Get an array value for this node in the given row.
virtual Array< Bool > hasArrayString(const TableExprId &id, const Array< String > &value)