casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ModcompDataConversion.h
Go to the documentation of this file.
00001 //# ModcompDataConversion.h: A DataConversion class to convert Modcomp format.
00002 //# Copyright (C) 1999,2001
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: ModcompDataConversion.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00027 
00028 #ifndef CASA_MODCOMPDATACONVERSION_H
00029 #define CASA_MODCOMPDATACONVERSION_H
00030 
00031 #include <casa/OS/DataConversion.h>
00032 
00033 namespace casa { //# NAMESPACE CASA - BEGIN
00034 
00035 // <summary>A DataConversion class to convert between Modcomp format.</summary>
00036 
00037 // <use visibility=export>
00038 
00039 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00040 // </reviewed>
00041 
00042 // <synopsis>
00043 // This class is a specialization of the abstract base class
00044 // <linkto class=DataConversion>DataConversion</linkto>.
00045 // It contains functions to convert data from/to the Modcomp format
00046 // using the static functions in class <linkto class=ModcompConversion>
00047 // ModcompConversion</linkto>.
00048 // </synopsis>
00049 
00050 // <example>
00051 // See example in class <linkto class=DataConversion>DataConversion</linkto>.
00052 // </example>
00053 
00054 // <motivation>
00055 // This class is an addition to <linkto class=ModcompConversion>
00056 // ModcompConversion</linkto>
00057 // to be able to use the conversion functions in a polymorphic way.
00058 // </motivation>
00059 
00060 // <todo asof="$DATE$">
00061 //  <li> Support data type long Double.
00062 // </todo>
00063 
00064 
00065 class ModcompDataConversion :public DataConversion
00066 {
00067 public:
00068     // Construct the object.
00069     ModcompDataConversion();
00070 
00071     virtual ~ModcompDataConversion();
00072 
00073     // Convert one value from Modcomp format to local format.
00074     // The from and to buffer should not overlap.
00075     // <group>
00076     virtual uInt toLocal (Char&   to, const void* from) const;
00077     virtual uInt toLocal (uChar&  to, const void* from) const;
00078     virtual uInt toLocal (Short&  to, const void* from) const;
00079     virtual uInt toLocal (uShort& to, const void* from) const;
00080     virtual uInt toLocal (Int&    to, const void* from) const;
00081     virtual uInt toLocal (uInt&   to, const void* from) const;
00082     virtual uInt toLocal (Int64&  to, const void* from) const;
00083     virtual uInt toLocal (uInt64& to, const void* from) const;
00084     virtual uInt toLocal (Float&  to, const void* from) const;
00085     virtual uInt toLocal (Double& to, const void* from) const;
00086     // </group>
00087     
00088     // Convert nr values from Modcomp format to local format.
00089     // The from and to buffer should not overlap.
00090     // <group>
00091     virtual uInt toLocal (Char*   to, const void* from, uInt nr) const;
00092     virtual uInt toLocal (uChar*  to, const void* from, uInt nr) const;
00093     virtual uInt toLocal (Short*  to, const void* from, uInt nr) const;
00094     virtual uInt toLocal (uShort* to, const void* from, uInt nr) const;
00095     virtual uInt toLocal (Int*    to, const void* from, uInt nr) const;
00096     virtual uInt toLocal (uInt*   to, const void* from, uInt nr) const;
00097     virtual uInt toLocal (Int64*  to, const void* from, uInt nr) const;
00098     virtual uInt toLocal (uInt64* to, const void* from, uInt nr) const;
00099     virtual uInt toLocal (Float*  to, const void* from, uInt nr) const;
00100     virtual uInt toLocal (Double* to, const void* from, uInt nr) const;
00101     // </group>
00102 
00103     // Convert one value from local format to Modcomp format.
00104     // The from and to buffer should not overlap.
00105     // <group>
00106     virtual uInt fromLocal (void* to, Char   from) const;
00107     virtual uInt fromLocal (void* to, uChar  from) const;
00108     virtual uInt fromLocal (void* to, Short  from) const;
00109     virtual uInt fromLocal (void* to, uShort from) const;
00110     virtual uInt fromLocal (void* to, Int    from) const;
00111     virtual uInt fromLocal (void* to, uInt   from) const;
00112     virtual uInt fromLocal (void* to, Int64  from) const;
00113     virtual uInt fromLocal (void* to, uInt64 from) const;
00114     virtual uInt fromLocal (void* to, Float  from) const;
00115     virtual uInt fromLocal (void* to, Double from) const;
00116     // </group>
00117     
00118     // Convert nr values from local format to ModComp format.
00119     // The from and to buffer should not overlap.
00120     // <group>
00121     virtual uInt fromLocal (void* to, const Char*   from, uInt nr) const;
00122     virtual uInt fromLocal (void* to, const uChar*  from, uInt nr) const;
00123     virtual uInt fromLocal (void* to, const Short*  from, uInt nr) const;
00124     virtual uInt fromLocal (void* to, const uShort* from, uInt nr) const;
00125     virtual uInt fromLocal (void* to, const Int*    from, uInt nr) const;
00126     virtual uInt fromLocal (void* to, const uInt*   from, uInt nr) const;
00127     virtual uInt fromLocal (void* to, const Int64*  from, uInt nr) const;
00128     virtual uInt fromLocal (void* to, const uInt64* from, uInt nr) const;
00129     virtual uInt fromLocal (void* to, const Float*  from, uInt nr) const;
00130     virtual uInt fromLocal (void* to, const Double* from, uInt nr) const;
00131     // </group>
00132 
00133     // Determine if the data for a data type can be simply copied, thus
00134     // if no conversion is needed.
00135     // <group>
00136     virtual Bool canCopy (const Char*) const;
00137     virtual Bool canCopy (const uChar*) const;
00138     virtual Bool canCopy (const Short*) const;
00139     virtual Bool canCopy (const uShort*) const;
00140     virtual Bool canCopy (const Int*) const;
00141     virtual Bool canCopy (const uInt*) const;
00142     virtual Bool canCopy (const Int64*) const;
00143     virtual Bool canCopy (const uInt64*) const;
00144     virtual Bool canCopy (const Float*) const;
00145     virtual Bool canCopy (const Double*) const;
00146     // </group>
00147 
00148     // Get the external size of the data type.
00149     // <group>
00150     virtual uInt externalSize (const Char*) const;
00151     virtual uInt externalSize (const uChar*) const;
00152     virtual uInt externalSize (const Short*) const;
00153     virtual uInt externalSize (const uShort*) const;
00154     virtual uInt externalSize (const Int*) const;
00155     virtual uInt externalSize (const uInt*) const;
00156     virtual uInt externalSize (const Int64*) const;
00157     virtual uInt externalSize (const uInt64*) const;
00158     virtual uInt externalSize (const Float*) const;
00159     virtual uInt externalSize (const Double*) const;
00160     // </group>
00161 };
00162 
00163 
00164 inline ModcompDataConversion::ModcompDataConversion() {
00165 }
00166 
00167 } //# NAMESPACE CASA - END
00168 
00169 #endif