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.
41 class TableExprNodeSetElemBase;
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 };
378
379
380
381 // <summary>
382 // Class defining a set element containing a continuous interval.
383 // </summary>
384
385 // <use visibility=export>
386
387 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
388 // </reviewed>
389
390 // <prerequisite>
391 //# Classes you should understand before using this one.
392 // <li> TableExprNodeSet
393 // <li> TableExprNodeRep
394 // </prerequisite>
395
396 // <synopsis>
397 // Class defining a set element containing a continuous interval.
398 // It consists of a start and/or an end scalar value of type int, double,
399 // datetime, or string. Data type int will be converted to double.
400 // The interval can be open (exclusive) or closed (inclusive) on either side.
401 // The interval can be unbounded by leaving out start or end.
402 // <br>Note that a continuous interval can also be given as mid-width
403 // using class TableExprNodeSetElemMidWidth.
404 // </synopsis>
405
407 {
408 public:
409 // Create the object for a continuous bounded interval. It can be
410 // open or closed on either side.
413
414 // Create the object for a continuous left-bounded interval.
416
417 // Create the object for a continuous right-bounded interval.
419
420 // Construct an element from the given parts and take over their pointers.
421 // It is used by evaluate to construct an element in a rather cheap way.
423 const TENShPtr& start, const TENShPtr& end);
424
425 ~TableExprNodeSetElemCont() override = default;
426
427 // Is the interval left or right closed?
428 // <group>
429 Bool isLeftClosed() const override;
430 Bool isRightClosed() const override;
431 // </group>
432
433 // Set a flag in the match output array if the corresponding element
434 // in the value array is included in this set element.
435 // This is used by the system to implement the IN operator.
436 // <br>Note that it does NOT set match values to False; it is assumed they
437 // are initialized that way.
438 // <group>
439 void matchDouble (Bool* match, const Double* value, size_t nval,
440 const TableExprId& id) const override;
441 void matchString (Bool* match, const String* value, size_t nval,
442 const TableExprId& id) const override;
443 void matchDate (Bool* match, const MVTime* value, size_t nval,
444 const TableExprId& id) const override;
445 // </group>
446
447 // Evaluate the element for the given row and construct a new
448 // (constant) element from it.
449 // This is used by the system to implement a set in a GIVING clause.
450 TENSEBShPtr evaluate (const TableExprId& id) const override;
451
452 protected:
453 // Constructor used by the derived class TableExprNodeSetElemMidWidth.
455 const TableExprNode& width);
456
457 private:
458 // Setup the object for a continuous interval.
461
462 //# Data members
465 };
466
467
468
469 // <summary>
470 // Class defining a set element containing a continuous mid/width interval.
471 // </summary>
472
473 // <use visibility=export>
474
475 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
476 // </reviewed>
477
478 // <prerequisite>
479 //# Classes you should understand before using this one.
480 // <li> TableExprNodeSet
481 // <li> TableExprNodeRep
482 // </prerequisite>
483
484 // <synopsis>
485 // Class, derived from TableExprNodeSetElemCont, defining a set element
486 // containing a continuous interval given its midpoint and width.
487 // It is defined as [mid-width/2,mid+width/2]. It is closed on both sides.
488 // It can only be used for data type double and datetime.
489 // In case of datetime the width must be a double with default unit d (days).
490 // <br>Following the definition of intervals in the MeasurementSet (note 223),
491 // the interval is infinite on both sides if the width is zero.
492 // </synopsis>
493
495 {
496 public:
497 // Create the object for a continuous bounded interval given as mid-width.
498 // It is closed on both sides.
500 const TableExprNode& width);
501
502 ~TableExprNodeSetElemMidWidth() override = default;
503
504 // The interval is given as mid-width.
505 Bool isMidWidth() const override;
506
507 // Set a flag in the match output array if the corresponding element
508 // in the value array is included in this set element.
509 // This is used by the system to implement the IN operator.
510 // <br>Note that it does NOT set match values to False; it is assumed they
511 // are initialized that way.
512 // <group>
513 void matchDouble (Bool* match, const Double* value, size_t nval,
514 const TableExprId& id) const override;
515 void matchDate (Bool* match, const MVTime* value, size_t nval,
516 const TableExprId& id) const override;
517 // </group>
518
519 // Evaluate the set element for the given row and construct a new
520 // (constant) TableExprNodeSetElemCont element from it.
521 // This is used by the system to implement a set in a GIVING clause.
522 TENSEBShPtr evaluate (const TableExprId& id) const override;
523 };
524
525
526
527 // <summary>
528 // Class to hold the table expression nodes for an element in a set.
529 // </summary>
530
531 // <use visibility=export>
532
533 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
534 // </reviewed>
535
536 // <prerequisite>
537 //# Classes you should understand before using this one.
538 // <li> TableExprNodeSet
539 // <li> TableExprNodeRep
540 // </prerequisite>
541
542 // <synopsis>
543 // This class hold a TableExprNodeSetElemBase pointer, thus points
544 // to an object of one its derived classes.
545 // <br>At the end of 2022 the old TableExprSetElem was split into several
546 // classes, one per element type. This class still exists for backward
547 // compatibilty, but is also useful in its own right. Its constructors create
548 // one of the derived TableExprNodeSetElemBase objects which mirror the
549 // TaQL specification, but can also be used directly in C++. The types are:
550 // <ul>
551 // <li> A single value; in TaQL: <src>max(array) or [2]</src>
552 // <li> A discrete range; in TaQL: <src>[1:101:3]</src>
553 // <li> A continuous start/end interval; in TaQL: <src>between 3 and 11</src>
554 // <li> A continuous mid/width interval; in TaQL: <src>around 7 in 8</src>
555 // </ul>
556 // <br>Note the difference between a discrete range and a continuous interval.
557 // The discrete range 2,6 consists of the values 1,4,7...100
558 // The continuous intervals consists of all values between 3 and 11.
559 // </synopsis>
560
562 {
563 public:
564 // Create from a Base element.
565 explicit TableExprNodeSetElem (const TENSEBShPtr& elem);
566
567 ~TableExprNodeSetElem() override = default;
568
569 // Create the object for a single expression node.
570 explicit TableExprNodeSetElem (const TableExprNode& node);
571
572 // Create the object for a discrete range.
573 // Each of the start, end, and incr pointers can be zero meaning
574 // that they are not given (see the synopsis for an explanation).
575 // Optionally the end is inclusive (C++ and Glish style) or exclusive
576 // (Python style).
578 const TableExprNode* end,
579 const TableExprNode* incr,
580 Bool isEndExcl = False);
581
582 // Create the object for a continuous bounded interval. It can be
583 // open or closed on either side.
586
587 // Create the object for a continuous left-bounded interval.
589
590 // Create the object for a continuous right-bounded interval.
592
593 // Create the object for a mid-width interval (closed on both sides).
595
596 // Get the internal pointer to the underlying TableExprNodeSetElemBase.
597 const TENSEBShPtr& getElem() const
598 { return itsElem; }
599
600 // Show the node.
601 void show (ostream& os, uInt indent) const override
602 { itsElem->show (os, indent); }
603
604 // Is it a discrete set element.
606 { return itsElem->isDiscrete(); }
607
608 // Is a single value given?
610 { return itsElem->isSingle(); }
611
612 // Is the interval left or right closed?
613 // <group>
615 { return itsElem->isLeftClosed(); }
617 { return itsElem->isRightClosed(); }
618 // </group>
619
620 // Is the interval given as mid-width?
622 { return itsElem->isMidWidth(); }
623
624 // Get the start, end or increment expression.
625 // Note that the shared pointer returned can be null indicating that a
626 // value was not given.
627 // <group>
628 const TENShPtr& start() const
629 { return itsElem->start(); }
630 const TENShPtr& end() const
631 { return itsElem->end(); }
632 const TENShPtr& increment() const
633 { return itsElem->increment(); }
634 // </group>
635
636 private:
637 // Set the data and expression type in the superclass.
638 void init();
639
640 //# Data members
642 };
643
644
645
646} //# NAMESPACE CASACORE - END
647
648#endif
String: the storage and methods of handling collections of characters.
Definition String.h:223
Abstract base class for a node in a table column expression tree.
NodeDataType
Define the data types of 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? Default implementation returns False.
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? Default implementation returns False.
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? Default implementation returns False.
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
Class defining a set element containing a continuous interval.
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
Class defining a set element containing a discrete range.
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
Class defining a set element containing a continuous mid/width interval.
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...
Class defining a set element containing a single value.
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...
Class to hold the table expression nodes for an element in a set.
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
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
double Double
Definition aipstype.h:53