casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
QuantumType.h
Go to the documentation of this file.
00001 //# QuantumType.h: Get an integer type for a Qunatum<T>
00002 //# Copyright (C) 2010
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: QuantumHolder.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00027 
00028 #ifndef CASA_QUANTUMTYPE_H
00029 #define CASA_QUANTUMTYPE_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <casa/BasicSL/Complex.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 //# Forward Declarations
00038 template <class T> class Quantum;
00039 template <class T> class Vector;
00040 template <class T> class Matrix;
00041 template <class T> class Array;
00042 
00043 // <summary> Get an integer type for a Qunatum<T> </summary>
00044 
00045 // <use visibility=export>
00046 
00047 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tQuantumHolder" demos="">
00048 // </reviewed>
00049 
00050 // <synopsis>
00051 // The old way of getting a type number for a Quantum<T> uses the Register
00052 // class. This did not work well with shared libraries, because each shared
00053 // library gets its own static type data. Hence a type generated in one
00054 // python module sometimes mismatched the type for the same Quantum in
00055 // another module. For instance, it appeared that whem first loading
00056 // pyrap.tables and thereafter pyrap.quanta, things went wrong.
00057 //
00058 // Therefore this class has been developed that returns the type for the
00059 // Quantum template types used by QuantumHolder.
00060 // </synopsis>
00061 
00062 // <group name=QuantumType>
00063 
00064  inline uInt quantumType (const Quantum<Double>*)
00065    { return 1; }
00066  inline uInt quantumType (const Quantum<Float>*)
00067    { return 2; }
00068  inline uInt quantumType (const Quantum<Int>*)
00069    { return 3; }
00070  inline uInt quantumType (const Quantum<DComplex>*)
00071    { return 4; }
00072  inline uInt quantumType (const Quantum<Complex>*)
00073    { return 5; }
00074  inline uInt quantumType (const Quantum< Vector<Double> >*)
00075    { return 6; }
00076  inline uInt quantumType (const Quantum< Vector<Float> >*)
00077    { return 7; }
00078  inline uInt quantumType (const Quantum< Vector<Int> >*)
00079    { return 8; }
00080  inline uInt quantumType (const Quantum< Vector<DComplex> >*)
00081    { return 9; }
00082  inline uInt quantumType (const Quantum< Vector<Complex> >*)
00083    { return 10; }
00084  inline uInt quantumType (const Quantum< Array<Double> >*)
00085    { return 11; }
00086  inline uInt quantumType (const Quantum< Array<Float> >*)
00087    { return 12; }
00088  inline uInt quantumType (const Quantum< Array<Int> >*)
00089    { return 13; }
00090  inline uInt quantumType (const Quantum< Array<DComplex> >*)
00091    { return 14; }
00092  inline uInt quantumType (const Quantum< Array<Complex> >*)
00093    { return 15; }
00094  inline uInt quantumType (const Quantum< Matrix<Double> >*)
00095    { return 16; }
00096  inline uInt quantumType (const Quantum< Matrix<Float> >*)
00097    { return 17; }
00098  inline uInt quantumType (const Quantum< Matrix<Int> >*)
00099    { return 18; }
00100  inline uInt quantumType (const Quantum< Matrix<DComplex> >*)
00101    { return 19; }
00102  inline uInt quantumType (const Quantum< Matrix<Complex> >*)
00103    { return 20; }
00104 
00105 // </group>
00106 
00107 } //# NAMESPACE CASA - END
00108 
00109 #endif