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