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