casacore
Loading...
Searching...
No Matches
QLogical.h
Go to the documentation of this file.
1//# QLogical.h: class to manipulate physical, dimensioned quantities
2//# Copyright (C) 1994,1995,1996,1998,1999,2000
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 CASA_QLOGICAL_H
27#define CASA_QLOGICAL_H
28
29
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Quanta/Quantum.h>
33#include <casacore/casa/Arrays/ArrayFwd.h>
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37//# Forward Declarations
38
39//# Typedefs
40
41// <summary>
42// Logical operations for the Quantum class.
43// </summary>
44
45// <use visibility=export>
46
47// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tQuantum">
48//
49// <prerequisite>
50// <li> <linkto class=Unit>Unit</linkto>
51// <li> <linkto class=Quantum>Quantum</linkto>
52// </prerequisite>
53//
54// <etymology>
55// QLogical derived from Quantum logical functions
56// </etymology>
57//
58// <synopsis>
59// Quantities are values with a unit. Their basic specification can be one of
60// two forms:
61// <srcblock>
62// Quantity( Double value, String unit); // or: Unit unit
63// Quantum<Type> ( Type value, String unit) // or: Unit unit
64// </srcblock>
65//
66// A unit is a string of known unit fields separated
67// by 'space' or '.' (to indicate multiply) or '/' (to indicate divide).
68// See the <linkto class=Unit>Unit</linkto> class for details.
69// Example: km/s/(Mpc.s)2 is identical to km.s-1.Mpc-2.s-2
70//
71// This file defines the logical operations that can be done on
72// <linkto class=Quantum><src>Quantum<T></src></linkto>.
73//
74// They can be subdivided into various groupings:
75// <ul>
76// <li> <linkto file="QLogical.h#equality">Straight comparisons:
77// unequal if non-conforming units or different values</linkto>
78// <li> <linkto file="QLogical.h#compare">Comparisons</linkto>
79// <li> <linkto file="QLogical.h#foreign">Special make Bool routines
80// to cater for array comparisons</linkto>
81// </ul>
82//
83// The operations defined are:
84// <ul>
85// <li> Quantum<T> == Quantum<T> or ==T
86// <li> Quantum<T> != Quantum<T> or !=T
87// <li> > < >= <= of Quantum<T> or T and Quantum<T>
88// <li> near, nearAbs(Quantum<T> or T, Quantum<T> or T [, tolerance])
89// </ul>
90// </synopsis>
91//
92// <motivation>
93// To separate the logical operations from Quantum
94// </motivation>
95//
96// <todo asof="941201">
97// <li> Some inlining (did not work first go)
98// <li> Recode with allEQ etc if part of library for all data types,
99// and get rid of the special QMakeBool(), and the
100// include LogiArrayFwd.h
101// </todo>
102//
103// <linkfrom anchor="Quantum logical operations" classes="Quantum">
104// <here>Quantum logical operations</here> -- Logical operations
105// for the Quantum class.
106// </linkfrom>
107
108// <group name="Quantum logical operations">
110//
111// Straight comparisons: unequal if non-conforming units or different values
112// if units made equal. I.e. <src> 1in != 1m </src>,
113// <src> 1in != 1s </src>, <src> 36in == 1yd </src>./
114// <group name="equality">
115template <class Qtype>
116Bool operator==(const Quantum<Qtype> &left, const Quantum<Qtype> &other);
117template <class Qtype>
118Bool operator==(const Quantum<Qtype> &left, const Qtype &other);
119template <class Qtype>
120Bool operator==(const Qtype &left, const Quantum<Qtype> &other);
121template <class Qtype>
122Bool operator!=(const Quantum<Qtype> &left, const Quantum<Qtype> &other);
123template <class Qtype>
124Bool operator!=(const Quantum<Qtype> &left, const Qtype &other);
125template <class Qtype>
126Bool operator!=(const Qtype &left, const Quantum<Qtype> &other);
127// </group>
128
129// Near-ness tests: unequal if non-conforming units. In other cases the
130// tolerance is in the units of the first argument, with the second argument
131// converted, if necessary, to the same units as the first.
132// Note (SUN?) compiler does not accept default arguments in template functions
133// <group name="near">
134template <class Qtype>
135Bool near(const Quantum<Qtype> &left, const Quantum<Qtype> &other);
136template <class Qtype>
137Bool near(const Quantum<Qtype> &left, const Quantum<Qtype> &other,
138 Double tol);
139template <class Qtype>
140Bool near(const Quantum<Qtype> &left, const Qtype &other);
141template <class Qtype>
142Bool near(const Quantum<Qtype> &left, const Qtype &other,
143 Double tol);
144template <class Qtype>
145Bool near(const Qtype &left, const Quantum<Qtype> &other);
146template <class Qtype>
147Bool near(const Qtype &left, const Quantum<Qtype> &other,
148 Double tol);
149template <class Qtype>
150Bool nearAbs(const Quantum<Qtype> &left, const Quantum<Qtype> &other);
151template <class Qtype>
152Bool nearAbs(const Quantum<Qtype> &left, const Quantum<Qtype> &other,
153 Double tol);
154template <class Qtype>
155Bool nearAbs(const Quantum<Qtype> &left, const Quantum<Qtype> &other,
156 const Quantum<Qtype>& tol);
157template <class Qtype>
158Bool nearAbs(const Quantum<Qtype> &left, const Qtype &other);
159template <class Qtype>
160Bool nearAbs(const Quantum<Qtype> &left, const Qtype &other,
161 Double tol);
162template <class Qtype>
163Bool nearAbs(const Qtype &left, const Quantum<Qtype> &other);
164template <class Qtype>
165Bool nearAbs(const Qtype &left, const Quantum<Qtype> &other,
166 Double tol);
167// </group>
168//
169// Comparisons. The comparisons are done on values at equal units with
170// transparent conversion if necessary.
171// <thrown>
172// <li> AipsError if non-conforming units
173// </thrown>
174// <group name="compare">
175template <class Qtype>
176Bool operator<(const Quantum<Qtype> &left, const Quantum<Qtype> &other);
177template <class Qtype>
178Bool operator<(const Quantum<Qtype> &left, const Qtype &other);
179template <class Qtype>
180Bool operator<(const Qtype &left, const Quantum<Qtype> &other);
181template <class Qtype>
182Bool operator>(const Quantum<Qtype> &left, const Quantum<Qtype> &other);
183template <class Qtype>
184Bool operator>(const Quantum<Qtype> &left, const Qtype &other);
185template <class Qtype>
186Bool operator>(const Qtype &left, const Quantum<Qtype> &other);
187template <class Qtype>
188Bool operator<=(const Quantum<Qtype> &left, const Quantum<Qtype> &other);
189template <class Qtype>
190Bool operator<=(const Quantum<Qtype> &left, const Qtype &other);
191template <class Qtype>
192Bool operator<=(const Qtype &left, const Quantum<Qtype> &other);
193template <class Qtype>
194Bool operator>=(const Quantum<Qtype> &left, const Quantum<Qtype> &other);
195template <class Qtype>
196Bool operator>=(const Quantum<Qtype> &left, const Qtype &other);
197template <class Qtype>
198Bool operator>=(const Qtype &left, const Quantum<Qtype> &other);
199// </group>
200//
201// Special make Bool routines to cater for array comparisons
202// <group name="foreign">
203Bool QMakeBool(Int val);
205// </group>
206
207//# Inline Implementations
208
209// </group>
210
211
212} //# NAMESPACE CASACORE - END
213
214#ifndef CASACORE_NO_AUTO_TEMPLATES
215#include <casacore/casa/Quanta/QLogical.tcc>
216#endif //# CASACORE_NO_AUTO_TEMPLATES
217#endif
this file contains all the compiler specific defines
Definition mainpage.dox:28
Bool operator<=(const MVTime &lh, const MVTime &rh)
Definition MVTime.h:468
TableExprNode nearAbs(const TableExprNode &left, const TableExprNode &right)
Definition ExprNode.h:1254
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition Allocator.h:127
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition Allocator.h:133
Bool operator<(const MVTime &lh, const MVTime &rh)
Definition MVTime.h:466
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Bool operator>=(const MVTime &lh, const MVTime &rh)
Definition MVTime.h:472
Bool operator>(const MVTime &lh, const MVTime &rh)
Definition MVTime.h:470
double Double
Definition aipstype.h:53
Bool near(const GaussianBeam &left, const GaussianBeam &other, const Double relWidthTol, const Quantity &absPaTol)
Bool operator==(const Quantum< Qtype > &left, const Quantum< Qtype > &other)
Straight comparisons: unequal if non-conforming units or different values if units made equal.
Bool nearAbs(const Quantum< Qtype > &left, const Qtype &other)
Bool operator<(const Quantum< Qtype > &left, const Quantum< Qtype > &other)
Comparisons.
Bool operator==(const Quantum< Qtype > &left, const Qtype &other)
Bool operator<=(const Quantum< Qtype > &left, const Quantum< Qtype > &other)
Bool operator>=(const Quantum< Qtype > &left, const Quantum< Qtype > &other)
Bool nearAbs(const Qtype &left, const Quantum< Qtype > &other, Double tol)
Bool nearAbs(const Quantum< Qtype > &left, const Quantum< Qtype > &other, const Quantum< Qtype > &tol)
Bool operator!=(const Quantum< Qtype > &left, const Quantum< Qtype > &other)
Bool operator>=(const Qtype &left, const Quantum< Qtype > &other)
Bool operator>(const Quantum< Qtype > &left, const Quantum< Qtype > &other)
Bool nearAbs(const Qtype &left, const Quantum< Qtype > &other)
Bool nearAbs(const Quantum< Qtype > &left, const Quantum< Qtype > &other, Double tol)
Bool near(const Quantum< Qtype > &left, const Qtype &other)
Bool operator>=(const Quantum< Qtype > &left, const Qtype &other)
Bool operator>(const Qtype &left, const Quantum< Qtype > &other)
Bool nearAbs(const Quantum< Qtype > &left, const Quantum< Qtype > &other)
Bool nearAbs(const Quantum< Qtype > &left, const Qtype &other, Double tol)
Bool operator>(const Quantum< Qtype > &left, const Qtype &other)
Bool operator!=(const Quantum< Qtype > &left, const Qtype &other)
Bool near(const Qtype &left, const Quantum< Qtype > &other)
Bool operator<=(const Qtype &left, const Quantum< Qtype > &other)
Bool QMakeBool(Int val)
Special make Bool routines to cater for array comparisons
Bool operator==(const Qtype &left, const Quantum< Qtype > &other)
Bool near(const Quantum< Qtype > &left, const Qtype &other, Double tol)
Bool operator<(const Qtype &left, const Quantum< Qtype > &other)
Bool operator<(const Quantum< Qtype > &left, const Qtype &other)
Bool near(const Quantum< Qtype > &left, const Quantum< Qtype > &other)
Near-ness tests: unequal if non-conforming units.
Bool near(const Quantum< Qtype > &left, const Quantum< Qtype > &other, Double tol)
Bool operator!=(const Qtype &left, const Quantum< Qtype > &other)
Bool near(const Qtype &left, const Quantum< Qtype > &other, Double tol)
Bool operator<=(const Quantum< Qtype > &left, const Qtype &other)