Loading...
Searching...
No Matches
QBase.h
Go to the documentation of this file.
//# 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: casa-feedback@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
#ifndef CASA_QBASE_H
#define CASA_QBASE_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/casa/Quanta/Unit.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
//# Forward Declarations
class LogIO;
//# Typedefs
//
// <summary>
// Base for Quantities (i.e. dimensioned values)
// </summary>
// <use visibility=local>
// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tQuantum">
//
// <prerequisite>
// <li> <linkto class=Unit>Unit</linkto>
// </prerequisite>
//
// <etymology>
// QBase is the base class for <linkto class=Quantum>Quantum</linkto>.
// </etymology>
//
// <synopsis>
// Quantities are values with a unit. Their basic specification can be one of
// two forms:
// <srcblock>
// Quantity( Double value, String unit); // or: Unit unit
// Quantum<Type> ( Type value, String unit) // or: Unit unit
// </srcblock>
// See <linkto class=Quantum>Quantum</linkto> for details.
// </synopsis>
//
// <motivation>
// To provide the possibilty of mixing units from different
// <src>Quantum<T1></src>, <src>Quantum<T2></src>
// </motivation>
//
// <todo asof="941123">
// <li> Some inlining (did not work first go)
// </todo>
class QBase {
//# Friends
public:
//# Constructors
// Default constructor, generates ""
QBase();
// Construct dimensioned QBase (e.g. 'km/Mpc')
// <thrown>
// <li> AipsError if non-matching unit dimensions
// </thrown>
// <group>
QBase(const Unit &s);
// </group>
// Destructor
virtual ~QBase();
//# Member functions
// Get units of QBase
// <group name="get">
// Return the string representation of the current units attached to QBase
const String &getUnit() const;
// </group>
// Re-specify parts of a QBase
// <group name="set">
// 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);
// </group>
// Check for conformal matching units (e.g. dam and Mpc)
// <group name="check">
// Using specified units
Bool isConform(const Unit &s) const;
// Using units specified in QBase
Bool isConform(const QBase &other) const;
// </group>
// 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
// <summary> Global functions </summary>
// <group name=Output>
// Output declaration
ostream &operator<<(ostream &os, const QBase &meas);
LogIO &operator<<(LogIO &os, const QBase &meas);
// </group>
} //# NAMESPACE CASACORE - END
#endif
casacore::LogIO
Definition LogIO.h:165
casacore::QBase
Definition QBase.h:78
casacore::QBase::getFullUnit
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...
casacore::QBase::setUnit
void setUnit(const QBase &other)
Set new unit, copied from specified QBase, without changing value.
casacore::QBase::qUnit
Unit qUnit
Definition QBase.h:133
casacore::QBase::setUnit
void setUnit(const Unit &s)
Re-specify parts of a QBase .
casacore::QBase::getUnit
const String & getUnit() const
Get units of QBase .
casacore::QBase::QBase
QBase(const Unit &s)
Construct dimensioned QBase (e.g.
casacore::QBase::~QBase
virtual ~QBase()
Destructor.
casacore::QBase::isConform
Bool isConform(const Unit &s) const
Check for conformal matching units (e.g.
casacore::QBase::print
virtual void print(ostream &os) const =0
Print a Quantum.
casacore::QBase::QBase
QBase()
Default constructor, generates "".
casacore::QBase::type
virtual uInt type() const =0
Get the type of derived Quantum (using QuantumType).
casacore::QBase::clone
virtual QBase * clone() const =0
Get a copy of Quantum.
casacore::QBase::isConform
Bool isConform(const QBase &other) const
Using units specified in QBase.
casacore::String
String: the storage and methods of handling collections of characters.
Definition String.h:223
casacore::Unit
Definition Unit.h:187
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::operator<<
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
casacore::uInt
unsigned int uInt
Definition aipstype.h:49
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::QBase_global_functions_Output
Global functions .
Definition QBase.h:142
casacore::QBase_global_functions_Output::operator<<
ostream & operator<<(ostream &os, const QBase &meas)
Output declaration.
casacore::QBase_global_functions_Output::operator<<
LogIO & operator<<(LogIO &os, const QBase &meas)