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

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1