//# QBase.h: base class for Quantum //# Copyright (C) 1994,1995,1996,1998,1999 //# Associated Universities, Inc. Washington DC, USA. //# //# This library is free software; you can redistribute it and/or modify it //# under the terms of the GNU Library General Public License as published by //# the Free Software Foundation; either version 2 of the License, or (at your //# option) any later version. //# //# This library is distributed in the hope that it will be useful, but WITHOUT //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public //# License for more details. //# //# You should have received a copy of the GNU Library General Public License //# along with this library; if not, write to the Free Software Foundation, //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. //# //# Correspondence concerning AIPS++ should be addressed as follows: //# Internet email: aips2-request@nrao.edu. //# Postal address: AIPS++ Project Office //# National Radio Astronomy Observatory //# 520 Edgemont Road //# Charlottesville, VA 22903-2475 USA //# //# $Id$ #ifndef CASA_QBASE_H #define CASA_QBASE_H //# Includes #include #include namespace casacore { //# NAMESPACE CASACORE - BEGIN //# Forward Declarations class LogIO; //# Typedefs // // // Base for Quantities (i.e. dimensioned values) // // // // // //
  • Unit // // // // QBase is the base class for Quantum. // // // // Quantities are values with a unit. Their basic specification can be one of // two forms: // // Quantity( Double value, String unit); // or: Unit unit // Quantum ( Type value, String unit) // or: Unit unit // // See Quantum for details. // // // // To provide the possibilty of mixing units from different // Quantum, Quantum // // // //
  • Some inlining (did not work first go) // class QBase { //# Friends public: //# Constructors // Default constructor, generates "" QBase(); // Construct dimensioned QBase (e.g. 'km/Mpc') // //
  • AipsError if non-matching unit dimensions // // QBase(const Unit &s); // // Destructor virtual ~QBase(); //# Member functions // Get units of QBase // // Return the string representation of the current units attached to QBase const String &getUnit() const; // // Re-specify parts of a QBase // // Set new unit, without changing value void setUnit(const Unit &s); // Set new unit, copied from specified QBase, without changing value void setUnit(const QBase &other); // // Check for conformal matching units (e.g. dam and Mpc) // // Using specified units Bool isConform(const Unit &s) const; // Using units specified in QBase Bool isConform(const QBase &other) const; // // Get a copy of Quantum virtual QBase *clone() const = 0; // Get the unit attached to the Quantum (use getUnit() if only interested in // the String part of the unit) virtual const Unit &getFullUnit() const = 0; // Print a Quantum virtual void print(ostream &os) const = 0; // Get the type of derived Quantum (using QuantumType). // All should have: // static uInt myType(); virtual uInt type() const = 0; protected: //# Data members Unit qUnit; }; //# Inline Implementations //# Global functions // Global functions // // Output declaration ostream &operator<<(ostream &os, const QBase &meas); LogIO &operator<<(LogIO &os, const QBase &meas); // } //# NAMESPACE CASACORE - END #endif