casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
35 
36 
37 namespace 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>
58 template<class T> inline
59  Bool allLE (const TableVector<T>& left, const TableVector<T>& right);
60 template<class T> inline
61  Bool allLT (const TableVector<T>& left, const TableVector<T>& right);
62 template<class T> inline
63  Bool allGE (const TableVector<T>& left, const TableVector<T>& right);
64 template<class T> inline
65  Bool allGT (const TableVector<T>& left, const TableVector<T>& right);
66 template<class T> inline
67  Bool allEQ (const TableVector<T>& left, const TableVector<T>& right);
68 template<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>
92 template<class T> inline
93  Bool allLE (const TableVector<T>& left, const T& right);
94 template<class T> inline
95  Bool allLE (const T& left, const TableVector<T>& right);
96 template<class T> inline
97  Bool allLT (const TableVector<T>& left, const T& right);
98 template<class T> inline
99  Bool allLT (const T& left, const TableVector<T>& right);
100 template<class T> inline
101  Bool allGE (const TableVector<T>& left, const T& right);
102 template<class T> inline
103  Bool allGE (const T& left, const TableVector<T>& right);
104 template<class T> inline
105  Bool allGT (const TableVector<T>& left, const T& right);
106 template<class T> inline
107  Bool allGT (const T& left, const TableVector<T>& right);
108 template<class T> inline
109  Bool allEQ (const TableVector<T>& left, const T& right);
110 template<class T> inline
111  Bool allEQ (const T& left, const TableVector<T>& right);
112 template<class T> inline
113  Bool allNE (const TableVector<T>& left, const T& right);
114 template<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) \
123 template<class T> inline \
124 Bool aips_name2(all,NAME) (const TableVector<T>& l, \
125  const TableVector<T>& r) \
126  { return aips_name2(tabVecReptv,NAME) (l.tabVec(), r.tabVec()); } \
127 template<class T> inline \
128 Bool aips_name2(all,NAME) (const T& val, const TableVector<T>& tv) \
129  { return aips_name2(tabVecRepvall,NAME) (val, tv.tabVec()); } \
130 template<class T> inline \
131 Bool aips_name2(all,NAME) (const TableVector<T>& tv, const T& val) \
132  { return aips_name2(tabVecRepvalr,NAME) (tv.tabVec(), val); }
133 
134 TABVECLOGICOPER(LE)
135 TABVECLOGICOPER(LT)
136 TABVECLOGICOPER(GE)
137 TABVECLOGICOPER(GT)
138 TABVECLOGICOPER(EQ)
139 TABVECLOGICOPER(NE)
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.
147 template<class T> inline
148 Bool anyLE (const TableVector<T>& l, const TableVector<T>& r)
149 {
150  return (allGT (l, r) ? False : True);
151 }
152 template<class T> inline
154 {
155  return (allGE (l, r) ? False : True);
156 }
157 template<class T> inline
159 {
160  return (allLT (l, r) ? False : True);
161 }
162 template<class T> inline
164 {
165  return (allLE (l, r) ? False : True);
166 }
167 template<class T> inline
169 {
170  return (allNE (l, r) ? False : True);
171 }
172 template<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.
185 template<class T> inline
186 Bool anyLE (const TableVector<T>& tv, const T &val)
187 {
188  return (allGT (tv, val) ? False : True);
189 }
190 template<class T> inline
191 Bool anyLE (const T &val, const TableVector<T>& tv)
192 {
193  return (allGT (val, tv) ? False : True);
194 }
195 template<class T> inline
196 Bool anyLT (const TableVector<T>& tv, const T &val)
197 {
198  return (allGE (tv, val) ? False : True);
199 }
200 template<class T> inline
201 Bool anyLT (const T &val, const TableVector<T>& tv)
202 {
203  return (allGE (val, tv) ? False : True);
204 }
205 template<class T> inline
206 Bool anyGE (const TableVector<T>& tv, const T &val)
207 {
208  return (allLT (tv, val) ? False : True);
209 }
210 template<class T> inline
211 Bool anyGE (const T &val, const TableVector<T>& tv)
212 {
213  return (allLT (val, tv) ? False : True);
214 }
215 template<class T> inline
216 Bool anyGT (const TableVector<T>& tv, const T &val)
217 {
218  return (allLE (tv, val) ? False : True);
219 }
220 template<class T> inline
221 Bool anyGT (const T &val, const TableVector<T>& tv)
222 {
223  return (allLE (val, tv) ? False : True);
224 }
225 template<class T> inline
226 Bool anyEQ (const TableVector<T>& tv, const T &val)
227 {
228  return (allNE (tv, val) ? False : True);
229 }
230 template<class T> inline
231 Bool anyEQ (const T &val, const TableVector<T>& tv)
232 {
233  return (allNE (val, tv) ? False : True);
234 }
235 template<class T> inline
236 Bool anyNE (const TableVector<T>& tv, const T &val)
237 {
238  return (allEQ (tv, val) ? False : True);
239 }
240 template<class T> inline
241 Bool 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
Bool anyLT(const TableVector< T > &l, const TableVector< T > &r)
Definition: TabVecLogic.h:153
Templated readonly table column vectors.
Definition: TableVector.h:118
Bool anyNE(const TableVector< T > &l, const TableVector< T > &r)
Definition: TabVecLogic.h:173
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Bool anyGE(const TableVector< T > &l, const TableVector< T > &r)
Definition: TabVecLogic.h:158
const Bool False
Definition: aipstype.h:44
Bool anyGT(const TableVector< T > &l, const TableVector< T > &r)
Definition: TabVecLogic.h:163
Bool anyEQ(const TableVector< T > &l, const TableVector< T > &r)
Definition: TabVecLogic.h:168
Bool anyLE(const TableVector< T > &l, const TableVector< T > &r)
Element by element comparisons between the &quot;l&quot; and &quot;r&quot; table vectors.
Definition: TabVecLogic.h:148
const Bool True
Definition: aipstype.h:43
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42