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
37class TableExprNode;
38
39// Define a shorthand for a shared pointer to TableExprNodeSetElemBase.
40// It will be used at several places.
42typedef std::shared_ptr<TableExprNodeSetElemBase> TENSEBShPtr;
43
44// <summary>
45// Base class for the classes defining set element
46// </summary>
47
48// <use visibility=local>
49
50// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
51// </reviewed>
52
53// <prerequisite>
54// # Classes you should understand before using this one.
55// <li> TableExprNodeSet
56// <li> TableExprNodeRep
57// </prerequisite>
58
59// <synopsis>
60// This class is used to assemble the table expression nodes
61// representing an element in a set. There are various types of elements
62// such as a single value, discrete range and continuous interval.
63// <br>The base class holds the possible start, end and increment value of
64// an element. It also has functions telling the overall expression which
65// columns and aggregate functions are used by an element.
66// </synopsis>
67
69 public:
70 // Constructor to initialize the parent.
72
73 virtual ~TableExprNodeSetElemBase() = default;
74
75 // A copy of a TableExprNodeSetElem cannot be made.
77
78 // Show the node.
79 void show(ostream& os, uInt indent) const override;
80
81 // Flatten the node tree by adding the node and its children to the vector.
82 virtual void flattenTree(std::vector<TableExprNodeRep*>&) override;
83
84 // Is it a discrete set element.
85 // Default implementation returns False.
86 virtual Bool isDiscrete() const;
87
88 // Is a single value given?
89 // Default implementation returns False.
90 virtual Bool isSingle() const;
91
92 // Is the interval left or right closed?
93 // Default implementation returns False.
94 // <group>
95 virtual Bool isLeftClosed() const;
96 virtual Bool isRightClosed() const;
97 // </group>
98
99 // Is the interval given as mid-width?
100 // Default implementation returns False.
101 virtual Bool isMidWidth() const;
102
103 // Get the start, end or increment expression.
104 // Note that the shared pointer returned can be null indicating that a
105 // value was not given.
106 // <group>
107 const TENShPtr& start() const { return itsStart; }
108 const TENShPtr& end() const { return itsEnd; }
109 const TENShPtr& increment() const { return itsIncr; }
110 // </group>
111
112 // Fill a vector with the value(s) from this element by appending them
113 // at the end of the vector; the end is given by argument <src>cnt</src>
114 // which gets incremented with the number of values appended.
115 // This is used by the system to convert a set to a vector.
116 // <group>
117 virtual void fillVector(Vector<Bool>& vec, Int64& cnt, const TableExprId& id) const;
118 virtual void fillVector(Vector<Int64>& vec, Int64& cnt, const TableExprId& id) const;
119 virtual void fillVector(Vector<Double>& vec, Int64& cnt, const TableExprId& id) const;
120 virtual void fillVector(Vector<DComplex>& vec, Int64& cnt, const TableExprId& id) const;
121 virtual void fillVector(Vector<String>& vec, Int64& cnt, const TableExprId& id) const;
122 virtual void fillVector(Vector<MVTime>& vec, Int64& cnt, const TableExprId& id) const;
123 // </group>
124
125 // Set a flag in the match output array if the corresponding element
126 // in the value array is included in this set element.
127 // This is used by the system to implement the IN operator.
128 // <br>Note that it does NOT set match values to False; it is assumed they
129 // are initialized that way.
130 // <group>
131 virtual void matchBool(Bool* match, const Bool* value, size_t nval, const TableExprId& id) const;
132 virtual void matchInt(Bool* match, const Int64* value, size_t nval, const TableExprId& id) const;
133 virtual void matchDouble(Bool* match, const Double* value, size_t nval,
134 const TableExprId& id) const;
135 virtual void matchDComplex(Bool* match, const DComplex* value, size_t nval,
136 const TableExprId& id) const;
137 virtual void matchString(Bool* match, const String* value, size_t nval,
138 const TableExprId& id) const;
139 virtual void matchDate(Bool* match, const MVTime* value, size_t nval,
140 const TableExprId& id) const;
141 // </group>
142
143 // Evaluate the element for the given row and construct a new
144 // (constant) element from it.
145 // This is used by the system to implement a set in a GIVING clause.
146 virtual TENSEBShPtr evaluate(const TableExprId& id) const = 0;
147
148 // Set the expression type (Variable or Constant) depending on the children.
150
151 // Let a set node convert itself to the given unit.
152 void adaptSetUnits(const Unit&) override;
153
154 // Get the start or end value of a Double or DateTime interval.
155 // <group>
156 void getStart(const TableExprId& id, Double&) const;
157 void getEnd(const TableExprId& id, Double&) const;
158 // </group>
159
160 // Get the start or end value of a String interval.
161 // <group>
162 void getStart(const TableExprId& id, String&) const;
163 void getEnd(const TableExprId& id, String&) const;
164 // </group>
165
166 protected:
167 // Evaluate the expression for the given row id.
168 TENShPtr evalExpr(const TENShPtr& expr, const TableExprId& id) const;
169
170 // # Data members.
171 // # They are put here, so function start(), etc. can be inlined.
172 // # Also getColumnNodes(), etc. make use of them.
176};
177
178// <summary>
179// Class defining a set element containing a single value.
180// </summary>
181
182// <use visibility=export>
183
184// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
185// </reviewed>
186
187// <prerequisite>
188// # Classes you should understand before using this one.
189// <li> TableExprNodeSet
190// <li> TableExprNodeRep
191// </prerequisite>
192
193// <synopsis>
194// This class defines a set element containing a single (discrete) value
195// which can be of any data type. The value can be a scalar or an array.
196// It can be used for 3 purposes:
197// <br>- A function argument.
198// <br>- A single index in an array indexing operation.
199// <br>- A single value in a set (used with the IN operator).
200// This is in fact a bounded discrete ramge (see TableExprNodeSetDiscrete).
201// </synopsis>
202
204 public:
205 // Create the object for a single expression node.
207
208 ~TableExprNodeSetElemSingle() override = default;
209
210 // It is a discrete set element.
211 Bool isDiscrete() const override;
212
213 // A single value is given (which can be an array).
214 Bool isSingle() const override;
215
216 // Fill a vector with the value(s) from this element by appending them
217 // at the end of the vector; the end is given by argument <src>cnt</src>
218 // which gets incremented with the number of values appended.
219 // This is used by the system to convert a set to a vector.
220 // <group>
221 void fillVector(Vector<Bool>& vec, Int64& cnt, const TableExprId& id) const override;
222 void fillVector(Vector<Int64>& vec, Int64& cnt, const TableExprId& id) const override;
223 void fillVector(Vector<Double>& vec, Int64& cnt, const TableExprId& id) const override;
224 void fillVector(Vector<DComplex>& vec, Int64& cnt, const TableExprId& id) const override;
225 void fillVector(Vector<String>& vec, Int64& cnt, const TableExprId& id) const override;
226 void fillVector(Vector<MVTime>& vec, Int64& cnt, const TableExprId& id) const override;
227 // </group>
228
229 // Set a flag in the match output array if the corresponding element
230 // in the value array is included in this set element.
231 // This is used by the system to implement the IN operator.
232 // <br>Note that it does NOT set match values to False; it is assumed they
233 // are initialized that way.
234 // <group>
235 void matchBool(Bool* match, const Bool* value, size_t nval, const TableExprId& id) const override;
236 void matchInt(Bool* match, const Int64* value, size_t nval, const TableExprId& id) const override;
237 void matchDouble(Bool* match, const Double* value, size_t nval,
238 const TableExprId& id) const override;
239 void matchDComplex(Bool* match, const DComplex* value, size_t nval,
240 const TableExprId& id) const override;
241 void matchString(Bool* match, const String* value, size_t nval,
242 const TableExprId& id) const override;
243 void matchDate(Bool* match, const MVTime* value, size_t nval,
244 const TableExprId& id) const override;
245 // </group>
246
247 // Evaluate the element for the given row and construct a new
248 // (constant) element from it.
249 // This is used by the system to implement a set in a GIVING clause.
250 TENSEBShPtr evaluate(const TableExprId& id) const override;
251
252 private:
253 // Construct an element from the given parts and take over their pointers.
254 // It is used by evaluate to construct an element in a rather cheap way.
256};
257
258// <summary>
259// Class defining a set element containing a discrete range.
260// </summary>
261
262// <use visibility=export>
263
264// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
265// </reviewed>
266
267// <prerequisite>
268// # Classes you should understand before using this one.
269// <li> TableExprNodeSet
270// <li> TableExprNodeRep
271// </prerequisite>
272
273// <synopsis>
274// Class defining a set element containing a discrete range (start:end:incr)
275// which can be of data type Int, Double and Datetime. They have to be scalars.
276// A range consists of a start, end and increment value, each of them optional.
277// Increment defaults to 1. The end value can be inclusive or exclusive
278// (as in Python).
279// It can be used for 2 purposes:
280// <br>- A slice in an array indexing operation which requires data
281// type Int. In that case start default to the beginning
282// of the dimension and end defaults to the end.
283// <br>- A discrete range in a set. Start has to be given.
284// If end is not given, the result is an unbounded discrete range.
285// <br>For a discrete range, the type of start and end can also be
286// a datetime scalar.
287// <br>A bounded discrete range is automatically
288// converted to a vector, which makes it possible to apply array
289// functions to it (e.g., date() + [0:31]).
290// </synopsis>
291
293 public:
294 // Create the object for a discrete range.
295 // Each of the start, end, and incr pointers can be null meaning
296 // that they are not given (see the synopsis for an explanation).
297 // Optionally the end is inclusive (C++ and Glish style) or exclusive
298 // (Python style).
300 const TableExprNode& incr, Bool isEndExcl = False);
301
302 ~TableExprNodeSetElemDiscrete() override = default;
303
304 // It is a discrete set element.
305 Bool isDiscrete() const override;
306
307 // Fill a vector with the value(s) from this element by appending them
308 // at the end of the vector; the end is given by argument <src>cnt</src>
309 // which gets incremented with the number of values appended.
310 // This is used by the system to convert a set to a vector.
311 // <group>
312 void fillVector(Vector<Int64>& vec, Int64& cnt, const TableExprId& id) const override;
313 void fillVector(Vector<Double>& vec, Int64& cnt, const TableExprId& id) const override;
314 void fillVector(Vector<MVTime>& vec, Int64& cnt, const TableExprId& id) const override;
315 // </group>
316
317 // Set a flag in the match output array if the corresponding element
318 // in the value array is included in this set element.
319 // This is used by the system to implement the IN operator.
320 // <br>Note that it does NOT set match values to False; it is assumed they
321 // are initialized that way.
322 // <group>
323 void matchInt(Bool* match, const Int64* value, size_t nval, const TableExprId& id) const override;
324 void matchDouble(Bool* match, const Double* value, size_t nval,
325 const TableExprId& id) const override;
326 void matchDate(Bool* match, const MVTime* value, size_t nval,
327 const TableExprId& id) const override;
328 // </group>
329
330 // Evaluate the element for the given row and construct a new
331 // (constant) element from it.
332 // This is used by the system to implement a set in a GIVING clause.
333 TENSEBShPtr evaluate(const TableExprId& id) const override;
334
335 private:
336 // Construct an element from the given parts and take over their pointers.
337 // It is used by evaluate to construct an element in a rather cheap way.
339 const TENShPtr& end, const TENShPtr& incr);
340
341 // # Data members
343 // Explicitly hide base function to prevent warning
345};
346
347// <summary>
348// Class defining a set element containing a continuous interval.
349// </summary>
350
351// <use visibility=export>
352
353// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
354// </reviewed>
355
356// <prerequisite>
357// # Classes you should understand before using this one.
358// <li> TableExprNodeSet
359// <li> TableExprNodeRep
360// </prerequisite>
361
362// <synopsis>
363// Class defining a set element containing a continuous interval.
364// It consists of a start and/or an end scalar value of type int, double,
365// datetime, or string. Data type int will be converted to double.
366// The interval can be open (exclusive) or closed (inclusive) on either side.
367// The interval can be unbounded by leaving out start or end.
368// <br>Note that a continuous interval can also be given as mid-width
369// using class TableExprNodeSetElemMidWidth.
370// </synopsis>
371
373 public:
374 // Create the object for a continuous bounded interval. It can be
375 // open or closed on either side.
378
379 // Create the object for a continuous left-bounded interval.
381
382 // Create the object for a continuous right-bounded interval.
384
385 // Construct an element from the given parts and take over their pointers.
386 // It is used by evaluate to construct an element in a rather cheap way.
388 const TENShPtr& end);
389
390 ~TableExprNodeSetElemCont() override = default;
391
392 // Is the interval left or right closed?
393 // <group>
394 Bool isLeftClosed() const override;
395 Bool isRightClosed() const override;
396 // </group>
397
398 // Set a flag in the match output array if the corresponding element
399 // in the value array is included in this set element.
400 // This is used by the system to implement the IN operator.
401 // <br>Note that it does NOT set match values to False; it is assumed they
402 // are initialized that way.
403 // <group>
404 void matchDouble(Bool* match, const Double* value, size_t nval,
405 const TableExprId& id) const override;
406 void matchString(Bool* match, const String* value, size_t nval,
407 const TableExprId& id) const override;
408 void matchDate(Bool* match, const MVTime* value, size_t nval,
409 const TableExprId& id) const override;
410 // </group>
411
412 // Evaluate the element for the given row and construct a new
413 // (constant) element from it.
414 // This is used by the system to implement a set in a GIVING clause.
415 TENSEBShPtr evaluate(const TableExprId& id) const override;
416
417 protected:
418 // Constructor used by the derived class TableExprNodeSetElemMidWidth.
420
421 private:
422 // Setup the object for a continuous interval.
425
426 // # Data members
429};
430
431// <summary>
432// Class defining a set element containing a continuous mid/width interval.
433// </summary>
434
435// <use visibility=export>
436
437// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
438// </reviewed>
439
440// <prerequisite>
441// # Classes you should understand before using this one.
442// <li> TableExprNodeSet
443// <li> TableExprNodeRep
444// </prerequisite>
445
446// <synopsis>
447// Class, derived from TableExprNodeSetElemCont, defining a set element
448// containing a continuous interval given its midpoint and width.
449// It is defined as [mid-width/2,mid+width/2]. It is closed on both sides.
450// It can only be used for data type double and datetime.
451// In case of datetime the width must be a double with default unit d (days).
452// <br>Following the definition of intervals in the MeasurementSet (note 223),
453// the interval is infinite on both sides if the width is zero.
454// </synopsis>
455
457 public:
458 // Create the object for a continuous bounded interval given as mid-width.
459 // It is closed on both sides.
461
462 ~TableExprNodeSetElemMidWidth() override = default;
463
464 // The interval is given as mid-width.
465 Bool isMidWidth() const override;
466
467 // Set a flag in the match output array if the corresponding element
468 // in the value array is included in this set element.
469 // This is used by the system to implement the IN operator.
470 // <br>Note that it does NOT set match values to False; it is assumed they
471 // are initialized that way.
472 // <group>
473 void matchDouble(Bool* match, const Double* value, size_t nval,
474 const TableExprId& id) const override;
475 void matchDate(Bool* match, const MVTime* value, size_t nval,
476 const TableExprId& id) const override;
477 // </group>
478
479 // Evaluate the set element for the given row and construct a new
480 // (constant) TableExprNodeSetElemCont element from it.
481 // This is used by the system to implement a set in a GIVING clause.
482 TENSEBShPtr evaluate(const TableExprId& id) const override;
483};
484
485// <summary>
486// Class to hold the table expression nodes for an element in a set.
487// </summary>
488
489// <use visibility=export>
490
491// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
492// </reviewed>
493
494// <prerequisite>
495// # Classes you should understand before using this one.
496// <li> TableExprNodeSet
497// <li> TableExprNodeRep
498// </prerequisite>
499
500// <synopsis>
501// This class hold a TableExprNodeSetElemBase pointer, thus points
502// to an object of one its derived classes.
503// <br>At the end of 2022 the old TableExprSetElem was split into several
504// classes, one per element type. This class still exists for backward
505// compatibility, but is also useful in its own right. Its constructors create
506// one of the derived TableExprNodeSetElemBase objects which mirror the
507// TaQL specification, but can also be used directly in C++. The types are:
508// <ul>
509// <li> A single value; in TaQL: <src>max(array) or [2]</src>
510// <li> A discrete range; in TaQL: <src>[1:101:3]</src>
511// <li> A continuous start/end interval; in TaQL: <src>between 3 and 11</src>
512// <li> A continuous mid/width interval; in TaQL: <src>around 7 in 8</src>
513// </ul>
514// <br>Note the difference between a discrete range and a continuous interval.
515// The discrete range 2,6 consists of the values 1,4,7...100
516// The continuous intervals consists of all values between 3 and 11.
517// </synopsis>
518
520 public:
521 // Create from a Base element.
522 explicit TableExprNodeSetElem(const TENSEBShPtr& elem);
523
524 ~TableExprNodeSetElem() override = default;
525
526 // Create the object for a single expression node.
527 explicit TableExprNodeSetElem(const TableExprNode& node);
528
529 // Create the object for a discrete range.
530 // Each of the start, end, and incr pointers can be zero meaning
531 // that they are not given (see the synopsis for an explanation).
532 // Optionally the end is inclusive (C++ and Glish style) or exclusive
533 // (Python style).
535 const TableExprNode* incr, Bool isEndExcl = False);
536
537 // Create the object for a continuous bounded interval. It can be
538 // open or closed on either side.
541
542 // Create the object for a continuous left-bounded interval.
544
545 // Create the object for a continuous right-bounded interval.
547
548 // Create the object for a mid-width interval (closed on both sides).
550
551 // Get the internal pointer to the underlying TableExprNodeSetElemBase.
552 const TENSEBShPtr& getElem() const { return itsElem; }
553
554 // Show the node.
555 void show(ostream& os, uInt indent) const override { itsElem->show(os, indent); }
556
557 // Is it a discrete set element.
558 Bool isDiscrete() const { return itsElem->isDiscrete(); }
559
560 // Is a single value given?
561 Bool isSingle() const { return itsElem->isSingle(); }
562
563 // Is the interval left or right closed?
564 // <group>
565 Bool isLeftClosed() const { return itsElem->isLeftClosed(); }
566 Bool isRightClosed() const { return itsElem->isRightClosed(); }
567 // </group>
568
569 // Is the interval given as mid-width?
570 Bool isMidWidth() const { return itsElem->isMidWidth(); }
571
572 // Get the start, end or increment expression.
573 // Note that the shared pointer returned can be null indicating that a
574 // value was not given.
575 // <group>
576 const TENShPtr& start() const { return itsElem->start(); }
577 const TENShPtr& end() const { return itsElem->end(); }
578 const TENShPtr& increment() const { return itsElem->increment(); }
579 // </group>
580
581 private:
582 // Set the data and expression type in the superclass.
583 void init();
584
585 // # Data members
587};
588
589} // namespace casacore
590
591#endif
String: the storage and methods of handling collections of characters.
Definition String.h:355
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.
For temporary backward namespace compatibility, use casa as alias for casacore.
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:56
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:360
double Double
Definition aipstype.h:53