casacore
Loading...
Searching...
No Matches
QBase.h
Go to the documentation of this file.
1//# QBase.h: base class for Quantum
2//# Copyright (C) 1994,1995,1996,1998,1999
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_QBASE_H
27#define CASA_QBASE_H
28
29
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/casa/Quanta/Unit.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36//# Forward Declarations
37
38class LogIO;
39
40//# Typedefs
41
42//
43// <summary>
44// Base for Quantities (i.e. dimensioned values)
45// </summary>
46
47// <use visibility=local>
48
49// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tQuantum">
50//
51// <prerequisite>
52// <li> <linkto class=Unit>Unit</linkto>
53// </prerequisite>
54//
55// <etymology>
56// QBase is the base class for <linkto class=Quantum>Quantum</linkto>.
57// </etymology>
58//
59// <synopsis>
60// Quantities are values with a unit. Their basic specification can be one of
61// two forms:
62// <srcblock>
63// Quantity( Double value, String unit); // or: Unit unit
64// Quantum<Type> ( Type value, String unit) // or: Unit unit
65// </srcblock>
66// See <linkto class=Quantum>Quantum</linkto> for details.
67// </synopsis>
68//
69// <motivation>
70// To provide the possibilty of mixing units from different
71// <src>Quantum<T1></src>, <src>Quantum<T2></src>
72// </motivation>
73//
74// <todo asof="941123">
75// <li> Some inlining (did not work first go)
76// </todo>
77
78class QBase {
79 //# Friends
80
81public:
82 //# Constructors
83 // Default constructor, generates ""
85 // Construct dimensioned QBase (e.g. 'km/Mpc')
86 // <thrown>
87 // <li> AipsError if non-matching unit dimensions
88 // </thrown>
89 // <group>
90 QBase(const Unit &s);
91 // </group>
92
93 // Destructor
94 virtual ~QBase();
95
96 //# Member functions
97 // Get units of QBase
98 // <group name="get">
99 // Return the string representation of the current units attached to QBase
100 const String &getUnit() const;
101 // </group>
102
103 // Re-specify parts of a QBase
104 // <group name="set">
105 // Set new unit, without changing value
106 void setUnit(const Unit &s);
107 // Set new unit, copied from specified QBase, without changing value
108 void setUnit(const QBase &other);
109 // </group>
110
111 // Check for conformal matching units (e.g. dam and Mpc)
112 // <group name="check">
113 // Using specified units
114 Bool isConform(const Unit &s) const;
115 // Using units specified in QBase
116 Bool isConform(const QBase &other) const;
117 // </group>
118
119 // Get a copy of Quantum
120 virtual QBase *clone() const = 0;
121 // Get the unit attached to the Quantum (use getUnit() if only interested in
122 // the String part of the unit)
123 virtual const Unit &getFullUnit() const = 0;
124 // Print a Quantum
125 virtual void print(ostream &os) const = 0;
126 // Get the type of derived Quantum (using QuantumType).
127 // All should have:
128 // static uInt myType();
129 virtual uInt type() const = 0;
130
131protected:
132 //# Data members
134};
135
136//# Inline Implementations
137
138//# Global functions
139// <summary> Global functions </summary>
140// <group name=Output>
141// Output declaration
142ostream &operator<<(ostream &os, const QBase &meas);
143LogIO &operator<<(LogIO &os, const QBase &meas);
145// </group>
146
147
148} //# NAMESPACE CASACORE - END
149
150#endif
virtual const Unit & getFullUnit() const =0
Get the unit attached to the Quantum (use getUnit() if only interested in the String part of the unit...
void setUnit(const QBase &other)
Set new unit, copied from specified QBase, without changing value.
void setUnit(const Unit &s)
Re-specify parts of a QBase
const String & getUnit() const
Get units of QBase
QBase(const Unit &s)
Construct dimensioned QBase (e.g.
virtual ~QBase()
Destructor.
Bool isConform(const Unit &s) const
Check for conformal matching units (e.g.
virtual void print(ostream &os) const =0
Print a Quantum.
QBase()
Default constructor, generates "".
virtual uInt type() const =0
Get the type of derived Quantum (using QuantumType).
virtual QBase * clone() const =0
Get a copy of Quantum.
Bool isConform(const QBase &other) const
Using units specified in QBase.
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
ostream & operator<<(ostream &os, const QBase &meas)
Output declaration.
LogIO & operator<<(LogIO &os, const QBase &meas)