File: ExprNodeSetElem.h

package info (click to toggle)
casacore 3.8.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 51,912 kB
  • sloc: cpp: 471,569; fortran: 16,372; ansic: 7,416; yacc: 4,714; lex: 2,346; sh: 1,865; python: 629; perl: 531; sed: 499; csh: 201; makefile: 32
file content (650 lines) | stat: -rw-r--r-- 25,883 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
//# ExprNodeSetElem.h: Classes representing a set element in table select expression
//# Copyright (C) 1997,2000,2001,2002,2003
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//#        Internet email: casa-feedback@nrao.edu.
//#        Postal address: AIPS++ Project Office
//#                        National Radio Astronomy Observatory
//#                        520 Edgemont Road
//#                        Charlottesville, VA 22903-2475 USA

#ifndef TABLES_EXPRNODESETELEM_H
#define TABLES_EXPRNODESETELEM_H

//# Includes
#include <casacore/casa/aips.h>
#include <casacore/tables/TaQL/ExprNodeRep.h>
#include <vector>

namespace casacore { //# NAMESPACE CASACORE - BEGIN

  //# Forward Declarations
  class TableExprNode;

  // Define a shorthand for a shared pointer to TableExprNodeSetElemBase.
  // It will be used at several places.
  class TableExprNodeSetElemBase;
  typedef std::shared_ptr<TableExprNodeSetElemBase> TENSEBShPtr;


  // <summary>
  // Base class for the classes defining set element
  // </summary>

  // <use visibility=local>

  // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
  // </reviewed>

  // <prerequisite>
  //# Classes you should understand before using this one.
  //   <li> TableExprNodeSet
  //   <li> TableExprNodeRep
  // </prerequisite>

  // <synopsis>
  // This class is used to assemble the table expression nodes
  // representing an element in a set. There are various types of elements
  // such as a single value, discrete range and continuous interval.
  // <br>The base class holds the possible start, end and increment value of
  // an element. It also has functions telling the overall expression which
  // columns and aggregate functions are used by an element.
  // </synopsis>

  class TableExprNodeSetElemBase: public TableExprNodeRep
  {
  public:
    // Constructor to initialize the parent.
    explicit TableExprNodeSetElemBase (NodeDataType = NTDouble);
    
    virtual ~TableExprNodeSetElemBase() = default;

    // A copy of a TableExprNodeSetElem cannot be made.
    TableExprNodeSetElemBase& operator= (const TableExprNodeSetElemBase&) = delete;

    // Show the node.
    void show (ostream& os, uInt indent) const override;

    // Flatten the node tree by adding the node and its children to the vector.
    virtual void flattenTree (std::vector<TableExprNodeRep*>&) override;

    // Is it a discrete set element.
    // Default implementation returns False.
    virtual Bool isDiscrete() const;

    // Is a single value given?
    // Default implementation returns False.
    virtual Bool isSingle() const;

    // Is the interval left or right closed?
    // Default implementation returns False.
    // <group>
    virtual Bool isLeftClosed() const;
    virtual Bool isRightClosed() const;
    // </group>

    // Is the interval given as mid-width?
    // Default implementation returns False.
    virtual Bool isMidWidth() const;

    // Get the start, end or increment expression.
    // Note that the shared pointer returned can be null indicating that a
    // value was not given.
    // <group>
    const TENShPtr& start() const
      { return itsStart; }
    const TENShPtr& end() const
      { return itsEnd; }
    const TENShPtr& increment() const
      { return itsIncr; }
    // </group>

    // Fill a vector with the value(s) from this element by appending them
    // at the end of the vector; the end is given by argument <src>cnt</src>
    // which gets incremented with the number of values appended.
    // This is used by the system to convert a set to a vector.
    // <group>
    virtual void fillVector (Vector<Bool>& vec, Int64& cnt,
                             const TableExprId& id) const;
    virtual void fillVector (Vector<Int64>& vec, Int64& cnt,
                             const TableExprId& id) const;
    virtual void fillVector (Vector<Double>& vec, Int64& cnt,
                             const TableExprId& id) const;
    virtual void fillVector (Vector<DComplex>& vec, Int64& cnt,
                             const TableExprId& id) const;
    virtual void fillVector (Vector<String>& vec, Int64& cnt,
                             const TableExprId& id) const;
    virtual void fillVector (Vector<MVTime>& vec, Int64& cnt,
                             const TableExprId& id) const;
    // </group>

    // Set a flag in the match output array if the corresponding element
    // in the value array is included in this set element.
    // This is used by the system to implement the IN operator.
    // <br>Note that it does NOT set match values to False; it is assumed they
    // are initialized that way.
    // <group>
    virtual void matchBool     (Bool* match, const Bool* value, size_t nval,
                                const TableExprId& id) const;
    virtual void matchInt      (Bool* match, const Int64* value, size_t nval,
                                const TableExprId& id) const;
    virtual void matchDouble   (Bool* match, const Double* value, size_t nval,
                                const TableExprId& id) const;
    virtual void matchDComplex (Bool* match, const DComplex* value, size_t nval,
                                const TableExprId& id) const;
    virtual void matchString   (Bool* match, const String* value, size_t nval,
                                const TableExprId& id) const;
    virtual void matchDate     (Bool* match, const MVTime* value, size_t nval,
                                const TableExprId& id) const;
    // </group>

    // Evaluate the element for the given row and construct a new
    // (constant) element from it.
    // This is used by the system to implement a set in a GIVING clause.
    virtual TENSEBShPtr evaluate (const TableExprId& id) const = 0;

    // Set the expression type (Variable or Constant) depending on the children.
    void setExprType();

    // Let a set node convert itself to the given unit.
    void adaptSetUnits (const Unit&) override;

    // Get the start or end value of a Double or DateTime interval.
    // <group>
    void getStart (const TableExprId& id, Double&) const;
    void getEnd (const TableExprId& id, Double& ) const;
    // </group>

    // Get the start or end value of a String interval.
    // <group>
    void getStart (const TableExprId& id, String&) const;
    void getEnd (const TableExprId& id, String&) const;
    // </group>

  protected:
    // Evaluate the expression for the given row id.
    TENShPtr evalExpr (const TENShPtr& expr, const TableExprId& id) const;

    //# Data members.
    //# They are put here, so function start(), etc. can be inlined.
    //# Also getColumnNodes(), etc. make use of them.
    TENShPtr itsStart;
    TENShPtr itsEnd;
    TENShPtr itsIncr;
  };


  // <summary>
  // Class defining a set element containing a single value.
  // </summary>

  // <use visibility=export>

  // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
  // </reviewed>

  // <prerequisite>
  //# Classes you should understand before using this one.
  //   <li> TableExprNodeSet
  //   <li> TableExprNodeRep
  // </prerequisite>

  // <synopsis>
  // This class defines a set element containing a single (discrete) value
  // which can be of any data type. The value can be a scalar or an array.
  // It can be used for 3 purposes:
  // <br>- A function argument.
  // <br>- A single index in an array indexing operation.
  // <br>- A single value in a set (used with the IN operator).
  //       This is in fact a bounded discrete ramge (see TableExprNodeSetDiscrete).
  // </synopsis>

  class TableExprNodeSetElemSingle: public TableExprNodeSetElemBase
  {
  public:
    // Create the object for a single expression node.
    explicit TableExprNodeSetElemSingle (const TableExprNode& node);

    ~TableExprNodeSetElemSingle() override = default;

    // It is a discrete set element.
    Bool isDiscrete() const override;

    // A single value is given (which can be an array).
    Bool isSingle() const override;

    // Fill a vector with the value(s) from this element by appending them
    // at the end of the vector; the end is given by argument <src>cnt</src>
    // which gets incremented with the number of values appended.
    // This is used by the system to convert a set to a vector.
    // <group>
    void fillVector (Vector<Bool>& vec, Int64& cnt,
                     const TableExprId& id) const override;
    void fillVector (Vector<Int64>& vec, Int64& cnt,
                     const TableExprId& id) const override;
    void fillVector (Vector<Double>& vec, Int64& cnt,
                     const TableExprId& id) const override;
    void fillVector (Vector<DComplex>& vec, Int64& cnt,
                     const TableExprId& id) const override;
    void fillVector (Vector<String>& vec, Int64& cnt,
                     const TableExprId& id) const override;
    void fillVector (Vector<MVTime>& vec, Int64& cnt,
                     const TableExprId& id) const override;
    // </group>

    // Set a flag in the match output array if the corresponding element
    // in the value array is included in this set element.
    // This is used by the system to implement the IN operator.
    // <br>Note that it does NOT set match values to False; it is assumed they
    // are initialized that way.
    // <group>
    void matchBool     (Bool* match, const Bool* value, size_t nval,
                        const TableExprId& id) const override;
    void matchInt      (Bool* match, const Int64* value, size_t nval,
                        const TableExprId& id) const override;
    void matchDouble   (Bool* match, const Double* value, size_t nval,
                        const TableExprId& id) const override;
    void matchDComplex (Bool* match, const DComplex* value, size_t nval,
                        const TableExprId& id) const override;
    void matchString   (Bool* match, const String* value, size_t nval,
                        const TableExprId& id) const override;
    void matchDate     (Bool* match, const MVTime* value, size_t nval,
                        const TableExprId& id) const override;
    // </group>

    // Evaluate the element for the given row and construct a new
    // (constant) element from it.
    // This is used by the system to implement a set in a GIVING clause.
    TENSEBShPtr evaluate (const TableExprId& id) const override;

  private:
    // Construct an element from the given parts and take over their pointers.
    // It is used by evaluate to construct an element in a rather cheap way.
    TableExprNodeSetElemSingle (const TableExprNodeSetElemSingle& that,
                                const TENShPtr& start);
  };


  
  // <summary>
  // Class defining a set element containing a discrete range.
  // </summary>

  // <use visibility=export>

  // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
  // </reviewed>

  // <prerequisite>
  //# Classes you should understand before using this one.
  //   <li> TableExprNodeSet
  //   <li> TableExprNodeRep
  // </prerequisite>

  // <synopsis>
  // Class defining a set element containing a discrete range (start:end:incr)
  // which can be of data type Int, Double and Datetime. They have to be scalars.
  // A range consists of a start, end and increment value, each of them optional.
  // Increment defaults to 1. The end value can be inclusive or exclusive
  // (as in Python).
  // It can be used for 2 purposes:
  // <br>- A slice in an array indexing operation which requires data
  //       type Int. In that case start default to the beginning
  //       of the dimension and end defaults to the end.
  // <br>- A discrete range in a set. Start has to be given.
  //       If end is not given, the result is an unbounded discrete range.
  // <br>For a discrete range, the type of start and end can also be
  // a datetime scalar.
  // <br>A bounded discrete range is automatically
  // converted to a vector, which makes it possible to apply array
  // functions to it (e.g., date() + [0:31]).
  // </synopsis>

  class TableExprNodeSetElemDiscrete: public TableExprNodeSetElemBase
  {
  public:
    // Create the object for a discrete range.
    // Each of the start, end, and incr pointers can be null meaning
    // that they are not given (see the synopsis for an explanation).
    // Optionally the end is inclusive (C++ and Glish style) or exclusive
    // (Python style).
    TableExprNodeSetElemDiscrete (const TableExprNode& start,
                                  const TableExprNode& end,
                                  const TableExprNode& incr,
                                  Bool isEndExcl = False);

    ~TableExprNodeSetElemDiscrete() override = default;

    // It is a discrete set element.
    Bool isDiscrete() const override;

    // Fill a vector with the value(s) from this element by appending them
    // at the end of the vector; the end is given by argument <src>cnt</src>
    // which gets incremented with the number of values appended.
    // This is used by the system to convert a set to a vector.
    // <group>
    void fillVector (Vector<Int64>& vec, Int64& cnt,
                     const TableExprId& id) const override;
    void fillVector (Vector<Double>& vec, Int64& cnt,
                     const TableExprId& id) const override;
    void fillVector (Vector<MVTime>& vec, Int64& cnt,
                     const TableExprId& id) const override;
    // </group>

    // Set a flag in the match output array if the corresponding element
    // in the value array is included in this set element.
    // This is used by the system to implement the IN operator.
    // <br>Note that it does NOT set match values to False; it is assumed they
    // are initialized that way.
    // <group>
    void matchInt      (Bool* match, const Int64* value, size_t nval,
                        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;
    // </group>

    // Evaluate the element for the given row and construct a new
    // (constant) element from it.
    // This is used by the system to implement a set in a GIVING clause.
    TENSEBShPtr evaluate (const TableExprId& id) const override;

  private:
    // Construct an element from the given parts and take over their pointers.
    // It is used by evaluate to construct an element in a rather cheap way.
    TableExprNodeSetElemDiscrete (const TableExprNodeSetElemDiscrete& that,
                                  const TENShPtr& start, const TENShPtr& end,
                                  const TENShPtr& incr);

    //# Data members
    Bool itsEndExcl;
    // Explicitly hide base function to prevent warning
    using TableExprNodeSetElemBase::fillVector;
  };


  
  // <summary>
  // Class defining a set element containing a continuous interval.
  // </summary>

  // <use visibility=export>

  // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
  // </reviewed>

  // <prerequisite>
  //# Classes you should understand before using this one.
  //   <li> TableExprNodeSet
  //   <li> TableExprNodeRep
  // </prerequisite>

  // <synopsis>
  // Class defining a set element containing a continuous interval.
  // It consists of a start and/or an end scalar value of type int, double,
  // datetime, or string. Data type int will be converted to double.
  // The interval can be open (exclusive) or closed (inclusive) on either side.
  // The interval can be unbounded by leaving out start or end.
  // <br>Note that a continuous interval can also be given as mid-width
  // using class TableExprNodeSetElemMidWidth.
  // </synopsis>

  class TableExprNodeSetElemCont: public TableExprNodeSetElemBase
  {
  public:
    // Create the object for a continuous bounded interval. It can be
    // open or closed on either side.
    TableExprNodeSetElemCont (Bool isLeftClosed, const TableExprNode& start,
                              const TableExprNode& end, Bool isRightClosed);

    // Create the object for a continuous left-bounded interval.
    TableExprNodeSetElemCont (Bool isLeftClosed, const TableExprNode& start);

    // Create the object for a continuous right-bounded interval.
    TableExprNodeSetElemCont (const TableExprNode& end, Bool isRightClosed);

    // Construct an element from the given parts and take over their pointers.
    // It is used by evaluate to construct an element in a rather cheap way.
    TableExprNodeSetElemCont (const TableExprNodeSetElemCont& that,
                              const TENShPtr& start, const TENShPtr& end);

    ~TableExprNodeSetElemCont() override = default;

    // Is the interval left or right closed?
    // <group>
    Bool isLeftClosed() const override;
    Bool isRightClosed() const override;
    // </group>

    // Set a flag in the match output array if the corresponding element
    // in the value array is included in this set element.
    // This is used by the system to implement the IN operator.
    // <br>Note that it does NOT set match values to False; it is assumed they
    // are initialized that way.
    // <group>
    void matchDouble   (Bool* match, const Double* value, size_t nval,
                        const TableExprId& id) const override;
    void matchString   (Bool* match, const String* value, size_t nval,
                        const TableExprId& id) const override;
    void matchDate     (Bool* match, const MVTime* value, size_t nval,
                        const TableExprId& id) const override;
    // </group>

    // Evaluate the element for the given row and construct a new
    // (constant) element from it.
    // This is used by the system to implement a set in a GIVING clause.
    TENSEBShPtr evaluate (const TableExprId& id) const override;

  protected:
    // Constructor used by the derived class TableExprNodeSetElemMidWidth.
    TableExprNodeSetElemCont (const TableExprNode& mid,
                              const TableExprNode& width);
    
  private:
    // Setup the object for a continuous interval.
    void setup (Bool isLeftClosed, const TableExprNode* start,
                const TableExprNode* end, Bool isRightClosed);

    //# Data members
    Bool itsLeftClosed;
    Bool itsRightClosed;
  };



  // <summary>
  // Class defining a set element containing a continuous mid/width interval.
  // </summary>

  // <use visibility=export>

  // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
  // </reviewed>

  // <prerequisite>
  //# Classes you should understand before using this one.
  //   <li> TableExprNodeSet
  //   <li> TableExprNodeRep
  // </prerequisite>

  // <synopsis>
  // Class, derived from TableExprNodeSetElemCont, defining a set element
  // containing a continuous interval given its midpoint and width.
  // It is defined as [mid-width/2,mid+width/2]. It is closed on both sides.
  // It can only be used for data type double and datetime.
  // In case of datetime the width must be a double with default unit d (days).
  // <br>Following the definition of intervals in the MeasurementSet (note 223),
  // the interval is infinite on both sides if the width is zero.
  // </synopsis>

  class TableExprNodeSetElemMidWidth: public TableExprNodeSetElemCont
  {
  public:
    // Create the object for a continuous bounded interval given as mid-width.
    // It is closed on both sides.
    TableExprNodeSetElemMidWidth (const TableExprNode& mid,
                                  const TableExprNode& width);

    ~TableExprNodeSetElemMidWidth() override = default;

    // The interval is given as mid-width.
    Bool isMidWidth() const override;

    // Set a flag in the match output array if the corresponding element
    // in the value array is included in this set element.
    // This is used by the system to implement the IN operator.
    // <br>Note that it does NOT set match values to False; it is assumed they
    // are initialized that way.
    // <group>
    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;
    // </group>

    // Evaluate the set element for the given row and construct a new
    // (constant) TableExprNodeSetElemCont element from it.
    // This is used by the system to implement a set in a GIVING clause.
    TENSEBShPtr evaluate (const TableExprId& id) const override;
  };


  
  // <summary>
  // Class to hold the table expression nodes for an element in a set.
  // </summary>

  // <use visibility=export>

  // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
  // </reviewed>

  // <prerequisite>
  //# Classes you should understand before using this one.
  //   <li> TableExprNodeSet
  //   <li> TableExprNodeRep
  // </prerequisite>

  // <synopsis>
  // This class hold a TableExprNodeSetElemBase pointer, thus points
  // to an object of one its derived classes.
  // <br>At the end of 2022 the old TableExprSetElem was split into several
  // classes, one per element type. This class still exists for backward
  // compatibilty, but is also useful in its own right. Its constructors create
  // one of the derived TableExprNodeSetElemBase objects which mirror the
  // TaQL specification, but can also be used directly in C++. The types are:
  // <ul>
  //  <li> A single value; in TaQL: <src>max(array)   or   [2]</src>
  //  <li> A discrete range; in TaQL: <src>[1:101:3]</src>
  //  <li> A continuous start/end interval; in TaQL: <src>between 3 and 11</src>
  //  <li> A continuous mid/width interval; in TaQL: <src>around 7 in 8</src>
  // </ul>
  // <br>Note the difference between a discrete range and a continuous interval.
  // The discrete range 2,6 consists of the values 1,4,7...100
  // The continuous intervals consists of all values between 3 and 11.
  // </synopsis>

  class TableExprNodeSetElem: public TableExprNodeRep
  {
  public:
    // Create from a Base element.
    explicit TableExprNodeSetElem (const TENSEBShPtr& elem);

    ~TableExprNodeSetElem() override = default;

    // Create the object for a single expression node.
    explicit TableExprNodeSetElem (const TableExprNode& node);

    // Create the object for a discrete range.
    // Each of the start, end, and incr pointers can be zero meaning
    // that they are not given (see the synopsis for an explanation).
    // Optionally the end is inclusive (C++ and Glish style) or exclusive
    // (Python style).
    TableExprNodeSetElem (const TableExprNode* start,
                          const TableExprNode* end,
                          const TableExprNode* incr,
                          Bool isEndExcl = False);

    // Create the object for a continuous bounded interval. It can be
    // open or closed on either side.
    TableExprNodeSetElem (Bool isLeftClosed, const TableExprNode& start,
                          const TableExprNode& end, Bool isRightClosed);

    // Create the object for a continuous left-bounded interval.
    TableExprNodeSetElem (Bool isLeftClosed, const TableExprNode& start);

    // Create the object for a continuous right-bounded interval.
    TableExprNodeSetElem (const TableExprNode& end, Bool isRightClosed);

    // Create the object for a mid-width interval (closed on both sides).
    TableExprNodeSetElem (const TableExprNode& mid, const TableExprNode& width);

    // Get the internal pointer to the underlying TableExprNodeSetElemBase.
    const TENSEBShPtr& getElem() const
      { return itsElem; }
    
    // Show the node.
    void show (ostream& os, uInt indent) const override
      { itsElem->show (os, indent); }

    // Is it a discrete set element.
    Bool isDiscrete() const
      { return itsElem->isDiscrete(); }

    // Is a single value given?
    Bool isSingle() const
      { return itsElem->isSingle(); }

    // Is the interval left or right closed?
    // <group>
    Bool isLeftClosed() const
      { return itsElem->isLeftClosed(); }
    Bool isRightClosed() const
      { return itsElem->isRightClosed(); }
    // </group>

    // Is the interval given as mid-width?
    Bool isMidWidth() const
      { return itsElem->isMidWidth(); }
    
    // Get the start, end or increment expression.
    // Note that the shared pointer returned can be null indicating that a
    // value was not given.
    // <group>
    const TENShPtr& start() const
      { return itsElem->start(); }
    const TENShPtr& end() const
      { return itsElem->end(); }
    const TENShPtr& increment() const
      { return itsElem->increment(); }
    // </group>

  private:
    // Set the data and expression type in the superclass.
    void init();
    
    //# Data members
    TENSEBShPtr itsElem;
  };



} //# NAMESPACE CASACORE - END

#endif