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