casacore
Loading...
Searching...
No Matches
MeasBase.h
Go to the documentation of this file.
1// # MeasBase.h: Base class for all measures
2// # Copyright (C) 1995,1996,1997,1998,1999,2000,2002
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 MEASURES_MEASBASE_H
27#define MEASURES_MEASBASE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/ArrayFwd.h>
32#include <casacore/measures/Measures/Measure.h>
33#include <casacore/casa/Quanta/Quantum.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Typedefs
38
39// <summary> Base class for all measures </summary>
40
41// <use visibility=local>
42
43// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasure" demos="">
44// </reviewed>
45
46// <prerequisite>
47// <li> <linkto class=Measure>Measure</linkto> class
48// </prerequisite>
49//
50// <etymology>
51// Measure and Base
52// </etymology>
53//
54// <synopsis>
55// MeasBase forms derived Measure class for all actual measures
56// </synopsis>
57//
58// <example>
59// </example>
60//
61// <motivation>
62// To have most work in single routine
63// </motivation>
64//
65// <todo asof="1997/04/15">
66// <li>
67// </todo>
68// # Made non-virtual for MeasureHolder
69// #template<class Mv, class Mr> class MeasBase : public virtual Measure {
70template <class Mv, class Mr>
71class MeasBase : public Measure {
72 public:
73 // # Friends
74
75 // # Enumerations
76
77 // # Typedefs
78
79 // # Constructors
80 // <note role=tip> In the following constructors and other functions, all
81 // <em>MeasRef</em> can be replaced with simple <src>Measure::TYPE</src>
82 // where no offsets or frames are needed in the reference. For reasons
83 // of compiler limitations the formal arguments had to be specified as
84 // <em>uInt</em> rather than the Measure enums that should be used as actual
85 // arguments.</note>
86 // Default constructor
88 // Copy constructor
90 // Copy assignment
92 // Create from data and reference
93 // <group>
94 MeasBase(const Mv &dt, const Mr &rf);
95 MeasBase(const Mv &dt, uInt rf);
96 MeasBase(const Quantity &dt, const Mr &rf);
97 MeasBase(const Quantity &dt, uInt rf);
98 MeasBase(const Measure *dt);
99 MeasBase(const Mr &rf);
100 MeasBase(const uInt rf);
101 // </group>
102
103 // # Destructor
104 virtual ~MeasBase();
105
106 // # Operators
107
108 // # General Member Functions
109 // Check the type of derived entity
110 virtual Bool areYou(const String &tp) const;
111 // Assert that we are the correct type
112 // <thrown>
113 // <li> AipsError if wrong Measure
114 // </thrown>
115 virtual void assured(const String &tp) const;
116
117 // Refill the specified entities
118 // <group>
119 void set(const Mv &dt);
120 void set(const Mr &rf);
121 void set(const Mv &dt, const Mr &rf);
122 void set(const Unit &inunit);
123 virtual void set(const MeasValue &dt);
124 virtual Bool putValue(const Vector<Quantum<Double>> &in);
125 // </group>
126
127 // Get reference
128 Mr getRef() const;
129
130 // Get Measure data
131 // <group>
132 const Mv &getValue() const;
133 // </group>
134
135 // Get Unit
136 const Unit &getUnit() const;
137
138 // Get reference pointer
139 virtual MRBase *getRefPtr() const;
140
141 // Get pointer to data
142 virtual const MeasValue *getData() const;
143
144 // Print a Measure
145 virtual void print(std::ostream &os) const;
146
147 protected:
148 // # Enumerations
149
150 // # Data
151 // The measure value (e.g. instant in time)
153 // Reference frame data
154 Mr ref;
155 // Possible input units
157 // Error information
158 // MeasErr error;
159
160 private:
161 // # Member functions
162 // Clear the measure
163 void clear();
164};
165
166} // namespace casacore
167
168#ifndef CASACORE_NO_AUTO_TEMPLATES
169#include <casacore/measures/Measures/MeasBase.tcc>
170#endif // # CASACORE_NO_AUTO_TEMPLATES
171#endif
virtual Bool putValue(const Vector< Quantum< Double > > &in)
MeasBase(const Mv &dt, uInt rf)
virtual const MeasValue * getData() const
Get pointer to data.
Mv data
The measure value (e.g.
Definition MeasBase.h:152
virtual MRBase * getRefPtr() const
Get reference pointer.
void set(const Unit &inunit)
MeasBase(const Quantity &dt, uInt rf)
void set(const Mr &rf)
void set(const Mv &dt)
Refill the specified entities.
Mr getRef() const
Get reference.
virtual void assured(const String &tp) const
Assert that we are the correct type.
MeasBase(const uInt rf)
void clear()
Error information MeasErr error;.
virtual void print(std::ostream &os) const
Print a Measure.
MeasBase(const MeasBase< Mv, Mr > &other)
Copy constructor.
MeasBase(const Quantity &dt, const Mr &rf)
MeasBase(const Mv &dt, const Mr &rf)
Create from data and reference.
MeasBase(const Mr &rf)
virtual Bool areYou(const String &tp) const
Check the type of derived entity.
MeasBase(const Measure *dt)
virtual void set(const MeasValue &dt)
Each Measure should have the following set functions (with appropiate MVs and Ref):
const Unit & getUnit() const
Get Unit.
Unit unit
Possible input units.
Definition MeasBase.h:156
void set(const Mv &dt, const Mr &rf)
MeasBase()
Tip: In the following constructors and other functions, all MeasRef can be replaced with simple Measu...
Mr ref
Reference frame data.
Definition MeasBase.h:154
const Mv & getValue() const
Get Measure data.
MeasBase< Mv, Mr > & operator=(const MeasBase< Mv, Mr > &other)
Copy assignment.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Quantum< Double > Quantity
Definition Quantum.h:40