QBase.h

Go to the documentation of this file.
00001 //# QBase.h: base class for Quantum
00002 //# Copyright (C) 1994,1995,1996,1998,1999
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef CASA_QBASE_H
00029 #define CASA_QBASE_H
00030 
00031 
00032 //# Includes
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/casa/Quanta/Unit.h>
00035 
00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00037 
00038 //# Forward Declarations
00039 
00040 class LogIO;
00041 
00042 //# Typedefs
00043 
00044 // 
00045 // <summary>
00046 // Base for Quantities (i.e. dimensioned values)
00047 // </summary>
00048 
00049 // <use visibility=local>
00050 
00051 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tQuantum">
00052 //
00053 // <prerequisite>
00054 //   <li> <linkto class=Unit>Unit</linkto>
00055 // </prerequisite>
00056 //
00057 // <etymology>
00058 // QBase is the base class for <linkto class=Quantum>Quantum</linkto>.
00059 // </etymology>
00060 //
00061 // <synopsis> 
00062 // Quantities are values with a unit. Their basic specification can be one of
00063 // two forms:
00064 // <srcblock>
00065 // Quantity( Double value, String unit);        // or: Unit unit
00066 // Quantum<Type> ( Type value, String unit)     // or: Unit unit
00067 // </srcblock>
00068 // See <linkto class=Quantum>Quantum</linkto> for details.
00069 // </synopsis> 
00070 //
00071 // <motivation>
00072 // To provide the possibilty of mixing units from different
00073 // <src>Quantum<T1></src>, <src>Quantum<T2></src>
00074 // </motivation>
00075 //
00076 // <todo asof="941123">
00077 //   <li> Some inlining (did not work first go)
00078 // </todo>
00079 
00080 class QBase {
00081   //# Friends
00082 
00083 public:
00084   //# Constructors
00085   // Default constructor, generates ""
00086   QBase();
00087   // Copy constructor
00088   QBase(const QBase &other);
00089   // Construct dimensioned QBase (e.g. 'km/Mpc')
00090   // <thrown>
00091   //   <li> AipsError if non-matching unit dimensions
00092   // </thrown>
00093   // <group>
00094   QBase(const Unit &s);
00095   // </group>
00096   
00097   // Destructor
00098   virtual ~QBase();
00099   
00100   //# Operators
00101   // Assignment (copy)
00102   QBase &operator=(const QBase &other);
00103   
00104   //# Member functions
00105   // Get units of QBase
00106   // <group name="get">
00107   // Return the string representation of the current units attached to QBase
00108   const String &getUnit() const;
00109   // </group>
00110   
00111   // Re-specify parts of a QBase
00112   // <group name="set">
00113   // Set new unit, without changing value
00114   void setUnit(const Unit &s);
00115   // Set new unit, copied from specified QBase, without changing value
00116   void setUnit(const QBase &other);
00117   // </group>
00118   
00119   // Check for conformal matching units (e.g. dam and Mpc)
00120   // <group name="check">
00121   // Using specified units
00122   Bool isConform(const Unit &s) const;
00123   // Using units specified in QBase
00124   Bool isConform(const QBase &other) const;
00125   // </group>
00126   
00127   // Get a copy of Quantum
00128   virtual QBase *clone() const = 0;
00129   // Get the unit attached to the Quantum (use getUnit() if only interested in
00130   // the String part of the unit)
00131   virtual const Unit &getFullUnit() const = 0;
00132   // Print a Quantum
00133   virtual void print(ostream &os) const = 0;
00134   // Get the type of derived Quantum (using QuantumType).
00135   // All should have:
00136   // static uInt myType();
00137   virtual uInt type() const = 0;
00138   
00139 protected:
00140   //# Data members
00141   Unit qUnit;
00142 };
00143 
00144 //# Inline Implementations
00145 
00146 //# Global functions
00147 // <summary> Global functions </summary>
00148 // <group name=Output>
00149 // Output declaration
00150 ostream &operator<<(ostream &os, const QBase &meas);
00151 LogIO &operator<<(LogIO &os, const QBase &meas);
00152 
00153 // </group>
00154 
00155 
00156 } //# NAMESPACE CASACORE - END
00157 
00158 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1