casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RawIO.h
Go to the documentation of this file.
1 //# RawIO.h: Class for IO in local format
2 //# Copyright (C) 1996,1999,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef CASA_RAWIO_H
29 #define CASA_RAWIO_H
30 
31 #include <casacore/casa/aips.h>
33 //# The following should be a forward declaration. But our Complex & DComplex
34 //# classes are a typedef hence this does not work. Replace the following with
35 //# forward declarations when Complex and DComplex are no longer typedefs.
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 class ByteIO;
41 class String;
42 
43 // <summary>Class for IO in local format.</summary>
44 
45 // <use visibility=export>
46 
47 // <reviewed reviewer="Friso Olnon" date="1996/11/06" tests="tTypeIO" demos="">
48 // </reviewed>
49 
50 // <prerequisite>
51 // <li> <linkto class=ByteIO>ByteIO</linkto> class and derived classes
52 // <li> <linkto class=TypeIO>TypeIO</linkto>class
53 // </prerequisite>
54 
55 // <synopsis>
56 // RawIO is a specialization of class TypeIO to store
57 // data in local format.
58 // <p>
59 // This class is intended for data that will only be used internally
60 // and will not be exported to machines with a possible different
61 // data format.
62 // <p>
63 // To save storage Bools will be written as bits (using the
64 // static functions in class <linkto class=Conversion>Conversion</linkto>.
65 // </synopsis>
66 
67 // <motivation>
68 // Storing data in local format can improve performance on
69 // little-endian machines like DEC-alpha and PC's.
70 // </motivation>
71 
72 
73 class RawIO: public TypeIO
74 {
75 public:
76  // Constructor. The read/write functions will use the given ByteIO object
77  // as the data store. If takeOver is True the this class will delete the
78  // supplied pointer. Otherwise the caller is responsible for this.
79  explicit RawIO (ByteIO* byteIO, Bool takeOver=False);
80 
81  // The copy constructor uses reference semantics
82  RawIO (const RawIO& rawIO);
83 
84  // The assignment operator uses reference semantics
85  RawIO& operator= (const RawIO& rawIO);
86 
87  // Destructor.
88  ~RawIO();
89 
90  // Write the values to the ByteIO object.
91  // Bool, complex and String values are handled by the base class.
92  // <group>
93  virtual size_t write (size_t nvalues, const Bool* value);
94  virtual size_t write (size_t nvalues, const Char* data);
95  virtual size_t write (size_t nvalues, const uChar* data);
96  virtual size_t write (size_t nvalues, const Short* data);
97  virtual size_t write (size_t nvalues, const uShort* data);
98  virtual size_t write (size_t nvalues, const Int* data);
99  virtual size_t write (size_t nvalues, const uInt* data);
100  virtual size_t write (size_t nvalues, const Int64* data);
101  virtual size_t write (size_t nvalues, const uInt64* data);
102  virtual size_t write (size_t nvalues, const Float* data);
103  virtual size_t write (size_t nvalues, const Double* data);
104  virtual size_t write (size_t nvalues, const Complex* value);
105  virtual size_t write (size_t nvalues, const DComplex* value);
106  virtual size_t write (size_t nvalues, const String* value);
107  // </group>
108 
109  // Read the values from the ByteIO object.
110  // Bool, complex and String values are handled by the base class.
111  // <group>
112  virtual size_t read (size_t nvalues, Bool* value);
113  virtual size_t read (size_t nvalues, Char* data);
114  virtual size_t read (size_t nvalues, uChar* data);
115  virtual size_t read (size_t nvalues, Short* data);
116  virtual size_t read (size_t nvalues, uShort* data);
117  virtual size_t read (size_t nvalues, Int* data);
118  virtual size_t read (size_t nvalues, uInt* data);
119  virtual size_t read (size_t nvalues, Int64* data);
120  virtual size_t read (size_t nvalues, uInt64* data);
121  virtual size_t read (size_t nvalues, Float* data);
122  virtual size_t read (size_t nvalues, Double* data);
123  virtual size_t read (size_t nvalues, Complex* value);
124  virtual size_t read (size_t nvalues, DComplex* value);
125  virtual size_t read (size_t nvalues, String* value);
126  // </group>
127 };
128 
129 
130 
131 } //# NAMESPACE CASACORE - END
132 
133 #endif
virtual size_t read(size_t nvalues, Bool *value)
Read the values from the ByteIO object.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
int Int
Definition: aipstype.h:50
unsigned long long uInt64
Definition: aipsxtype.h:39
unsigned char uChar
Definition: aipstype.h:47
~RawIO()
Destructor.
char Char
Definition: aipstype.h:46
RawIO & operator=(const RawIO &rawIO)
The assignment operator uses reference semantics.
short Short
Definition: aipstype.h:48
virtual size_t write(size_t nvalues, const Bool *value)
Write the values to the ByteIO object.
const ByteIO & byteIO() const
Functions to return a reference to the ByteIO class.
double Double
Definition: aipstype.h:55
Abstract base class for IO on a byte stream.
Definition: ByteIO.h:61
Abstract base class for IO of data in a type-dependent format.
Definition: TypeIO.h:79
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Class for IO in local format.
Definition: RawIO.h:73
float Float
Definition: aipstype.h:54
const Bool False
Definition: aipstype.h:44
String: the storage and methods of handling collections of characters.
Definition: String.h:225
RawIO(ByteIO *byteIO, Bool takeOver=False)
Constructor.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
unsigned int uInt
Definition: aipstype.h:51
unsigned short uShort
Definition: aipstype.h:49