casacore
Loading...
Searching...
No Matches
TabVecLogic.h
Go to the documentation of this file.
1// # TabVecLogic.h: Global functions for table vector logical operations
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_TABVECLOGIC_H
27#define TABLES_TABVECLOGIC_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/Tables/TableVector.h>
32#include <casacore/tables/Tables/TVecLogic.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// <summary>
37// Comparison between two table vectors
38// </summary>
39
40// <use visibility=local>
41
42// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
43// </reviewed>
44
45// <synopsis>
46// Element by element comparisons between the left and right table vectors.
47// The result is true only if the comparison is true for every element
48// of the table vectors.
49// At some point operators will be available that return masks where the
50// comparison is true.
51// The left and right operands must be conformant (i.e. have equal length).
52// </synopsis>
53
54// <group name=vectorComparison>
55template <class T>
56inline Bool allLE(const TableVector<T>& left, const TableVector<T>& right);
57template <class T>
58inline Bool allLT(const TableVector<T>& left, const TableVector<T>& right);
59template <class T>
60inline Bool allGE(const TableVector<T>& left, const TableVector<T>& right);
61template <class T>
62inline Bool allGT(const TableVector<T>& left, const TableVector<T>& right);
63template <class T>
64inline Bool allEQ(const TableVector<T>& left, const TableVector<T>& right);
65template <class T>
66inline Bool allNE(const TableVector<T>& left, const TableVector<T>& right);
67// </group>
68
69// <summary>
70// Comparison between a table vector and a scalar
71// </summary>
72
73// <use visibility=local>
74
75// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
76// </reviewed>
77
78// <synopsis>
79// Element by element comparisons between a table vector and a scalar,
80// which behaves as if it were a conformant table vector filled with the
81// scalar value.
82// At some point operators will be available that return masks where the
83// comparison is true.
84// </synopsis>
85
86// <group name=scalarComparison>
87template <class T>
88inline Bool allLE(const TableVector<T>& left, const T& right);
89template <class T>
90inline Bool allLE(const T& left, const TableVector<T>& right);
91template <class T>
92inline Bool allLT(const TableVector<T>& left, const T& right);
93template <class T>
94inline Bool allLT(const T& left, const TableVector<T>& right);
95template <class T>
96inline Bool allGE(const TableVector<T>& left, const T& right);
97template <class T>
98inline Bool allGE(const T& left, const TableVector<T>& right);
99template <class T>
100inline Bool allGT(const TableVector<T>& left, const T& right);
101template <class T>
102inline Bool allGT(const T& left, const TableVector<T>& right);
103template <class T>
104inline Bool allEQ(const TableVector<T>& left, const T& right);
105template <class T>
106inline Bool allEQ(const T& left, const TableVector<T>& right);
107template <class T>
108inline Bool allNE(const TableVector<T>& left, const T& right);
109template <class T>
110inline Bool allNE(const T& left, const TableVector<T>& right);
111// </group>
112
113// # Implement all functions inline.
114// # The actual work is done in TVecLogic.cc.
115// #
116#define TABVECLOGICOPER(NAME) \
117 template <class T> \
118 inline Bool aips_name2(all, NAME)(const TableVector<T>& l, const TableVector<T>& r) { \
119 return aips_name2(tabVecReptv, NAME)(l.tabVec(), r.tabVec()); \
120 } \
121 template <class T> \
122 inline Bool aips_name2(all, NAME)(const T& val, const TableVector<T>& tv) { \
123 return aips_name2(tabVecRepvall, NAME)(val, tv.tabVec()); \
124 } \
125 template <class T> \
126 inline Bool aips_name2(all, NAME)(const TableVector<T>& tv, const T& val) { \
127 return aips_name2(tabVecRepvalr, NAME)(tv.tabVec(), val); \
128 }
129
136
137//
138// Element by element comparisons between the "l" and "r" table vectors. The
139// result is true if the comparison is true for some element of the vectors.
140// At some point operators will be available that return masks where the
141// comparison is true. The vectors must conform or an exception is thrown.
142template <class T>
143inline Bool anyLE(const TableVector<T>& l, const TableVector<T>& r) {
144 return (allGT(l, r) ? False : True);
145}
146template <class T>
147inline Bool anyLT(const TableVector<T>& l, const TableVector<T>& r) {
148 return (allGE(l, r) ? False : True);
149}
150template <class T>
151inline Bool anyGE(const TableVector<T>& l, const TableVector<T>& r) {
152 return (allLT(l, r) ? False : True);
153}
154template <class T>
155inline Bool anyGT(const TableVector<T>& l, const TableVector<T>& r) {
156 return (allLE(l, r) ? False : True);
157}
158template <class T>
159inline Bool anyEQ(const TableVector<T>& l, const TableVector<T>& r) {
160 return (allNE(l, r) ? False : True);
161}
162template <class T>
163inline Bool anyNE(const TableVector<T>& l, const TableVector<T>& r) {
164 return (allEQ(l, r) ? False : True);
165}
166
167//
168// Element by element comparisons between a table vector and a scalar, which
169// behaves as if it were a conformant vector filled with the value "val."
170// The result is true if the comparison is true for some element of the vector.
171// At some point operators will be available that return masks where the
172// comparison is true.
173template <class T>
174inline Bool anyLE(const TableVector<T>& tv, const T& val) {
175 return (allGT(tv, val) ? False : True);
176}
177template <class T>
178inline Bool anyLE(const T& val, const TableVector<T>& tv) {
179 return (allGT(val, tv) ? False : True);
180}
181template <class T>
182inline Bool anyLT(const TableVector<T>& tv, const T& val) {
183 return (allGE(tv, val) ? False : True);
184}
185template <class T>
186inline Bool anyLT(const T& val, const TableVector<T>& tv) {
187 return (allGE(val, tv) ? False : True);
188}
189template <class T>
190inline Bool anyGE(const TableVector<T>& tv, const T& val) {
191 return (allLT(tv, val) ? False : True);
192}
193template <class T>
194inline Bool anyGE(const T& val, const TableVector<T>& tv) {
195 return (allLT(val, tv) ? False : True);
196}
197template <class T>
198inline Bool anyGT(const TableVector<T>& tv, const T& val) {
199 return (allLE(tv, val) ? False : True);
200}
201template <class T>
202inline Bool anyGT(const T& val, const TableVector<T>& tv) {
203 return (allLE(val, tv) ? False : True);
204}
205template <class T>
206inline Bool anyEQ(const TableVector<T>& tv, const T& val) {
207 return (allNE(tv, val) ? False : True);
208}
209template <class T>
210inline Bool anyEQ(const T& val, const TableVector<T>& tv) {
211 return (allNE(val, tv) ? False : True);
212}
213template <class T>
214inline Bool anyNE(const TableVector<T>& tv, const T& val) {
215 return (allEQ(tv, val) ? False : True);
216}
217template <class T>
218inline Bool anyNE(const T& val, const TableVector<T>& tv) {
219 return (allEQ(val, tv) ? False : True);
220}
221
222} // namespace casacore
223
224#ifndef CASACORE_NO_AUTO_TEMPLATES
225#include <casacore/tables/Tables/TabVecLogic.tcc>
226#endif // # CASACORE_NO_AUTO_TEMPLATES
227#endif
#define TABVECLOGICOPER(NAME)
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
Bool anyLT(const TableVector< T > &l, const TableVector< T > &r)
Bool anyGT(const TableVector< T > &l, const TableVector< T > &r)
Bool anyNE(const TableVector< T > &l, const TableVector< T > &r)
Bool anyEQ(const TableVector< T > &l, const TableVector< T > &r)
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41
Bool anyGE(const TableVector< T > &l, const TableVector< T > &r)
Bool anyLE(const TableVector< T > &l, const TableVector< T > &r)
Element by element comparisons between the "l" and "r" table vectors.
Comparison between a table vector and a scalar.
Definition TabVecLogic.h:87
Bool allNE(const T &left, const TableVector< T > &right)
Bool allLE(const TableVector< T > &left, const T &right)
Bool allGE(const T &left, const TableVector< T > &right)
Bool allEQ(const TableVector< T > &left, const T &right)
Bool allGT(const TableVector< T > &left, const T &right)
Bool allNE(const TableVector< T > &left, const T &right)
Bool allLT(const T &left, const TableVector< T > &right)
Bool allEQ(const T &left, const TableVector< T > &right)
Bool allGT(const T &left, const TableVector< T > &right)
Bool allLE(const T &left, const TableVector< T > &right)
Bool allGE(const TableVector< T > &left, const T &right)
Bool allLT(const TableVector< T > &left, const T &right)
Bool allGE(const TableVector< T > &left, const TableVector< T > &right)
Bool allLT(const TableVector< T > &left, const TableVector< T > &right)
Bool allGT(const TableVector< T > &left, const TableVector< T > &right)
Bool allNE(const TableVector< T > &left, const TableVector< T > &right)
Bool allLE(const TableVector< T > &left, const TableVector< T > &right)
Bool allEQ(const TableVector< T > &left, const TableVector< T > &right)