casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef TABLES_EXPRNODEARRAY_H
27#define TABLES_EXPRNODEARRAY_H
28
29// # Includes
30#include <casacore/tables/TaQL/ExprNodeRep.h>
31#include <casacore/tables/TaQL/TaQLStyle.h>
32#include <casacore/tables/Tables/Table.h>
33#include <casacore/tables/Tables/ArrayColumn.h>
34#include <casacore/casa/Arrays/Slicer.h>
35
36namespace casacore { // # NAMESPACE CASACORE - BEGIN
37
38// # Forward Declarations
40
41// <summary>
42// Base class for arrays in table select expression
43// </summary>
44
45// <use visibility=local>
46
47// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
48// </reviewed>
49
50// <prerequisite>
51// # Classes you should understand before using this one.
52// <li> TableExprNode
53// <li> TableExprNodeRep
54// <li> TableExprNodeBinary
55// </prerequisite>
56
57// <synopsis>
58// This class is the base class to represent an array.
59// The actual storing of the array column is done by its derivations.
60// </synopsis>
61
63 public:
64 // Create the object.
65 // <group>
69 // </group>
70
71 ~TableExprNodeArray() override = default;
72
73 // Turn a constant array with one element into a scalar.
74 // It returns a zero pointer if not possible.
75 // The default implementation returns 0.
77
78 // Validate the given index against the array's shape.
79 // Treat a negative as an index from the end (a la python) and replace it.
80 IPosition validateIndex(const IPosition& index, const ArrayBase& arr) const;
81
82 // Get the shape of the array in the given row.
83 // This default implementation evaluates the value and returns its shape.
84 const IPosition& getShape(const TableExprId& id) override;
85
86 // The default implementation of getArrayDouble does
87 // getArrayInt and converts the result.
89
90 // The default implementation of getArrayDComplex does
91 // getArrayDouble and converts the result.
93
94 // Does a value occur in the set?
95 // <group>
96 Bool contains(const TableExprId& id, Bool value) override;
97 Bool contains(const TableExprId& id, Int64 value) override;
98 Bool contains(const TableExprId& id, Double value) override;
99 Bool contains(const TableExprId& id, DComplex value) override;
100 Bool contains(const TableExprId& id, String value) override;
101 Bool contains(const TableExprId& id, MVTime value) override;
108 // </group>
109
110 // Get a single element from the array in the given row.
111 // <group>
112 virtual Bool getElemBool(const TableExprId& id, const Slicer& index);
113 virtual Int64 getElemInt(const TableExprId& id, const Slicer& index);
114 virtual Double getElemDouble(const TableExprId& id, const Slicer& index);
115 virtual DComplex getElemDComplex(const TableExprId& id, const Slicer& index);
116 virtual String getElemString(const TableExprId& id, const Slicer& index);
117 virtual MVTime getElemDate(const TableExprId& id, const Slicer& index);
118 // </group>
119
120 // Get a slice of the array in the given row.
121 // <group>
122 virtual MArray<Bool> getSliceBool(const TableExprId& id, const Slicer&);
123 virtual MArray<Int64> getSliceInt(const TableExprId& id, const Slicer&);
127 virtual MArray<MVTime> getSliceDate(const TableExprId& id, const Slicer&);
128 // </group>
129
130 // Get a single element for the entire column (used by sort).
131 // <group>
132 virtual Array<Bool> getElemColumnBool(const Vector<rownr_t>& rownrs, const Slicer&);
136 virtual Array<Int> getElemColumnInt(const Vector<rownr_t>& rownrs, const Slicer&);
137 virtual Array<uInt> getElemColumnuInt(const Vector<rownr_t>& rownrs, const Slicer&);
144 // </group>
145
146 // Make an array with the given shape and fill it with the value.
149 static MArray<DComplex> makeArray(const IPosition& shape, const DComplex& value);
150
151 protected:
153};
154
155// <summary>
156// Base class for Array column in table select expression
157// </summary>
158
159// <use visibility=local>
160
161// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
162// </reviewed>
163
164// <prerequisite>
165// # Classes you should understand before using this one.
166// <li> TableExprNodeArray
167// </prerequisite>
168
169// <synopsis>
170// This class is the base class to store an array column.
171// The actual storing of the array column is done by its derivations.
172// </synopsis>
173
175 public:
176 // Create the object for the given column and table.
178
179 ~TableExprNodeArrayColumn() override = default;
180
181 // Get the table info for this column.
182 TableExprInfo getTableInfo() const override;
183
184 // Do not apply the selection.
185 void disableApplySelection() override;
186
187 // Re-create the column object for a selection of rows.
188 void applySelection(const Vector<rownr_t>& rownrs) override;
189
190 // Get the TableColumn object.
191 const TableColumn& getColumn() const;
192
193 // Get the shape of the array in the given row.
194 const IPosition& getShape(const TableExprId& id) override;
195
196 // Is the value in the given row defined?
197 Bool isDefined(const TableExprId& id) override;
198
199 // Get the data type of this column.
200 // It returns with a True status.
201 Bool getColumnDataType(DataType&) const override;
202
203 protected:
207};
208
209// <summary>
210// Bool array column in table select expression
211// </summary>
212
213// <use visibility=local>
214
215// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
216// </reviewed>
217
218// <prerequisite>
219// # Classes you should understand before using this one.
220// <li> TableExprNodeArrayColumn
221// </prerequisite>
222
223// <synopsis>
224// These classes store an array column of type X.
225// </synopsis>
226
228 public:
230 ~TableExprNodeArrayColumnBool() override = default;
231
232 // Re-create the column object for a selection of rows.
233 void applySelection(const Vector<rownr_t>& rownrs) override;
234
235 Bool getElemBool(const TableExprId& id, const Slicer& index) override;
237 MArray<Bool> getSliceBool(const TableExprId& id, const Slicer&) override;
238 Array<Bool> getElemColumnBool(const Vector<rownr_t>& rownrs, const Slicer&) override;
239
240 protected:
242};
243
244// <summary>
245// uChar array column in table select expression
246// </summary>
247
248// <use visibility=local>
249
250// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
251// </reviewed>
252
253// <prerequisite>
254// # Classes you should understand before using this one.
255// <li> TableExprNodeArrayColumn
256// </prerequisite>
257
258// <synopsis>
259// These classes store an array column of type X.
260// </synopsis>
261
263 public:
265 ~TableExprNodeArrayColumnuChar() override = default;
266
267 // Re-create the column object for a selection of rows.
268 void applySelection(const Vector<rownr_t>& rownrs) override;
269
270 Int64 getElemInt(const TableExprId& id, const Slicer& index) override;
272 MArray<Int64> getSliceInt(const TableExprId& id, const Slicer&) override;
273 Array<uChar> getElemColumnuChar(const Vector<rownr_t>& rownrs, const Slicer&) override;
274
275 protected:
277};
278
279// <summary>
280// Short array column in table select expression
281// </summary>
282
283// <use visibility=local>
284
285// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
286// </reviewed>
287
288// <prerequisite>
289// # Classes you should understand before using this one.
290// <li> TableExprNodeArrayColumn
291// </prerequisite>
292
293// <synopsis>
294// These classes store an array column of type X.
295// </synopsis>
296
298 public:
300 ~TableExprNodeArrayColumnShort() override = default;
301
302 // Re-create the column object for a selection of rows.
303 void applySelection(const Vector<rownr_t>& rownrs) override;
304
305 Int64 getElemInt(const TableExprId& id, const Slicer& index) override;
307 MArray<Int64> getSliceInt(const TableExprId& id, const Slicer&) override;
308 Array<Short> getElemColumnShort(const Vector<rownr_t>& rownrs, const Slicer&) override;
309
310 protected:
312};
313
314// <summary>
315// uShort array column in table select expression
316// </summary>
317
318// <use visibility=local>
319
320// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
321// </reviewed>
322
323// <prerequisite>
324// # Classes you should understand before using this one.
325// <li> TableExprNodeArrayColumn
326// </prerequisite>
327
328// <synopsis>
329// These classes store an array column of type X.
330// </synopsis>
331
333 public:
336
337 // Re-create the column object for a selection of rows.
338 void applySelection(const Vector<rownr_t>& rownrs) override;
339
340 Int64 getElemInt(const TableExprId& id, const Slicer& index) override;
342 MArray<Int64> getSliceInt(const TableExprId& id, const Slicer&) override;
344
345 protected:
347};
348
349// <summary>
350// Int array column in table select expression
351// </summary>
352
353// <use visibility=local>
354
355// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
356// </reviewed>
357
358// <prerequisite>
359// # Classes you should understand before using this one.
360// <li> TableExprNodeArrayColumn
361// </prerequisite>
362
363// <synopsis>
364// These classes store an array column of type X.
365// </synopsis>
366
368 public:
370 ~TableExprNodeArrayColumnInt() override = default;
371
372 // Re-create the column object for a selection of rows.
373 void applySelection(const Vector<rownr_t>& rownrs) override;
374
375 Int64 getElemInt(const TableExprId& id, const Slicer& index) override;
377 MArray<Int64> getSliceInt(const TableExprId& id, const Slicer&) override;
378 Array<Int> getElemColumnInt(const Vector<rownr_t>& rownrs, const Slicer&) override;
379
380 protected:
382};
383
384// <summary>
385// uInt array column in table select expression
386// </summary>
387
388// <use visibility=local>
389
390// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
391// </reviewed>
392
393// <prerequisite>
394// # Classes you should understand before using this one.
395// <li> TableExprNodeArrayColumn
396// </prerequisite>
397
398// <synopsis>
399// These classes store an array column of type X.
400// </synopsis>
401
403 public:
405 ~TableExprNodeArrayColumnuInt() override = default;
406
407 // Re-create the column object for a selection of rows.
408 void applySelection(const Vector<rownr_t>& rownrs) override;
409
410 Int64 getElemInt(const TableExprId& id, const Slicer& index) override;
412 MArray<Int64> getSliceInt(const TableExprId& id, const Slicer&) override;
413 Array<uInt> getElemColumnuInt(const Vector<rownr_t>& rownrs, const Slicer&) override;
414
415 protected:
417};
418
419// <summary>
420// Int64 array column in table select expression
421// </summary>
422
423// <use visibility=local>
424
425// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
426// </reviewed>
427
428// <prerequisite>
429// # Classes you should understand before using this one.
430// <li> TableExprNodeArrayColumn
431// </prerequisite>
432
433// <synopsis>
434// These classes store an array column of type X.
435// </synopsis>
436
438 public:
440 ~TableExprNodeArrayColumnInt64() override = default;
441
442 // Re-create the column object for a selection of rows.
443 void applySelection(const Vector<rownr_t>& rownrs) override;
444
445 Int64 getElemInt(const TableExprId& id, const Slicer& index) override;
447 MArray<Int64> getSliceInt(const TableExprId& id, const Slicer&) override;
448 Array<Int64> getElemColumnInt64(const Vector<rownr_t>& rownrs, const Slicer&) override;
449
450 protected:
452};
453
454// <summary>
455// Float array column in table select expression
456// </summary>
457
458// <use visibility=local>
459
460// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
461// </reviewed>
462
463// <prerequisite>
464// # Classes you should understand before using this one.
465// <li> TableExprNodeArrayColumn
466// </prerequisite>
467
468// <synopsis>
469// These classes store an array column of type X.
470// </synopsis>
471
473 public:
475 ~TableExprNodeArrayColumnFloat() override = default;
476
477 // Re-create the column object for a selection of rows.
478 void applySelection(const Vector<rownr_t>& rownrs) override;
479
480 Double getElemDouble(const TableExprId& id, const Slicer& index) override;
482 MArray<Double> getSliceDouble(const TableExprId& id, const Slicer&) override;
483 Array<Float> getElemColumnFloat(const Vector<rownr_t>& rownrs, const Slicer&) override;
484
485 protected:
487};
488
489// <summary>
490// Double array column in table select expression
491// </summary>
492
493// <use visibility=local>
494
495// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
496// </reviewed>
497
498// <prerequisite>
499// # Classes you should understand before using this one.
500// <li> TableExprNodeArrayColumn
501// </prerequisite>
502
503// <synopsis>
504// These classes store an array column of type X.
505// </synopsis>
506
508 public:
511
512 // Re-create the column object for a selection of rows.
513 void applySelection(const Vector<rownr_t>& rownrs) override;
514
515 Double getElemDouble(const TableExprId& id, const Slicer& index) override;
517 MArray<Double> getSliceDouble(const TableExprId& id, const Slicer&) override;
519
520 protected:
522};
523
524// <summary>
525// Complex array column in table select expression
526// </summary>
527
528// <use visibility=local>
529
530// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
531// </reviewed>
532
533// <prerequisite>
534// # Classes you should understand before using this one.
535// <li> TableExprNodeArrayColumn
536// </prerequisite>
537
538// <synopsis>
539// These classes store an array column of type X.
540// </synopsis>
541
543 public:
546
547 // Re-create the column object for a selection of rows.
548 void applySelection(const Vector<rownr_t>& rownrs) override;
549
550 DComplex getElemDComplex(const TableExprId& id, const Slicer& index) override;
554
555 protected:
557};
558
559// <summary>
560// DComplex array column in table select expression
561// </summary>
562
563// <use visibility=local>
564
565// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
566// </reviewed>
567
568// <prerequisite>
569// # Classes you should understand before using this one.
570// <li> TableExprNodeArrayColumn
571// </prerequisite>
572
573// <synopsis>
574// These classes store an array column of type X.
575// </synopsis>
576
578 public:
581
582 // Re-create the column object for a selection of rows.
583 void applySelection(const Vector<rownr_t>& rownrs) override;
584
585 DComplex getElemDComplex(const TableExprId& id, const Slicer& index) override;
589
590 protected:
592};
593
594// <summary>
595// String array column in table select expression
596// </summary>
597
598// <use visibility=local>
599
600// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
601// </reviewed>
602
603// <prerequisite>
604// # Classes you should understand before using this one.
605// <li> TableExprNodeArrayColumn
606// </prerequisite>
607
608// <synopsis>
609// These classes store an array column of type X.
610// </synopsis>
611
613 public:
616
617 // Re-create the column object for a selection of rows.
618 void applySelection(const Vector<rownr_t>& rownrs) override;
619
620 String getElemString(const TableExprId& id, const Slicer& index) override;
622 MArray<String> getSliceString(const TableExprId& id, const Slicer&) override;
624
625 protected:
627};
628
629// <summary>
630// The index of an array element in a table select expression
631// </summary>
632
633// <use visibility=local>
634
635// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
636// </reviewed>
637
638// <prerequisite>
639// # Classes you should understand before using this one.
640// <li> TableExprNodeMulti
641// </prerequisite>
642
643// <etymology>
644// TableExprNodeIndex is used to store an index.
645// All the operands must be Int.
646// </etymology>
647
648// <synopsis>
649// TableExprNodeIndex is a derivation of TableExprNodeMulti
650// expression tree that represents an index.
651// </synopsis>
652
653// <motivation>
654// All operands of TableExprNodeIndex must be Int,
655// therefore it is a derivation of TableExprNodeMulti.
656// </motivation>
657
658// <todo asof="$DATE:$">
659// # A List of bugs, limitations, extensions or planned refinements.
660// <li> to be filled in
661// </todo>
662
664 public:
665 // Constructor
666 explicit TableExprNodeIndex(const TableExprNodeSet& indices, const TaQLStyle& = TaQLStyle(0));
667
668 // Destructor
669 ~TableExprNodeIndex() override = default;
670
671 // Link all the operands and check datatype.
672 // Calculate the IPosition values for the const operands.
673 void fillIndex(const TableExprNodeSet& indices);
674
675 // Check if the index values match the dimensionality and shape
676 // of fixed-shaped array.
677 void checkIndexValues(const TENShPtr& arrayNode);
678
679 // Get the Slicer value for a constant index.
680 const Slicer& getConstantSlicer() const;
681
682 // Get the Slicer value for the slice.
683 const Slicer& getSlicer(const TableExprId& id);
684
685 // Does it index a single element?
686 Bool isSingle() const;
687
688 protected:
689 Int origin_p; // # origin 0 for C++/Python; 1 for Glish
690 Int endMinus_p; // # subtract from end (origin and endExcl)
691 Bool isCOrder_p; // # True for Python
692 IPosition start_p; // # precalculated start values
693 IPosition end_p; // # precalculated end values (<0 = till end)
694 IPosition incr_p; // # precalculated increment values
695 Slicer slicer_p; // # combined start, end, and incr
696 Block<Bool> varIndex_p; // # is the start for the axes variable?
697 Bool isSingle_p; // # Index a single value?
698
699 // Precalculate the constant indices and store them.
701
702 // Fill the slicer for this row.
703 void fillSlicer(const TableExprId& id);
704
705 // Get the shape of the node involved. Reverse axes if needed.
706 IPosition getNodeShape(const TENShPtr& arrayNode) const;
707};
708
709// <summary>
710// Array column part in table select expression
711// </summary>
712
713// <use visibility=local>
714
715// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
716// </reviewed>
717
718// <prerequisite>
719// # Classes you should understand before using this one.
720// <li> TableExprNode
721// <li> TableExprNodeRep
722// <li> TableExprNodeBinary
723// </prerequisite>
724
725// <synopsis>
726// This class handles a part of an array.
727// It uses a TableExprNodeArray to handle the array
728// and a TableExprNodeIndex to store the index.
729// </synopsis>
730
732 public:
733 TableExprNodeArrayPart(const TENShPtr& arrayNode, const TENShPtr& indexNode);
734 ~TableExprNodeArrayPart() override = default;
735
736 // Show the node.
737 void show(ostream& os, uInt indent) const override;
738
739 Bool getBool(const TableExprId& id) override;
740 Int64 getInt(const TableExprId& id) override;
741 Double getDouble(const TableExprId& id) override;
742 DComplex getDComplex(const TableExprId& id) override;
743 String getString(const TableExprId& id) override;
744 MVTime getDate(const TableExprId& id) override;
745
752
753 // Get the data type of this column (if possible).
754 // It returns with a False status when the index is not constant
755 // (that means that the index can vary with row number).
756 Bool getColumnDataType(DataType&) const override;
757
762 Array<Int> getColumnInt(const Vector<rownr_t>& rownrs) override;
770
771 // Get the index node.
772 const TableExprNodeIndex* getIndexNode() const;
773
774 // Get the array column node.
775 // It returns 0 if the parent object is no array column.
777
778 private:
781 TableExprNodeArrayColumn* colNode_p; // # 0 if arrNode is no arraycolumn
782};
783
787 if (!isConstant()) {
788 fillSlicer(id);
789 }
790 return slicer_p;
791}
792
794
796
800
801} // namespace casacore
802
803#endif
Non-templated base class for templated Array class.
Definition ArrayBase.h:69
String: the storage and methods of handling collections of characters.
Definition String.h:355
Class to connect a Table and its alias name.
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
~TableExprNodeArrayColumnBool() override=default
Array< Bool > getElemColumnBool(const Vector< rownr_t > &rownrs, const Slicer &) override
Get a single element for the entire column (used by sort).
MArray< Bool > getArrayBool(const TableExprId &id) override
Get an array value for this node in the given row.
MArray< Bool > getSliceBool(const TableExprId &id, const Slicer &) override
Get a slice of the array in the given row.
Bool getElemBool(const TableExprId &id, const Slicer &index) override
Get a single element from the array in the given row.
TableExprNodeArrayColumnBool(const TableColumn &, const TableExprInfo &)
MArray< DComplex > getSliceDComplex(const TableExprId &id, const Slicer &) override
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
DComplex getElemDComplex(const TableExprId &id, const Slicer &index) override
Array< Complex > getElemColumnComplex(const Vector< rownr_t > &rownrs, const Slicer &) override
~TableExprNodeArrayColumnComplex() override=default
MArray< DComplex > getArrayDComplex(const TableExprId &id) override
The default implementation of getArrayDComplex does getArrayDouble and converts the result.
TableExprNodeArrayColumnComplex(const TableColumn &, const TableExprInfo &)
Array< DComplex > getElemColumnDComplex(const Vector< rownr_t > &rownrs, const Slicer &) override
MArray< DComplex > getArrayDComplex(const TableExprId &id) override
The default implementation of getArrayDComplex does getArrayDouble and converts the result.
DComplex getElemDComplex(const TableExprId &id, const Slicer &index) override
~TableExprNodeArrayColumnDComplex() override=default
TableExprNodeArrayColumnDComplex(const TableColumn &, const TableExprInfo &)
MArray< DComplex > getSliceDComplex(const TableExprId &id, const Slicer &) override
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
MArray< Double > getArrayDouble(const TableExprId &id) override
The default implementation of getArrayDouble does getArrayInt and converts the result.
Double getElemDouble(const TableExprId &id, const Slicer &index) override
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
MArray< Double > getSliceDouble(const TableExprId &id, const Slicer &) override
Array< Double > getElemColumnDouble(const Vector< rownr_t > &rownrs, const Slicer &) override
~TableExprNodeArrayColumnDouble() override=default
TableExprNodeArrayColumnDouble(const TableColumn &, const TableExprInfo &)
MArray< Double > getArrayDouble(const TableExprId &id) override
The default implementation of getArrayDouble does getArrayInt and converts the result.
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
~TableExprNodeArrayColumnFloat() override=default
Array< Float > getElemColumnFloat(const Vector< rownr_t > &rownrs, const Slicer &) override
MArray< Double > getSliceDouble(const TableExprId &id, const Slicer &) override
TableExprNodeArrayColumnFloat(const TableColumn &, const TableExprInfo &)
Double getElemDouble(const TableExprId &id, const Slicer &index) override
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
Array< Int64 > getElemColumnInt64(const Vector< rownr_t > &rownrs, const Slicer &) override
TableExprNodeArrayColumnInt64(const TableColumn &, const TableExprInfo &)
MArray< Int64 > getArrayInt(const TableExprId &id) override
~TableExprNodeArrayColumnInt64() override=default
Int64 getElemInt(const TableExprId &id, const Slicer &index) override
MArray< Int64 > getSliceInt(const TableExprId &id, const Slicer &) override
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
TableExprNodeArrayColumnInt(const TableColumn &, const TableExprInfo &)
MArray< Int64 > getArrayInt(const TableExprId &id) override
Int64 getElemInt(const TableExprId &id, const Slicer &index) override
Array< Int > getElemColumnInt(const Vector< rownr_t > &rownrs, const Slicer &) override
~TableExprNodeArrayColumnInt() override=default
MArray< Int64 > getSliceInt(const TableExprId &id, const Slicer &) override
Array< Short > getElemColumnShort(const Vector< rownr_t > &rownrs, const Slicer &) override
MArray< Int64 > getArrayInt(const TableExprId &id) override
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
Int64 getElemInt(const TableExprId &id, const Slicer &index) override
MArray< Int64 > getSliceInt(const TableExprId &id, const Slicer &) override
TableExprNodeArrayColumnShort(const TableColumn &, const TableExprInfo &)
~TableExprNodeArrayColumnShort() override=default
~TableExprNodeArrayColumnString() override=default
TableExprNodeArrayColumnString(const TableColumn &, const TableExprInfo &)
String getElemString(const TableExprId &id, const Slicer &index) override
MArray< String > getArrayString(const TableExprId &id) override
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
MArray< String > getSliceString(const TableExprId &id, const Slicer &) override
Array< String > getElemColumnString(const Vector< rownr_t > &rownrs, const Slicer &) override
Base class for Array column in table select expression.
const IPosition & getShape(const TableExprId &id) override
Get the shape of the array in the given row.
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
const TableColumn & getColumn() const
Get the TableColumn object.
Bool isDefined(const TableExprId &id) override
Is the value in the given row defined?
~TableExprNodeArrayColumn() override=default
void disableApplySelection() override
Do not apply the selection.
Bool getColumnDataType(DataType &) const override
Get the data type of this column.
TableExprInfo getTableInfo() const override
Get the table info for this column.
TableExprNodeArrayColumn(const TableColumn &tablecol, const TableExprInfo &)
Create the object for the given column and table.
TableExprNodeArrayColumnuChar(const TableColumn &, const TableExprInfo &)
Array< uChar > getElemColumnuChar(const Vector< rownr_t > &rownrs, const Slicer &) override
~TableExprNodeArrayColumnuChar() override=default
MArray< Int64 > getArrayInt(const TableExprId &id) override
MArray< Int64 > getSliceInt(const TableExprId &id, const Slicer &) override
Int64 getElemInt(const TableExprId &id, const Slicer &index) override
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
Int64 getElemInt(const TableExprId &id, const Slicer &index) override
MArray< Int64 > getSliceInt(const TableExprId &id, const Slicer &) override
TableExprNodeArrayColumnuInt(const TableColumn &, const TableExprInfo &)
Array< uInt > getElemColumnuInt(const Vector< rownr_t > &rownrs, const Slicer &) override
MArray< Int64 > getArrayInt(const TableExprId &id) override
~TableExprNodeArrayColumnuInt() override=default
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
Array< uShort > getElemColumnuShort(const Vector< rownr_t > &rownrs, const Slicer &) override
~TableExprNodeArrayColumnuShort() override=default
TableExprNodeArrayColumnuShort(const TableColumn &, const TableExprInfo &)
MArray< Int64 > getArrayInt(const TableExprId &id) override
void applySelection(const Vector< rownr_t > &rownrs) override
Re-create the column object for a selection of rows.
Int64 getElemInt(const TableExprId &id, const Slicer &index) override
MArray< Int64 > getSliceInt(const TableExprId &id, const Slicer &) override
Array< Int64 > getColumnInt64(const Vector< rownr_t > &rownrs) override
MArray< MVTime > getArrayDate(const TableExprId &id) override
~TableExprNodeArrayPart() override=default
void show(ostream &os, uInt indent) const override
Show the node.
Array< DComplex > getColumnDComplex(const Vector< rownr_t > &rownrs) override
Array< uShort > getColumnuShort(const Vector< rownr_t > &rownrs) override
Bool getColumnDataType(DataType &) const override
Get the data type of this column (if possible).
Array< Float > getColumnFloat(const Vector< rownr_t > &rownrs) override
Array< Bool > getColumnBool(const Vector< rownr_t > &rownrs) override
Get the value of the expression evaluated for the entire column.
Bool getBool(const TableExprId &id) override
Get a scalar value for this node in the given row.
TableExprNodeArrayColumn * colNode_p
TableExprNodeArrayPart(const TENShPtr &arrayNode, const TENShPtr &indexNode)
MArray< DComplex > getArrayDComplex(const TableExprId &id) override
The default implementation of getArrayDComplex does getArrayDouble and converts the result.
const TableExprNodeArrayColumn * getColumnNode() const
Get the array column node.
MArray< Double > getArrayDouble(const TableExprId &id) override
The default implementation of getArrayDouble does getArrayInt and converts the result.
DComplex getDComplex(const TableExprId &id) override
Array< String > getColumnString(const Vector< rownr_t > &rownrs) override
MArray< Int64 > getArrayInt(const TableExprId &id) override
Array< uChar > getColumnuChar(const Vector< rownr_t > &rownrs) override
Double getDouble(const TableExprId &id) override
const TableExprNodeIndex * getIndexNode() const
Get the index node.
MVTime getDate(const TableExprId &id) override
Array< Double > getColumnDouble(const Vector< rownr_t > &rownrs) override
String getString(const TableExprId &id) override
Array< Int > getColumnInt(const Vector< rownr_t > &rownrs) override
Array< Short > getColumnShort(const Vector< rownr_t > &rownrs) override
MArray< String > getArrayString(const TableExprId &id) override
Array< Complex > getColumnComplex(const Vector< rownr_t > &rownrs) override
Array< uInt > getColumnuInt(const Vector< rownr_t > &rownrs) override
MArray< Bool > getArrayBool(const TableExprId &id) override
Get an array value for this node in the given row.
Int64 getInt(const TableExprId &id) override
~TableExprNodeArray() override=default
virtual Array< DComplex > getElemColumnDComplex(const Vector< rownr_t > &rownrs, const Slicer &)
virtual Double getElemDouble(const TableExprId &id, const Slicer &index)
virtual Array< Double > getElemColumnDouble(const Vector< rownr_t > &rownrs, const Slicer &)
MArray< DComplex > getArrayDComplex(const TableExprId &id) override
The default implementation of getArrayDComplex does getArrayDouble and converts the result.
const IPosition & getShape(const TableExprId &id) override
Get the shape of the array in the given row.
virtual Array< Int > getElemColumnInt(const Vector< rownr_t > &rownrs, const Slicer &)
Bool contains(const TableExprId &id, Double value) override
MArray< Bool > contains(const TableExprId &id, const MArray< MVTime > &value) override
virtual MArray< String > getSliceString(const TableExprId &id, const Slicer &)
TableExprNodeArray(NodeDataType, OperType, const IPosition &shape)
MArray< Bool > contains(const TableExprId &id, const MArray< Double > &value) override
virtual Int64 getElemInt(const TableExprId &id, const Slicer &index)
virtual String getElemString(const TableExprId &id, const Slicer &index)
virtual Array< uInt > getElemColumnuInt(const Vector< rownr_t > &rownrs, const Slicer &)
virtual Array< Int64 > getElemColumnInt64(const Vector< rownr_t > &rownrs, const Slicer &)
virtual MArray< Bool > getSliceBool(const TableExprId &id, const Slicer &)
Get a slice of the array in the given row.
MArray< Bool > contains(const TableExprId &id, const MArray< String > &value) override
virtual MArray< DComplex > getSliceDComplex(const TableExprId &id, const Slicer &)
virtual DComplex getElemDComplex(const TableExprId &id, const Slicer &index)
virtual Array< uChar > getElemColumnuChar(const Vector< rownr_t > &rownrs, const Slicer &)
virtual MVTime getElemDate(const TableExprId &id, const Slicer &index)
TableExprNodeArray(const TableExprNodeRep &node, NodeDataType, OperType)
virtual Bool getElemBool(const TableExprId &id, const Slicer &index)
Get a single element from the array in the given row.
static MArray< Double > makeArray(const IPosition &shape, Double value)
MArray< Bool > contains(const TableExprId &id, const MArray< Int64 > &value) override
Bool contains(const TableExprId &id, String value) override
virtual MArray< MVTime > getSliceDate(const TableExprId &id, const Slicer &)
virtual Array< uShort > getElemColumnuShort(const Vector< rownr_t > &rownrs, const Slicer &)
virtual TENShPtr makeConstantScalar()
Turn a constant array with one element into a scalar.
Bool contains(const TableExprId &id, MVTime value) override
virtual Array< String > getElemColumnString(const Vector< rownr_t > &rownrs, const Slicer &)
IPosition validateIndex(const IPosition &index, const ArrayBase &arr) const
Validate the given index against the array's shape.
MArray< Bool > contains(const TableExprId &id, const MArray< DComplex > &value) override
static MArray< DComplex > makeArray(const IPosition &shape, const DComplex &value)
TableExprNodeArray(NodeDataType, OperType)
Create the object.
MArray< Bool > contains(const TableExprId &id, const MArray< Bool > &value) override
MArray< Double > getArrayDouble(const TableExprId &id) override
The default implementation of getArrayDouble does getArrayInt and converts the result.
static MArray< Int64 > makeArray(const IPosition &shape, Int64 value)
Make an array with the given shape and fill it with the value.
virtual Array< Bool > getElemColumnBool(const Vector< rownr_t > &rownrs, const Slicer &)
Get a single element for the entire column (used by sort).
virtual Array< Short > getElemColumnShort(const Vector< rownr_t > &rownrs, const Slicer &)
Bool contains(const TableExprId &id, DComplex value) override
virtual MArray< Double > getSliceDouble(const TableExprId &id, const Slicer &)
virtual MArray< Int64 > getSliceInt(const TableExprId &id, const Slicer &)
virtual Array< Complex > getElemColumnComplex(const Vector< rownr_t > &rownrs, const Slicer &)
Bool contains(const TableExprId &id, Bool value) override
Does a value occur in the set?
virtual Array< Float > getElemColumnFloat(const Vector< rownr_t > &rownrs, const Slicer &)
Bool contains(const TableExprId &id, Int64 value) override
TableExprNodeBinary(NodeDataType, ValueType, OperType, ExprType)
Constructor.
The index of an array element in a table select expression.
Bool isSingle() const
Does it index a single element?
void fillIndex(const TableExprNodeSet &indices)
Link all the operands and check datatype.
const Slicer & getSlicer(const TableExprId &id)
Get the Slicer value for the slice.
TableExprNodeIndex(const TableExprNodeSet &indices, const TaQLStyle &=TaQLStyle(0))
Constructor.
IPosition getNodeShape(const TENShPtr &arrayNode) const
Get the shape of the node involved.
~TableExprNodeIndex() override=default
Destructor.
void fillSlicer(const TableExprId &id)
Fill the slicer for this row.
const Slicer & getConstantSlicer() const
Get the Slicer value for a constant index.
void convertConstIndex()
Precalculate the constant indices and store them.
void checkIndexValues(const TENShPtr &arrayNode)
Check if the index values match the dimensionality and shape of fixed-shaped array.
TableExprNodeMulti(NodeDataType, ValueType, OperType, const TableExprNodeRep &source)
Constructor.
Abstract base class for a node in a table column expression tree.
OperType
Define the operator types.
Bool isConstant() const
Is the expression a constant?
NodeDataType
Define the data types of a node.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
Definition aipsxtype.h:36
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
std::shared_ptr< TableExprNodeRep > TENShPtr
Definition ExprNodeRep.h:56
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:360
double Double
Definition aipstype.h:53