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