casacore
Loading...
Searching...
No Matches
MVDouble.h
Go to the documentation of this file.
1// # MVDouble.h: class to distinguish between internal and external Double
2// # Copyright (C) 1996,1997,1998,1999,2000,2001
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_MVDOUBLE_H
27#define CASA_MVDOUBLE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32#include <casacore/casa/Quanta/Quantum.h>
33#include <casacore/casa/Quanta/MeasValue.h>
34#include <casacore/casa/iosfwd.h>
35
36namespace casacore { // # NAMESPACE CASACORE - BEGIN
37
38// # Forward Declarations
39
40// # Constants (SUN compiler does not accept non-simple default arguments)
41
42// <summary> Class to distinguish external and Measure internal Double </summary>
43
44// <use visibility=export>
45
46// <reviewed reviewer="tcornwel" date="1996/02/23" tests="tMeasMath" demos="">
47// </reviewed>
48
49// <prerequisite>
50// <li> <linkto class=MeasValue>MeasValue</linkto>
51// </prerequisite>
52//
53// <etymology>
54// From Measure, Value and Double
55// </etymology>
56//
57// <synopsis>
58// An MVDouble is a simple Double, to be used in simple, single value
59// Measures. Requirements can be found in the
60// <linkto class=MeasValue>MeasValue</linkto> base class.<br>
61// The only reasonable constructor is (but all MeasValue constructors are present)
62// <src>MVDouble(Double)</src>; and an <src>operator Double</src> takes
63// care of all other possibilities. Its external use is for
64// <linkto class=MeasConvert>MeasConvert</linkto>, to distinguish between
65// input in internal Measure units, and values which have to have
66// units applied.
67// </synopsis>
68//
69// <example>
70// See e.g. <linkto class=MFrequency>MFrequency</linkto>
71// </example>
72//
73// <motivation>
74// To aid coordinate transformations possibilities
75// </motivation>
76//
77// <todo asof="1995/09/04">
78// </todo>
79
80class MVDouble : public MeasValue {
81 public:
82 // # Constructors
83 // Default constructor: generate a zero value
85 // Copy constructor
86 MVDouble(const MVDouble &other);
87 // Copy assignment
88 MVDouble &operator=(const MVDouble &other);
89 // Constructor from Double
91 // Constructor from Quantum : value taken will be the canonical value
92 // <group>
93 MVDouble(const Quantity &other);
95 // </group>
96 // Constructor from Vector. A zero value will be taken for an empty vector,
97 // the canonical value for a quantum vector.
98 // <thrown>
99 // <li> AipsError if vector length > 1
100 // </thrown>
101 // <group>
104 // </group>
105
106 // Destructor
108
109 // # Operators
110 // Conversion operator
111 operator Double() const;
112
113 // Addition
114 // <group>
117 // </group>
118 // Comparisons
119 // <group>
120 Bool operator==(const MVDouble &other) const;
121 Bool operator!=(const MVDouble &other) const;
122 Bool near(const MVDouble &other, Double tol = 1e-13) const;
123 Bool nearAbs(const MVDouble &other, Double tol = 1e-13) const;
124 // </group>
125
126 // # General member functions
127 // Tell me your type
128 // <group>
129 static void assure(const MeasValue &in);
130 // </group>
131 // Print data
132 virtual void print(ostream &os) const;
133 // Clone
134 virtual MeasValue *clone() const;
135 // Adjust value: taken from base class, a NOP.
136 // Get the value in internal units
137 virtual Vector<Double> getVector() const;
138 // Set the value from internal units (set 0 for empty vector)
139 virtual void putVector(const Vector<Double> &in);
140 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
141 // records. The getXRecordValue() gets additional information for records.
142 // Note that the Vectors could be empty.
143 // <group>
145 // </group>
146 // Set the internal value if correct values and dimensions
147 virtual Bool putValue(const Vector<Quantum<Double>> &in);
148
149 private:
150 // # Data
151 // Value
153};
154
155} // namespace casacore
156
157#endif
MVDouble()
Default constructor: generate a zero value.
virtual Vector< Quantum< Double > > getRecordValue() const
Get the internal value as a Vector<Quantity>.
MVDouble & operator-=(const MVDouble &other)
MVDouble(Double d)
Constructor from Double.
MVDouble(const Quantity &other)
Constructor from Quantum : value taken will be the canonical value.
Bool near(const MVDouble &other, Double tol=1e-13) const
MVDouble(const Vector< Quantity > &other)
Bool operator!=(const MVDouble &other) const
virtual MeasValue * clone() const
Clone.
MVDouble & operator=(const MVDouble &other)
Copy assignment.
Double val
Value.
Definition MVDouble.h:152
virtual void print(ostream &os) const
Print data.
MVDouble(const Quantum< Vector< Double > > &other)
MVDouble(const Vector< Double > &other)
Constructor from Vector.
MVDouble(const MVDouble &other)
Copy constructor.
static void assure(const MeasValue &in)
Tell me your type.
virtual void putVector(const Vector< Double > &in)
Set the value from internal units (set 0 for empty vector).
Bool operator==(const MVDouble &other) const
Comparisons.
virtual Bool putValue(const Vector< Quantum< Double > > &in)
Set the internal value if correct values and dimensions.
MVDouble & operator+=(const MVDouble &other)
Addition.
~MVDouble()
Destructor.
Bool nearAbs(const MVDouble &other, Double tol=1e-13) const
virtual Vector< Double > getVector() const
Adjust value: taken from base class, a NOP.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Quantum< Double > Quantity
Definition Quantum.h:40
double Double
Definition aipstype.h:53