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