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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/iosfwd.h>
33#include <casacore/casa/Arrays/ArrayFwd.h>
34
35namespace casacore { //# NAMESPACE CASACORE - BEGIN
36
37//# Forward Declarations
38template <class Qtype> class 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
106public:
107 //# Enumerations
108
109 //# Typedefs
110
111 //# Friends
112 // Output a MeasValue
113 friend ostream &operator<<(ostream &os, const MeasValue &meas);
114
115 //# Constructor
116 // Each derived class should have at least the following constructors:
117 // <srcblock>
118 // MV() // some default
119 // MV(Double) // some default or error if vector expected
120 // MV(Vector<Double>) // with check for array number of elements
121 // MV(Quantity)
122 // MV(Vector<Quantity>)
123 // MV(Quantum<Vector<Double> >
124 // </srcblock>
125 // Float (or other standard type) versions could be added if appropiate.
126 // Dummy for cxx2html
127 void dummy_constr() const {;};
128
129 //# Destructor
130 // Destructor
131 virtual ~MeasValue();
132
133 //# Operators
134 // The following operators should be present at least.
135 // <srcblock>
136 // MV &operator+=(const MV &meas);
137 // MV &operator-=(const MV &meas);
138 // Bool operator==(const MV &meas) const;
139 // Bool operator!=(const MV &meas) const;
140 // Bool near(const MV &meas, Double tol = 1e-13) const;
141 // Bool nearAbs(const MV &meas, Double tol = 1e-13) const;
142 // </srcblock>
143 // Dummy for cxx2html
144 void dummy_operator() const {;};
145
146 //# General Member Functions
147 // Print a MeasValue
148 virtual void print(ostream &os) const = 0;
149
150 // Clone a MeasValue
151 virtual MeasValue *clone() const = 0;
152
153 // Get the internal value as a <src>Vector<Double></src>.
154 // Note that the vector could
155 // be empty, or not be a true representation (different data sizes e.g.)
156 virtual Vector<Double> getVector() const = 0;
157
158 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
159 // records. The getXRecordValue() gets additional information for records.
160 // The getTMRecordValue() gets the record values as deemed appropriate for
161 // the TableMeasures.
162 // Note that the Vectors could be empty.
163 // <group>
167 // </group>
168 // Set the internal value from a Vector of values (obtained in principle
169 // with a getVector()). It will be assumed that the Vector is correctly
170 // formatted. If Vector is too long, the remainder will be discarded.
171 // If Vector is too short, action will depend on the individual classes,
172 // but in general act the same way as a constructor with a short Vector.
173 virtual void putVector(const Vector<Double> &in) = 0;
174
175 // Set the internal value if correct values and dimensions
176 virtual Bool putValue(const Vector<Quantum<Double> > &in) = 0;
177
178 // Some of the Measure values used need the occasional adjustments to proper
179 // values. Examples are MVDirection (direction cosines) which have to be
180 // normalised to a length of 1 and MEpoch (time) which have to have its
181 // precision maintained. For others it is an effctive no-operation.
182 // <group>
183 // Adjust value
184 virtual void adjust();
185 // Adjust value and return a normalisation value
186 virtual void adjust(Double &val);
187 // Re-adjust, i.e. undo a previous adjust, with value
188 virtual void readjust(Double val);
189 // </group>
190private:
191};
192
193//# Global functions
194// <summary> Global functions </summary>
195// <group name=Output>
196// Output declaration
197ostream &operator<<(ostream &os, const MeasValue &meas);
198// </group>
200
201} //# NAMESPACE CASACORE - END
202
203#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:127
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:144
this file contains all the compiler specific defines
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.