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