casacore
Loading...
Searching...
No Matches
ExprRange.h
Go to the documentation of this file.
1// # ExprRange.h: Select range of a column in an select expression
2// # Copyright (C) 1994,1995,1999
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_EXPRRANGE_H
27#define TABLES_EXPRRANGE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// # Forward Declarations
36class TableColumn;
37
38// <summary>
39// Select range of a column in an select expression
40// </summary>
41
42// <use visibility=local>
43
44// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
45// </reviewed>
46
47// <prerequisite>
48// # Classes you should understand before using this one.
49// <li> TableExprNode
50// </prerequisite>
51
52// <etymology>
53// TableExprRange represents the ranges of a column as specified in
54// a table select expression.
55// </etymology>
56
57// <synopsis>
58// TableExprRange holds the ranges of values for a column as specified
59// in a table select expression.
60// It traverses the expression tree and composes the hull of the values.
61// Only double values are taken into account.
62// It can handle operators &&, ||, ==, >, >=, <, <=, !.
63// It can handle a comparison operator only for a column with a constant.
64// Other operators and expressions are non-convertable.
65//
66// The ranges function in class TableExprNode returns a Block
67// of TableExprRange objects which contains the ranges for each
68// (applicable) column used in the expression.
69// </synopsis>
70
71// <motivation>
72// TableExprRange gives great possibilities in optimizing a table
73// selection. It allows to get a rough estimate of the values needed
74// for a column which can be used to do a fast preselect using an index.
75// </motivation>
76
77// <todo asof="$DATE:$">
78// # A List of bugs, limitations, extensions or planned refinements.
79// <li> Support other data types than double
80// <li> Recognize that 2*COL<3 is equal to COL<3/2
81// </todo>
82
84 public:
85 // Default constructor (needed for Block<TableExprRange>).
87
88 // Construct from a column and a single constant range.
89 TableExprRange(const TableColumn&, double stval, double endval);
90
91 // Copy constructor.
93
95
96 // Assignment operator (copy semantics).
98
99 // Return the vector of start values.
100 // Together with the equally sized vector of end values, this forms
101 // the ranges for the column (which can be acquired using getColumn).
102 const Vector<double>& start() const;
103
104 // Return the vector of end values.
105 // Together with the equally sized vector of start values, this forms
106 // the ranges for the column (which can be acquired using getColumn).
107 const Vector<double>& end() const;
108
109 // Return the column object.
110 const TableColumn& getColumn() const;
111
112 //*display 4
113 // Mix with another range for an AND expression.
114 void mixAnd(const TableExprRange&);
115
116 //*display 4
117 // Mix with another range for an OR expression.
118 void mixOr(const TableExprRange&);
119
120 private:
121 Vector<double> sval_p; // # start values
122 Vector<double> eval_p; // # end values
123 TableColumn* tabColPtr_p; // # pointer to column
124};
125
126inline const Vector<double>& TableExprRange::start() const { return sval_p; }
127inline const Vector<double>& TableExprRange::end() const { return eval_p; }
128
129} // namespace casacore
130
131#endif
TableExprRange(const TableExprRange &)
Copy constructor.
void mixOr(const TableExprRange &)
TableColumn * tabColPtr_p
Definition ExprRange.h:123
Vector< double > sval_p
Definition ExprRange.h:121
const TableColumn & getColumn() const
Return the column object.
TableExprRange()
Default constructor (needed for Block<TableExprRange>).
TableExprRange(const TableColumn &, double stval, double endval)
Construct from a column and a single constant range.
TableExprRange & operator=(const TableExprRange &)
Assignment operator (copy semantics).
Vector< double > eval_p
Definition ExprRange.h:122
void mixAnd(const TableExprRange &)
const Vector< double > & end() const
Return the vector of end values.
Definition ExprRange.h:127
const Vector< double > & start() const
Return the vector of start values.
Definition ExprRange.h:126
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28