casacore
Loading...
Searching...
No Matches
MeasValue.h
Go to the documentation of this file.
1// # MeasValue.h: Base class for values in a Measure
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_MEASVALUE_H
27#define CASA_MEASVALUE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/iosfwd.h>
32#include <casacore/casa/Arrays/ArrayFwd.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// # Forward Declarations
37template <class Qtype>
38class Quantum;
39
40// <summary>
41// Base class for values in a Measure
42// </summary>
43
44// <use visibility=export>
45
46// <reviewed reviewer="tcornwel" date="1996/02/22" tests="tMeasMath" demos="">
47// </reviewed>
48
49// <prerequisite>
50// <li> <linkto class=Measure>Measure</linkto> class
51// </prerequisite>
52//
53// <etymology>
54// </etymology>
55//
56// <synopsis>
57// MeasValue forms the abstract base class for the values of quantities within
58// a reference frame. Examples of derived classes are:
59// <ul>
60// <li> <linkto class=MVEpoch>MVEpoch</linkto>: a moment in time
61// <li> <linkto class=MVDirection>MVDirection</linkto>: a direction in space
62// <li> <linkto class=MVPosition>MVPosition</linkto>: a position on Earth
63// <li> <linkto class=MVFrequency>MVFrequency</linkto>
64// <li> <linkto class=MVRadialVelocity>MVRadialVelocity</linkto>
65// <li> <linkto class=MVDoppler>MVDoppler</linkto>
66// </ul>
67// MeasValue is the generic name for the more specific instances like, e.g.,
68// <linkto class=MVEpoch>MVEpoch</linkto>, an instant in time.<br>
69// MeasValues can in general be constructed from an appropiate value, or array
70// of values.<br>
71// The value can be expressed in the internally used units (e.g.
72// days for time, a 3-vector for direction in space), as an array of internally
73// used units, or as a <linkto class=Quantum>Quantum</linkto>: a value with
74// appropiate units. <src>Vector<Quantum<type> ></src>
75// and <src>Quantum<Vector<type> ></src> can
76// also be used.
77//
78// The value of the <src>MeasValue</src> can be obtained by a variety of
79// <src>get</src> functions, returning in general internal or <src>Quantum</src>
80// values. Special formatting (like hh:mm:ss.t, dd.mm.ss.t, yy/mm/dd etc)
81// are catered for in <em>conversion-type</em> classes like
82// <linkto class=MVTime>MVTime</linkto>, <linkto class=MVAngle>MVAngle</linkto>
83//
84// Note that the class is a pure virtual class. No instances can be created,
85// but it describes the minimum set of functions necessary in derived functions.
86// <note role=warning> In the member description a number of <em>dummy</em> routines are
87// present. They are the only way I have found to get <em>cxx2html</em> to
88// get the belonging text properly presented.
89// </note>
90// </synopsis>
91//
92// <example>
93// See individual MV and Measure classes
94// </example>
95//
96// <motivation>
97// To be able to specify a physical entity appropiate for the measured
98// quantity.
99// </motivation>
100//
101// <todo asof="1997/04/15">
102// </todo>
103
105 public:
106 // # Enumerations
107
108 // # Typedefs
109
110 // # Friends
111 // Output a MeasValue
112 friend ostream &operator<<(ostream &os, const MeasValue &meas);
113
114 // # Constructor
115 // Each derived class should have at least the following constructors:
116 // <srcblock>
117 // MV() // some default
118 // MV(Double) // some default or error if vector expected
119 // MV(Vector<Double>) // with check for array number of elements
120 // MV(Quantity)
121 // MV(Vector<Quantity>)
122 // MV(Quantum<Vector<Double> >
123 // </srcblock>
124 // Float (or other standard type) versions could be added if appropiate.
125 // Dummy for cxx2html
126 void dummy_constr() const { ; };
127
128 // # Destructor
129 // Destructor
130 virtual ~MeasValue();
131
132 // # Operators
133 // The following operators should be present at least.
134 // <srcblock>
135 // MV &operator+=(const MV &meas);
136 // MV &operator-=(const MV &meas);
137 // Bool operator==(const MV &meas) const;
138 // Bool operator!=(const MV &meas) const;
139 // Bool near(const MV &meas, Double tol = 1e-13) const;
140 // Bool nearAbs(const MV &meas, Double tol = 1e-13) const;
141 // </srcblock>
142 // Dummy for cxx2html
143 void dummy_operator() const { ; };
144
145 // # General Member Functions
146 // Print a MeasValue
147 virtual void print(ostream &os) const = 0;
148
149 // Clone a MeasValue
150 virtual MeasValue *clone() const = 0;
151
152 // Get the internal value as a <src>Vector<Double></src>.
153 // Note that the vector could
154 // be empty, or not be a true representation (different data sizes e.g.)
155 virtual Vector<Double> getVector() const = 0;
156
157 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
158 // records. The getXRecordValue() gets additional information for records.
159 // The getTMRecordValue() gets the record values as deemed appropriate for
160 // the TableMeasures.
161 // Note that the Vectors could be empty.
162 // <group>
166 // </group>
167 // Set the internal value from a Vector of values (obtained in principle
168 // with a getVector()). It will be assumed that the Vector is correctly
169 // formatted. If Vector is too long, the remainder will be discarded.
170 // If Vector is too short, action will depend on the individual classes,
171 // but in general act the same way as a constructor with a short Vector.
172 virtual void putVector(const Vector<Double> &in) = 0;
173
174 // Set the internal value if correct values and dimensions
175 virtual Bool putValue(const Vector<Quantum<Double>> &in) = 0;
176
177 // Some of the Measure values used need the occasional adjustments to proper
178 // values. Examples are MVDirection (direction cosines) which have to be
179 // normalised to a length of 1 and MEpoch (time) which have to have its
180 // precision maintained. For others it is an effctive no-operation.
181 // <group>
182 // Adjust value
183 virtual void adjust();
184 // Adjust value and return a normalisation value
185 virtual void adjust(Double &val);
186 // Re-adjust, i.e. undo a previous adjust, with value
187 virtual void readjust(Double val);
188 // </group>
189 private:
190};
191
192// # Global functions
193// <summary> Global functions </summary>
194// <group name=Output>
195// Output declaration
196ostream &operator<<(ostream &os, const MeasValue &meas);
197// </group>
199} // namespace casacore
200
201#endif
friend ostream & operator<<(ostream &os, const MeasValue &meas)
Output a MeasValue.
virtual void putVector(const Vector< Double > &in)=0
Set the internal value from a Vector of values (obtained in principle with a getVector()).
virtual Vector< Quantum< Double > > getXRecordValue() const
virtual ~MeasValue()
Destructor.
virtual void readjust(Double val)
Re-adjust, i.e.
virtual Vector< Quantum< Double > > getTMRecordValue() const
virtual Vector< Quantum< Double > > getRecordValue() const =0
Get the internal value as a Vector<Quantity>.
virtual void adjust()
Some of the Measure values used need the occasional adjustments to proper values.
virtual void print(ostream &os) const =0
Print a MeasValue.
virtual Vector< Double > getVector() const =0
Get the internal value as a Vector<Double>.
virtual MeasValue * clone() const =0
Clone a MeasValue.
virtual Bool putValue(const Vector< Quantum< Double > > &in)=0
Set the internal value if correct values and dimensions.
void dummy_constr() const
Each derived class should have at least the following constructors:
Definition MeasValue.h:126
virtual void adjust(Double &val)
Adjust value and return a normalisation value.
void dummy_operator() const
The following operators should be present at least.
Definition MeasValue.h:143
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53
ostream & operator<<(ostream &os, const MeasValue &meas)
Output declaration.