casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
RawIO.h
Go to the documentation of this file.
00001 //# RawIO.h: Class for IO in local format
00002 //# Copyright (C) 1996,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: RawIO.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00027 
00028 #ifndef CASA_RAWIO_H
00029 #define CASA_RAWIO_H
00030 
00031 #include <casa/aips.h>
00032 #include <casa/IO/TypeIO.h>
00033 //# The following should be a forward declaration. But our Complex & DComplex
00034 //# classes are a typedef hence this does not work. Replace the following with
00035 //# forward declarations when Complex and DComplex are no longer typedefs.
00036 #include <casa/BasicSL/Complex.h>
00037 
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039 
00040 class ByteIO;
00041 class String;
00042 
00043 // <summary>Class for IO in local format.</summary>
00044 
00045 // <use visibility=export>
00046 
00047 // <reviewed reviewer="Friso Olnon" date="1996/11/06" tests="tTypeIO" demos="">
00048 // </reviewed>
00049 
00050 // <prerequisite> 
00051 //    <li> <linkto class=ByteIO>ByteIO</linkto> class and derived classes
00052 //    <li> <linkto class=TypeIO>TypeIO</linkto>class
00053 // </prerequisite>
00054 
00055 // <synopsis> 
00056 // RawIO is a specialization of class TypeIO to store
00057 // data in local format.
00058 // <p>
00059 // This class is intended for data that will only be used internally
00060 // and will not be exported to machines with a possible different
00061 // data format.
00062 // <p>
00063 // To save storage Bools will be written as bits (using the
00064 // static functions in class <linkto class=Conversion>Conversion</linkto>.
00065 // </synopsis>
00066 
00067 // <motivation> 
00068 // Storing data in local format can improve performance on
00069 // little-endian machines like DEC-alpha and PC's.
00070 // </motivation>
00071 
00072 
00073 class RawIO: public TypeIO
00074 {
00075 public: 
00076     // Constructor.  The read/write functions will use the given ByteIO object
00077     // as the data store.  If takeOver is True the this class will delete the
00078     // supplied pointer. Otherwise the caller is responsible for this.
00079     explicit RawIO (ByteIO* byteIO, Bool takeOver=False);
00080 
00081     // The copy constructor uses reference semantics
00082     RawIO (const RawIO& rawIO);
00083 
00084     // The assignment operator uses reference semantics
00085     RawIO& operator= (const RawIO& rawIO);
00086 
00087     // Destructor.
00088     ~RawIO();
00089 
00090     // Write the values to the ByteIO object.
00091     // Bool, complex and String values are handled by the base class.
00092     // <group>
00093     virtual uInt write (uInt nvalues, const Bool* value);
00094     virtual uInt write (uInt nvalues, const Char* data);
00095     virtual uInt write (uInt nvalues, const uChar* data);
00096     virtual uInt write (uInt nvalues, const Short* data);
00097     virtual uInt write (uInt nvalues, const uShort* data);
00098     virtual uInt write (uInt nvalues, const Int* data);
00099     virtual uInt write (uInt nvalues, const uInt* data);
00100     virtual uInt write (uInt nvalues, const Int64* data);
00101     virtual uInt write (uInt nvalues, const uInt64* data);
00102     virtual uInt write (uInt nvalues, const Float* data);
00103     virtual uInt write (uInt nvalues, const Double* data);
00104     virtual uInt write (uInt nvalues, const Complex* value);
00105     virtual uInt write (uInt nvalues, const DComplex* value);
00106     virtual uInt write (uInt nvalues, const String* value);
00107     // </group>
00108 
00109     // Read the values from the ByteIO object.
00110     // Bool, complex and String values are handled by the base class.
00111     // <group>
00112     virtual uInt read (uInt nvalues, Bool* value);
00113     virtual uInt read (uInt nvalues, Char* data);
00114     virtual uInt read (uInt nvalues, uChar* data);
00115     virtual uInt read (uInt nvalues, Short* data);
00116     virtual uInt read (uInt nvalues, uShort* data);
00117     virtual uInt read (uInt nvalues, Int* data);
00118     virtual uInt read (uInt nvalues, uInt* data);
00119     virtual uInt read (uInt nvalues, Int64* data);
00120     virtual uInt read (uInt nvalues, uInt64* data);
00121     virtual uInt read (uInt nvalues, Float* data);
00122     virtual uInt read (uInt nvalues, Double* data);
00123     virtual uInt read (uInt nvalues, Complex* value);
00124     virtual uInt read (uInt nvalues, DComplex* value);
00125     virtual uInt read (uInt nvalues, String* value);
00126     // </group>
00127 };
00128 
00129 
00130 
00131 } //# NAMESPACE CASA - END
00132 
00133 #endif