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