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