casacore
Loading...
Searching...
No Matches
ExprNodeSetElem.h
Go to the documentation of this file.
1//# ExprNodeSetElem.h: Classes representing a set element in table select expression
2//# Copyright (C) 1997,2000,2001,2002,2003
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This library is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU Library General Public License as published by
7//# the Free Software Foundation; either version 2 of the License, or (at your
8//# option) any later version.
9//#
10//# This library is distributed in the hope that it will be useful, but WITHOUT
11//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13//# License for more details.
14//#
15//# You should have received a copy of the GNU Library General Public License
16//# along with this library; if not, write to the Free Software Foundation,
17//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//# Internet email: 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_EXPRNODESETELEM_H
27#define TABLES_EXPRNODESETELEM_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/TaQL/ExprNodeRep.h>
32#include <vector>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36 //# Forward Declarations
37 class TableExprNode;
38
39 // Define a shorthand for a shared pointer to TableExprNodeSetElemBase.
40 // It will be used at several places.
42 typedef std::shared_ptr<TableExprNodeSetElemBase> TENSEBShPtr;
43
44
45 // <summary>
46 // Base class for the classes defining set element
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> TableExprNodeSet
57 // <li> TableExprNodeRep
58 // </prerequisite>
59
60 // <synopsis>
61 // This class is used to assemble the table expression nodes
62 // representing an element in a set. There are various types of elements
63 // such as a single value, discrete range and continuous interval.
64 // <br>The base class holds the possible start, end and increment value of
65 // an element. It also has functions telling the overall expression which
66 // columns and aggregate functions are used by an element.
67 // </synopsis>
68
70 {
71 public:
72 // Constructor to initialize the parent.
74
75 virtual ~TableExprNodeSetElemBase() = default;
76
77 // A copy of a TableExprNodeSetElem cannot be made.
79
80 // Show the node.
81 void show (ostream& os, uInt indent) const override;
82
83 // Flatten the node tree by adding the node and its children to the vector.
84 virtual void flattenTree (std::vector<TableExprNodeRep*>&) override;
85
86 // Is it a discrete set element.
87 // Default implementation returns False.
88 virtual Bool isDiscrete() const;
89
90 // Is a single value given?
91 // Default implementation returns False.
92 virtual Bool isSingle() const;
93
94 // Is the interval left or right closed?
95 // Default implementation returns False.
96 // <group>
97 virtual Bool isLeftClosed() const;
98 virtual Bool isRightClosed() const;
99 // </group>
100
101 // Is the interval given as mid-width?
102 // Default implementation returns False.
103 virtual Bool isMidWidth() const;
104
105 // Get the start, end or increment expression.
106 // Note that the shared pointer returned can be null indicating that a
107 // value was not given.
108 // <group>
109 const TENShPtr& start() const
110 { return itsStart; }
111 const TENShPtr& end() const
112 { return itsEnd; }
113 const TENShPtr& increment() const
114 { return itsIncr; }
115 // </group>
116
117 // Fill a vector with the value(s) from this element by appending them
118 // at the end of the vector; the end is given by argument <src>cnt</src>
119 // which gets incremented with the number of values appended.
120 // This is used by the system to convert a set to a vector.
121 // <group>
122 virtual void fillVector (Vector<Bool>& vec, Int64& cnt,
123 const TableExprId& id) const;
124 virtual void fillVector (Vector<Int64>& vec, Int64& cnt,
125 const TableExprId& id) const;
126 virtual void fillVector (Vector<Double>& vec, Int64& cnt,
127 const TableExprId& id) const;
128 virtual void fillVector (Vector<DComplex>& vec, Int64& cnt,
129 const TableExprId& id) const;
130 virtual void fillVector (Vector<String>& vec, Int64& cnt,
131 const TableExprId& id) const;
132 virtual void fillVector (Vector<MVTime>& vec, Int64& cnt,
133 const TableExprId& id) const;
134 // </group>
135
136 // Set a flag in the match output array if the corresponding element
137 // in the value array is included in this set element.
138 // This is used by the system to implement the IN operator.
139 // <br>Note that it does NOT set match values to False; it is assumed they
140 // are initialized that way.
141 // <group>
142 virtual void matchBool (Bool* match, const Bool* value, size_t nval,
143 const TableExprId& id) const;
144 virtual void matchInt (Bool* match, const Int64* value, size_t nval,
145 const TableExprId& id) const;
146 virtual void matchDouble (Bool* match, const Double* value, size_t nval,
147 const TableExprId& id) const;
148 virtual void matchDComplex (Bool* match, const DComplex* value, size_t nval,
149 const TableExprId& id) const;
150 virtual void matchString (Bool* match, const String* value, size_t nval,
151 const TableExprId& id) const;
152 virtual void matchDate (Bool* match, const MVTime* value, size_t nval,
153 const TableExprId& id) const;
154 // </group>
155
156 // Evaluate the element for the given row and construct a new
157 // (constant) element from it.
158 // This is used by the system to implement a set in a GIVING clause.
159 virtual TENSEBShPtr evaluate (const TableExprId& id) const = 0;
160
161 // Set the expression type (Variable or Constant) depending on the children.
163
164 // Let a set node convert itself to the given unit.
165 void adaptSetUnits (const Unit&) override;
166
167 // Get the start or end value of a Double or DateTime interval.
168 // <group>
169 void getStart (const TableExprId& id, Double&) const;
170 void getEnd (const TableExprId& id, Double& ) const;
171 // </group>
172
173 // Get the start or end value of a String interval.
174 // <group>
175 void getStart (const TableExprId& id, String&) const;
176 void getEnd (const TableExprId& id, String&) const;
177 // </group>
178
179 protected:
180 // Evaluate the expression for the given row id.
181 TENShPtr evalExpr (const TENShPtr& expr, const TableExprId& id) const;
182
183 //# Data members.
184 //# They are put here, so function start(), etc. can be inlined.
185 //# Also getColumnNodes(), etc. make use of them.
189 };
190
191
192 // <summary>
193 // Class defining a set element containing a single value.
194 // </summary>
195
196 // <use visibility=export>
197
198 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
199 // </reviewed>
200
201 // <prerequisite>
202 //# Classes you should understand before using this one.
203 // <li> TableExprNodeSet
204 // <li> TableExprNodeRep
205 // </prerequisite>
206
207 // <synopsis>
208 // This class defines a set element containing a single (discrete) value
209 // which can be of any data type. The value can be a scalar or an array.
210 // It can be used for 3 purposes:
211 // <br>- A function argument.
212 // <br>- A single index in an array indexing operation.
213 // <br>- A single value in a set (used with the IN operator).
214 // This is in fact a bounded discrete ramge (see TableExprNodeSetDiscrete).
215 // </synopsis>
216
218 {
219 public:
220 // Create the object for a single expression node.
222
223 ~TableExprNodeSetElemSingle() override = default;
224
225 // It is a discrete set element.
226 Bool isDiscrete() const override;
227
228 // A single value is given (which can be an array).
229 Bool isSingle() const override;
230
231 // Fill a vector with the value(s) from this element by appending them
232 // at the end of the vector; the end is given by argument <src>cnt</src>
233 // which gets incremented with the number of values appended.
234 // This is used by the system to convert a set to a vector.
235 // <group>
236 void fillVector (Vector<Bool>& vec, Int64& cnt,
237 const TableExprId& id) const override;
239 const TableExprId& id) const override;
241 const TableExprId& id) const override;
243 const TableExprId& id) const override;
245 const TableExprId& id) const override;
247 const TableExprId& id) const override;
248 // </group>
249
250 // Set a flag in the match output array if the corresponding element
251 // in the value array is included in this set element.
252 // This is used by the system to implement the IN operator.
253 // <br>Note that it does NOT set match values to False; it is assumed they
254 // are initialized that way.
255 // <group>
256 void matchBool (Bool* match, const Bool* value, size_t nval,
257 const TableExprId& id) const override;
258 void matchInt (Bool* match, const Int64* value, size_t nval,
259 const TableExprId& id) const override;
260 void matchDouble (Bool* match, const Double* value, size_t nval,
261 const TableExprId& id) const override;
262 void matchDComplex (Bool* match, const DComplex* value, size_t nval,
263 const TableExprId& id) const override;
264 void matchString (Bool* match, const String* value, size_t nval,
265 const TableExprId& id) const override;
266 void matchDate (Bool* match, const MVTime* value, size_t nval,
267 const TableExprId& id) const override;
268 // </group>
269
270 // Evaluate the element for the given row and construct a new
271 // (constant) element from it.
272 // This is used by the system to implement a set in a GIVING clause.
273 TENSEBShPtr evaluate (const TableExprId& id) const override;
274
275 private:
276 // Construct an element from the given parts and take over their pointers.
277 // It is used by evaluate to construct an element in a rather cheap way.
279 const TENShPtr& start);
280 };
281
282
283
284 // <summary>
285 // Class defining a set element containing a discrete range.
286 // </summary>
287
288 // <use visibility=export>
289
290 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
291 // </reviewed>
292
293 // <prerequisite>
294 //# Classes you should understand before using this one.
295 // <li> TableExprNodeSet
296 // <li> TableExprNodeRep
297 // </prerequisite>
298
299 // <synopsis>
300 // Class defining a set element containing a discrete range (start:end:incr)
301 // which can be of data type Int, Double and Datetime. They have to be scalars.
302 // A range consists of a start, end and increment value, each of them optional.
303 // Increment defaults to 1. The end value can be inclusive or exclusive
304 // (as in Python).
305 // It can be used for 2 purposes:
306 // <br>- A slice in an array indexing operation which requires data
307 // type Int. In that case start default to the beginning
308 // of the dimension and end defaults to the end.
309 // <br>- A discrete range in a set. Start has to be given.
310 // If end is not given, the result is an unbounded discrete range.
311 // <br>For a discrete range, the type of start and end can also be
312 // a datetime scalar.
313 // <br>A bounded discrete range is automatically
314 // converted to a vector, which makes it possible to apply array
315 // functions to it (e.g., date() + [0:31]).
316 // </synopsis>
317
319 {
320 public:
321 // Create the object for a discrete range.
322 // Each of the start, end, and incr pointers can be null meaning
323 // that they are not given (see the synopsis for an explanation).
324 // Optionally the end is inclusive (C++ and Glish style) or exclusive
325 // (Python style).
327 const TableExprNode& end,
328 const TableExprNode& incr,
329 Bool isEndExcl = False);
330
331 ~TableExprNodeSetElemDiscrete() override = default;
332
333 // It is a discrete set element.
334 Bool isDiscrete() const override;
335
336 // Fill a vector with the value(s) from this element by appending them
337 // at the end of the vector; the end is given by argument <src>cnt</src>
338 // which gets incremented with the number of values appended.
339 // This is used by the system to convert a set to a vector.
340 // <group>
342 const TableExprId& id) const override;
344 const TableExprId& id) const override;
346 const TableExprId& id) const override;
347 // </group>
348
349 // Set a flag in the match output array if the corresponding element
350 // in the value array is included in this set element.
351 // This is used by the system to implement the IN operator.
352 // <br>Note that it does NOT set match values to False; it is assumed they
353 // are initialized that way.
354 // <group>
355 void matchInt (Bool* match, const Int64* value, size_t nval,
356 const TableExprId& id) const override;
357 void matchDouble (Bool* match, const Double* value, size_t nval,
358 const TableExprId& id) const override;
359 void matchDate (Bool* match, const MVTime* value, size_t nval,
360 const TableExprId& id) const override;
361 // </group>
362
363 // Evaluate the element for the given row and construct a new
364 // (constant) element from it.
365 // This is used by the system to implement a set in a GIVING clause.
366 TENSEBShPtr evaluate (const TableExprId& id) const override;
367
368 private:
369 // Construct an element from the given parts and take over their pointers.
370 // It is used by evaluate to construct an element in a rather cheap way.
372 const TENShPtr& start, const TENShPtr& end,
373 const TENShPtr& incr);
374
375 //# Data members
377 // Explicitly hide base function to prevent warning
379 };
380
381
382
383 // <summary>
384 // Class defining a set element containing a continuous interval.
385 // </summary>
386
387 // <use visibility=export>
388
389 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
390 // </reviewed>
391
392 // <prerequisite>
393 //# Classes you should understand before using this one.
394 // <li> TableExprNodeSet
395 // <li> TableExprNodeRep
396 // </prerequisite>
397
398 // <synopsis>
399 // Class defining a set element containing a continuous interval.
400 // It consists of a start and/or an end scalar value of type int, double,
401 // datetime, or string. Data type int will be converted to double.
402 // The interval can be open (exclusive) or closed (inclusive) on either side.
403 // The interval can be unbounded by leaving out start or end.
404 // <br>Note that a continuous interval can also be given as mid-width
405 // using class TableExprNodeSetElemMidWidth.
406 // </synopsis>
407
409 {
410 public:
411 // Create the object for a continuous bounded interval. It can be
412 // open or closed on either side.
415
416 // Create the object for a continuous left-bounded interval.
418
419 // Create the object for a continuous right-bounded interval.
421
422 // Construct an element from the given parts and take over their pointers.
423 // It is used by evaluate to construct an element in a rather cheap way.
425 const TENShPtr& start, const TENShPtr& end);
426
427 ~TableExprNodeSetElemCont() override = default;
428
429 // Is the interval left or right closed?
430 // <group>
431 Bool isLeftClosed() const override;
432 Bool isRightClosed() const override;
433 // </group>
434
435 // Set a flag in the match output array if the corresponding element
436 // in the value array is included in this set element.
437 // This is used by the system to implement the IN operator.
438 // <br>Note that it does NOT set match values to False; it is assumed they
439 // are initialized that way.
440 // <group>
441 void matchDouble (Bool* match, const Double* value, size_t nval,
442 const TableExprId& id) const override;
443 void matchString (Bool* match, const String* value, size_t nval,
444 const TableExprId& id) const override;
445 void matchDate (Bool* match, const MVTime* value, size_t nval,
446 const TableExprId& id) const override;
447 // </group>
448
449 // Evaluate the element for the given row and construct a new
450 // (constant) element from it.
451 // This is used by the system to implement a set in a GIVING clause.
452 TENSEBShPtr evaluate (const TableExprId& id) const override;
453
454 protected:
455 // Constructor used by the derived class TableExprNodeSetElemMidWidth.
457 const TableExprNode& width);
458
459 private:
460 // Setup the object for a continuous interval.
463
464 //# Data members
467 };
468
469
470
471 // <summary>
472 // Class defining a set element containing a continuous mid/width interval.
473 // </summary>
474
475 // <use visibility=export>
476
477 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
478 // </reviewed>
479
480 // <prerequisite>
481 //# Classes you should understand before using this one.
482 // <li> TableExprNodeSet
483 // <li> TableExprNodeRep
484 // </prerequisite>
485
486 // <synopsis>
487 // Class, derived from TableExprNodeSetElemCont, defining a set element
488 // containing a continuous interval given its midpoint and width.
489 // It is defined as [mid-width/2,mid+width/2]. It is closed on both sides.
490 // It can only be used for data type double and datetime.
491 // In case of datetime the width must be a double with default unit d (days).
492 // <br>Following the definition of intervals in the MeasurementSet (note 223),
493 // the interval is infinite on both sides if the width is zero.
494 // </synopsis>
495
497 {
498 public:
499 // Create the object for a continuous bounded interval given as mid-width.
500 // It is closed on both sides.
502 const TableExprNode& width);
503
504 ~TableExprNodeSetElemMidWidth() override = default;
505
506 // The interval is given as mid-width.
507 Bool isMidWidth() const override;
508
509 // Set a flag in the match output array if the corresponding element
510 // in the value array is included in this set element.
511 // This is used by the system to implement the IN operator.
512 // <br>Note that it does NOT set match values to False; it is assumed they
513 // are initialized that way.
514 // <group>
515 void matchDouble (Bool* match, const Double* value, size_t nval,
516 const TableExprId& id) const override;
517 void matchDate (Bool* match, const MVTime* value, size_t nval,
518 const TableExprId& id) const override;
519 // </group>
520
521 // Evaluate the set element for the given row and construct a new
522 // (constant) TableExprNodeSetElemCont element from it.
523 // This is used by the system to implement a set in a GIVING clause.
524 TENSEBShPtr evaluate (const TableExprId& id) const override;
525 };
526
527
528
529 // <summary>
530 // Class to hold the table expression nodes for an element in a set.
531 // </summary>
532
533 // <use visibility=export>
534
535 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
536 // </reviewed>
537
538 // <prerequisite>
539 //# Classes you should understand before using this one.
540 // <li> TableExprNodeSet
541 // <li> TableExprNodeRep
542 // </prerequisite>
543
544 // <synopsis>
545 // This class hold a TableExprNodeSetElemBase pointer, thus points
546 // to an object of one its derived classes.
547 // <br>At the end of 2022 the old TableExprSetElem was split into several
548 // classes, one per element type. This class still exists for backward
549 // compatibilty, but is also useful in its own right. Its constructors create
550 // one of the derived TableExprNodeSetElemBase objects which mirror the
551 // TaQL specification, but can also be used directly in C++. The types are:
552 // <ul>
553 // <li> A single value; in TaQL: <src>max(array) or [2]</src>
554 // <li> A discrete range; in TaQL: <src>[1:101:3]</src>
555 // <li> A continuous start/end interval; in TaQL: <src>between 3 and 11</src>
556 // <li> A continuous mid/width interval; in TaQL: <src>around 7 in 8</src>
557 // </ul>
558 // <br>Note the difference between a discrete range and a continuous interval.
559 // The discrete range 2,6 consists of the values 1,4,7...100
560 // The continuous intervals consists of all values between 3 and 11.
561 // </synopsis>
562
564 {
565 public:
566 // Create from a Base element.
567 explicit TableExprNodeSetElem (const TENSEBShPtr& elem);
568
569 ~TableExprNodeSetElem() override = default;
570
571 // Create the object for a single expression node.
572 explicit TableExprNodeSetElem (const TableExprNode& node);
573
574 // Create the object for a discrete range.
575 // Each of the start, end, and incr pointers can be zero meaning
576 // that they are not given (see the synopsis for an explanation).
577 // Optionally the end is inclusive (C++ and Glish style) or exclusive
578 // (Python style).
580 const TableExprNode* end,
581 const TableExprNode* incr,
582 Bool isEndExcl = False);
583
584 // Create the object for a continuous bounded interval. It can be
585 // open or closed on either side.
588
589 // Create the object for a continuous left-bounded interval.
591
592 // Create the object for a continuous right-bounded interval.
594
595 // Create the object for a mid-width interval (closed on both sides).
597
598 // Get the internal pointer to the underlying TableExprNodeSetElemBase.
599 const TENSEBShPtr& getElem() const
600 { return itsElem; }
601
602 // Show the node.
603 void show (ostream& os, uInt indent) const override
604 { itsElem->show (os, indent); }
605
606 // Is it a discrete set element.
608 { return itsElem->isDiscrete(); }
609
610 // Is a single value given?
612 { return itsElem->isSingle(); }
613
614 // Is the interval left or right closed?
615 // <group>
617 { return itsElem->isLeftClosed(); }
619 { return itsElem->isRightClosed(); }
620 // </group>
621
622 // Is the interval given as mid-width?
624 { return itsElem->isMidWidth(); }
625
626 // Get the start, end or increment expression.
627 // Note that the shared pointer returned can be null indicating that a
628 // value was not given.
629 // <group>
630 const TENShPtr& start() const
631 { return itsElem->start(); }
632 const TENShPtr& end() const
633 { return itsElem->end(); }
634 const TENShPtr& increment() const
635 { return itsElem->increment(); }
636 // </group>
637
638 private:
639 // Set the data and expression type in the superclass.
640 void init();
641
642 //# Data members
644 };
645
646
647
648} //# NAMESPACE CASACORE - END
649
650#endif
String: the storage and methods of handling collections of characters.
Definition String.h:223
NodeDataType
Define the data types of a node.
TableExprNodeRep(NodeDataType, ValueType, OperType, ArgType, ExprType, Int ndim, const IPosition &shape)
Construct a node.
const TENShPtr & increment() const
void getStart(const TableExprId &id, Double &) const
Get the start or end value of a Double or DateTime interval.
void getStart(const TableExprId &id, String &) const
Get the start or end value of a String interval.
virtual void fillVector(Vector< Int64 > &vec, Int64 &cnt, const TableExprId &id) const
virtual void matchDComplex(Bool *match, const DComplex *value, size_t nval, const TableExprId &id) const
void adaptSetUnits(const Unit &) override
Let a set node convert itself to the given unit.
TableExprNodeSetElemBase & operator=(const TableExprNodeSetElemBase &)=delete
A copy of a TableExprNodeSetElem cannot be made.
virtual void fillVector(Vector< DComplex > &vec, Int64 &cnt, const TableExprId &id) const
virtual TENSEBShPtr evaluate(const TableExprId &id) const =0
Evaluate the element for the given row and construct a new (constant) element from it.
TableExprNodeSetElemBase(NodeDataType=NTDouble)
Constructor to initialize the parent.
virtual void fillVector(Vector< Double > &vec, Int64 &cnt, const TableExprId &id) const
TENShPtr evalExpr(const TENShPtr &expr, const TableExprId &id) const
Evaluate the expression for the given row id.
virtual Bool isMidWidth() const
Is the interval given as mid-width?
void getEnd(const TableExprId &id, Double &) const
virtual void flattenTree(std::vector< TableExprNodeRep * > &) override
Flatten the node tree by adding the node and its children to the vector.
virtual Bool isRightClosed() const
virtual void matchInt(Bool *match, const Int64 *value, size_t nval, const TableExprId &id) const
virtual void fillVector(Vector< MVTime > &vec, Int64 &cnt, const TableExprId &id) const
virtual Bool isDiscrete() const
Is it a discrete set element.
const TENShPtr & start() const
Get the start, end or increment expression.
virtual void matchString(Bool *match, const String *value, size_t nval, const TableExprId &id) const
virtual void matchBool(Bool *match, const Bool *value, size_t nval, const TableExprId &id) const
Set a flag in the match output array if the corresponding element in the value array is included in t...
virtual void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const
virtual ~TableExprNodeSetElemBase()=default
virtual void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const
void show(ostream &os, uInt indent) const override
Show the node.
virtual Bool isLeftClosed() const
Is the interval left or right closed?
virtual void fillVector(Vector< String > &vec, Int64 &cnt, const TableExprId &id) const
void setExprType()
Set the expression type (Variable or Constant) depending on the children.
virtual Bool isSingle() const
Is a single value given?
virtual void fillVector(Vector< Bool > &vec, Int64 &cnt, const TableExprId &id) const
Fill a vector with the value(s) from this element by appending them at the end of the vector; the end...
void getEnd(const TableExprId &id, String &) const
void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const override
TableExprNodeSetElemCont(const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous right-bounded interval.
Bool isRightClosed() const override
void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const override
Set a flag in the match output array if the corresponding element in the value array is included in t...
TableExprNodeSetElemCont(Bool isLeftClosed, const TableExprNode &start)
Create the object for a continuous left-bounded interval.
TableExprNodeSetElemCont(const TableExprNodeSetElemCont &that, const TENShPtr &start, const TENShPtr &end)
Construct an element from the given parts and take over their pointers.
TENSEBShPtr evaluate(const TableExprId &id) const override
Evaluate the element for the given row and construct a new (constant) element from it.
TableExprNodeSetElemCont(const TableExprNode &mid, const TableExprNode &width)
Constructor used by the derived class TableExprNodeSetElemMidWidth.
TableExprNodeSetElemCont(Bool isLeftClosed, const TableExprNode &start, const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous bounded interval.
void setup(Bool isLeftClosed, const TableExprNode *start, const TableExprNode *end, Bool isRightClosed)
Setup the object for a continuous interval.
~TableExprNodeSetElemCont() override=default
Bool isLeftClosed() const override
Is the interval left or right closed?
void matchString(Bool *match, const String *value, size_t nval, const TableExprId &id) const override
TableExprNodeSetElemDiscrete(const TableExprNodeSetElemDiscrete &that, const TENShPtr &start, const TENShPtr &end, const TENShPtr &incr)
Construct an element from the given parts and take over their pointers.
TableExprNodeSetElemDiscrete(const TableExprNode &start, const TableExprNode &end, const TableExprNode &incr, Bool isEndExcl=False)
Create the object for a discrete range.
void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const override
Bool isDiscrete() const override
It is a discrete set element.
void fillVector(Vector< Int64 > &vec, Int64 &cnt, const TableExprId &id) const override
Fill a vector with the value(s) from this element by appending them at the end of the vector; the end...
void matchInt(Bool *match, const Int64 *value, size_t nval, const TableExprId &id) const override
Set a flag in the match output array if the corresponding element in the value array is included in t...
void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const override
void fillVector(Vector< Double > &vec, Int64 &cnt, const TableExprId &id) const override
~TableExprNodeSetElemDiscrete() override=default
TENSEBShPtr evaluate(const TableExprId &id) const override
Evaluate the element for the given row and construct a new (constant) element from it.
void fillVector(Vector< MVTime > &vec, Int64 &cnt, const TableExprId &id) const override
TableExprNodeSetElemMidWidth(const TableExprNode &mid, const TableExprNode &width)
Create the object for a continuous bounded interval given as mid-width.
TENSEBShPtr evaluate(const TableExprId &id) const override
Evaluate the set element for the given row and construct a new (constant) TableExprNodeSetElemCont el...
void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const override
Bool isMidWidth() const override
The interval is given as mid-width.
~TableExprNodeSetElemMidWidth() override=default
void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const override
Set a flag in the match output array if the corresponding element in the value array is included in t...
TableExprNodeSetElemSingle(const TableExprNode &node)
Create the object for a single expression node.
void fillVector(Vector< String > &vec, Int64 &cnt, const TableExprId &id) const override
void matchInt(Bool *match, const Int64 *value, size_t nval, const TableExprId &id) const override
void fillVector(Vector< Bool > &vec, Int64 &cnt, const TableExprId &id) const override
Fill a vector with the value(s) from this element by appending them at the end of the vector; the end...
void matchString(Bool *match, const String *value, size_t nval, const TableExprId &id) const override
void matchDComplex(Bool *match, const DComplex *value, size_t nval, const TableExprId &id) const override
TENSEBShPtr evaluate(const TableExprId &id) const override
Evaluate the element for the given row and construct a new (constant) element from it.
Bool isDiscrete() const override
It is a discrete set element.
void fillVector(Vector< Int64 > &vec, Int64 &cnt, const TableExprId &id) const override
void matchDouble(Bool *match, const Double *value, size_t nval, const TableExprId &id) const override
void matchDate(Bool *match, const MVTime *value, size_t nval, const TableExprId &id) const override
void fillVector(Vector< Double > &vec, Int64 &cnt, const TableExprId &id) const override
~TableExprNodeSetElemSingle() override=default
void fillVector(Vector< MVTime > &vec, Int64 &cnt, const TableExprId &id) const override
void fillVector(Vector< DComplex > &vec, Int64 &cnt, const TableExprId &id) const override
Bool isSingle() const override
A single value is given (which can be an array).
TableExprNodeSetElemSingle(const TableExprNodeSetElemSingle &that, const TENShPtr &start)
Construct an element from the given parts and take over their pointers.
void matchBool(Bool *match, const Bool *value, size_t nval, const TableExprId &id) const override
Set a flag in the match output array if the corresponding element in the value array is included in t...
void show(ostream &os, uInt indent) const override
Show the node.
TableExprNodeSetElem(Bool isLeftClosed, const TableExprNode &start, const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous bounded interval.
TableExprNodeSetElem(const TableExprNode &end, Bool isRightClosed)
Create the object for a continuous right-bounded interval.
~TableExprNodeSetElem() override=default
const TENShPtr & end() const
TableExprNodeSetElem(const TableExprNode *start, const TableExprNode *end, const TableExprNode *incr, Bool isEndExcl=False)
Create the object for a discrete range.
const TENSEBShPtr & getElem() const
Get the internal pointer to the underlying TableExprNodeSetElemBase.
TableExprNodeSetElem(const TENSEBShPtr &elem)
Create from a Base element.
Bool isDiscrete() const
Is it a discrete set element.
const TENShPtr & increment() const
Bool isMidWidth() const
Is the interval given as mid-width?
void init()
Set the data and expression type in the superclass.
Bool isSingle() const
Is a single value given?
Bool isLeftClosed() const
Is the interval left or right closed?
TableExprNodeSetElem(const TableExprNode &mid, const TableExprNode &width)
Create the object for a mid-width interval (closed on both sides).
const TENShPtr & start() const
Get the start, end or increment expression.
TableExprNodeSetElem(const TableExprNode &node)
Create the object for a single expression node.
TableExprNodeSetElem(Bool isLeftClosed, const TableExprNode &start)
Create the object for a continuous left-bounded interval.
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
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
std::shared_ptr< TableExprNodeRep > TENShPtr
Definition ExprNodeRep.h:55
std::shared_ptr< TableExprNodeSetElemBase > TENSEBShPtr
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:368
double Double
Definition aipstype.h:53