casacore
IBMDataConversion.h
Go to the documentation of this file.
1 //# IBMDataConversion.h: A class with virtual functions to convert IBM 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_IBMDATACONVERSION_H
29 #define CASA_IBMDATACONVERSION_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/OS/DataConversion.h>
34 
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 // <summary>
39 // A class with virtual functions to convert IBM format.
40 // </summary>
41 
42 // <use visibility=export>
43 
44 // <reviewed reviewer="Friso Olnon" date="1996/11/06" tests="tDataConversion" demos="">
45 // </reviewed>
46 
47 // <synopsis>
48 // This class is a specialization of the abstract base class
49 // <linkto class=DataConversion>DataConversion</linkto>.
50 // It contains functions to convert data from/to the old IBM format
51 // using the static functions in class <linkto class=IBMConversion>
52 // IBMConversion</linkto>.
53 // </synopsis>
54 
55 // <example>
56 // See example in class <linkto class=DataConversion>DataConversion</linkto>.
57 // </example>
58 
59 // <motivation>
60 // This class is an addition to <linkto class=IBMConversion>IBMConversion
61 // </linkto> to be able to use the conversion functions in a polymorphic way.
62 // </motivation>
63 
64 // <todo asof="$DATE$">
65 // <li> Support data type long double.
66 // </todo>
67 
68 
70 {
71 public:
72  // Construct the object.
74 
75  virtual ~IBMDataConversion();
76 
77  // Convert one value from IBM format to local format.
78  // The from and to buffer should not overlap.
79  // <note>
80  // The char version converts from EBCDIC to ASCII, while the
81  // unsigned char version is a simple copy.
82  // </note>
83  // <group>
84  size_t toLocal (char& to, const void* from) const override;
85  size_t toLocal (unsigned char& to, const void* from) const override;
86  size_t toLocal (short& to, const void* from) const override;
87  size_t toLocal (unsigned short& to, const void* from) const override;
88  size_t toLocal (int& to, const void* from) const override;
89  size_t toLocal (unsigned int& to, const void* from) const override;
90  size_t toLocal (Int64& to, const void* from) const override;
91  size_t toLocal (uInt64& to, const void* from) const override;
92  size_t toLocal (float& to, const void* from) const override;
93  size_t toLocal (double& to, const void* from) const override;
94  // </group>
95 
96  // Convert nr values from IBM format to local format.
97  // The from and to buffer should not overlap.
98  // <note>
99  // The char version converts from EBCDIC to ASCII, while the
100  // unsigned char version is a simple copy.
101  // </note>
102  // <group>
103  size_t toLocal (char* to, const void* from,
104  size_t nr) const override;
105  size_t toLocal (unsigned char* to, const void* from,
106  size_t nr) const override;
107  size_t toLocal (short* to, const void* from,
108  size_t nr) const override;
109  size_t toLocal (unsigned short* to, const void* from,
110  size_t nr) const override;
111  size_t toLocal (int* to, const void* from,
112  size_t nr) const override;
113  size_t toLocal (unsigned int* to, const void* from,
114  size_t nr) const override;
115  size_t toLocal (Int64* to, const void* from,
116  size_t nr) const override;
117  size_t toLocal (uInt64* to, const void* from,
118  size_t nr) const override;
119  size_t toLocal (float* to, const void* from,
120  size_t nr) const override;
121  size_t toLocal (double* to, const void* from,
122  size_t nr) const override;
123  // </group>
124 
125  // Convert one value from local format to IBM format.
126  // The from and to buffer should not overlap.
127  // <note>
128  // The char version converts from ASCII to EBCDIC, while the
129  // unsigned char version is a simple copy.
130  // </note>
131  // <group>
132  size_t fromLocal (void* to, char from) const override;
133  size_t fromLocal (void* to, unsigned char from) const override;
134  size_t fromLocal (void* to, short from) const override;
135  size_t fromLocal (void* to, unsigned short from) const override;
136  size_t fromLocal (void* to, int from) const override;
137  size_t fromLocal (void* to, unsigned int from) const override;
138  size_t fromLocal (void* to, Int64 from) const override;
139  size_t fromLocal (void* to, uInt64 from) const override;
140  size_t fromLocal (void* to, float from) const override;
141  size_t fromLocal (void* to, double from) const override;
142  // </group>
143 
144  // Convert nr values from local format to IBM format.
145  // The from and to buffer should not overlap.
146  // <note>
147  // The char version converts from ASCII to EBCDIC, while the
148  // unsigned char version is a simple copy.
149  // </note>
150  // <group>
151  size_t fromLocal (void* to, const char* from,
152  size_t nr) const override;
153  size_t fromLocal (void* to, const unsigned char* from,
154  size_t nr) const override;
155  size_t fromLocal (void* to, const short* from,
156  size_t nr) const override;
157  size_t fromLocal (void* to, const unsigned short* from,
158  size_t nr) const override;
159  size_t fromLocal (void* to, const int* from,
160  size_t nr) const override;
161  size_t fromLocal (void* to, const unsigned int* from,
162  size_t nr) const override;
163  size_t fromLocal (void* to, const Int64* from,
164  size_t nr) const override;
165  size_t fromLocal (void* to, const uInt64* from,
166  size_t nr) const override;
167  size_t fromLocal (void* to, const float* from,
168  size_t nr) const override;
169  size_t fromLocal (void* to, const double* from,
170  size_t nr) const override;
171  // </group>
172 
173  // Determine if the data for a data type can be simply copied, thus
174  // if no conversion is needed.
175  // <group>
176  Bool canCopy (const char*) const override;
177  Bool canCopy (const unsigned char*) const override;
178  Bool canCopy (const short*) const override;
179  Bool canCopy (const unsigned short*) const override;
180  Bool canCopy (const int*) const override;
181  Bool canCopy (const unsigned int*) const override;
182  Bool canCopy (const Int64*) const override;
183  Bool canCopy (const uInt64*) const override;
184  Bool canCopy (const float*) const override;
185  Bool canCopy (const double*) const override;
186  // </group>
187 
188  // Get the external size of the data type.
189  // <group>
190  unsigned int externalSize (const char*) const override;
191  unsigned int externalSize (const unsigned char*) const override;
192  unsigned int externalSize (const short*) const override;
193  unsigned int externalSize (const unsigned short*) const override;
194  unsigned int externalSize (const int*) const override;
195  unsigned int externalSize (const unsigned int*) const override;
196  unsigned int externalSize (const Int64*) const override;
197  unsigned int externalSize (const uInt64*) const override;
198  unsigned int externalSize (const float*) const override;
199  unsigned int externalSize (const double*) const override;
200  // </group>
201 };
202 
203 
205 {}
206 
207 
208 
209 } //# NAMESPACE CASACORE - END
210 
211 #endif
Bool canCopy(const short *) const override
size_t toLocal(unsigned int &to, const void *from) const override
size_t fromLocal(void *to, const double *from, size_t nr) const override
Bool canCopy(const int *) const override
size_t toLocal(short *to, const void *from, size_t nr) const override
unsigned int externalSize(const unsigned char *) const override
size_t fromLocal(void *to, short from) const override
unsigned int externalSize(const unsigned short *) const override
unsigned int externalSize(const unsigned int *) const override
unsigned int externalSize(const char *) const override
Get the external size of the data type.
size_t fromLocal(void *to, const unsigned int *from, size_t nr) const override
unsigned int externalSize(const int *) const override
size_t fromLocal(void *to, const uInt64 *from, size_t nr) const override
size_t fromLocal(void *to, const unsigned char *from, size_t nr) const override
size_t toLocal(Int64 *to, const void *from, size_t nr) const override
size_t fromLocal(void *to, Int64 from) const override
size_t toLocal(unsigned short *to, const void *from, size_t nr) const override
Bool canCopy(const unsigned char *) const override
size_t fromLocal(void *to, unsigned char from) const override
size_t fromLocal(void *to, float from) const override
size_t toLocal(char *to, const void *from, size_t nr) const override
Convert nr values from IBM format to local format.
Bool canCopy(const float *) const override
Bool canCopy(const char *) const override
Determine if the data for a data type can be simply copied, thus if no conversion is needed.
size_t fromLocal(void *to, const float *from, size_t nr) const override
size_t toLocal(char &to, const void *from) const override
Convert one value from IBM format to local format.
size_t toLocal(double *to, const void *from, size_t nr) const override
size_t toLocal(uInt64 *to, const void *from, size_t nr) const override
size_t toLocal(unsigned char *to, const void *from, size_t nr) const override
size_t fromLocal(void *to, double from) const override
size_t toLocal(int *to, const void *from, size_t nr) const override
size_t fromLocal(void *to, unsigned short from) const override
size_t fromLocal(void *to, int from) const override
unsigned int externalSize(const float *) const override
unsigned int externalSize(const short *) const override
size_t fromLocal(void *to, const char *from, size_t nr) const override
Convert nr values from local format to IBM format.
Bool canCopy(const unsigned int *) const override
size_t toLocal(float *to, const void *from, size_t nr) const override
unsigned int externalSize(const double *) const override
size_t toLocal(double &to, const void *from) const override
size_t fromLocal(void *to, const short *from, size_t nr) const override
size_t toLocal(int &to, const void *from) const override
size_t toLocal(float &to, const void *from) const override
unsigned int externalSize(const uInt64 *) const override
size_t toLocal(Int64 &to, const void *from) const override
size_t fromLocal(void *to, const Int64 *from, size_t nr) const override
unsigned int externalSize(const Int64 *) const override
size_t fromLocal(void *to, uInt64 from) const override
Bool canCopy(const double *) const override
size_t toLocal(unsigned short &to, const void *from) const override
Bool canCopy(const uInt64 *) const override
size_t toLocal(unsigned int *to, const void *from, size_t nr) const override
size_t toLocal(uInt64 &to, const void *from) const override
size_t fromLocal(void *to, char from) const override
Convert one value from local format to IBM format.
size_t toLocal(short &to, const void *from) const override
size_t fromLocal(void *to, unsigned int from) const override
Bool canCopy(const unsigned short *) const override
IBMDataConversion()
Construct the object.
Bool canCopy(const Int64 *) const override
size_t toLocal(unsigned char &to, const void *from) const override
size_t fromLocal(void *to, const unsigned short *from, size_t nr) const override
size_t fromLocal(void *to, const int *from, size_t nr) const override
this file contains all the compiler specific defines
Definition: mainpage.dox:28
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
unsigned long long uInt64
Definition: aipsxtype.h:39