casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VAXDataConversion.h
Go to the documentation of this file.
1 //# VAXDataConversion.h: A class with virtual functions to convert VAX 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_VAXDATACONVERSION_H
29 #define CASA_VAXDATACONVERSION_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
34 
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 // <summary>
39 // A class with virtual functions to convert VAX 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 VAX format
51 // using the static functions in class <linkto class=VAXConversion>
52 // VAXConversion</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=VAXConversion>VAXConversion
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  virtual ~VAXDataConversion();
75 
76  // Convert one value from VAX format to local format.
77  // The from and to buffer should not overlap.
78  // <group>
79  virtual size_t toLocal (char& to, const void* from) const;
80  virtual size_t toLocal (unsigned char& to, const void* from) const;
81  virtual size_t toLocal (short& to, const void* from) const;
82  virtual size_t toLocal (unsigned short& to, const void* from) const;
83  virtual size_t toLocal (int& to, const void* from) const;
84  virtual size_t toLocal (unsigned int& to, const void* from) const;
85  virtual size_t toLocal (Int64& to, const void* from) const;
86  virtual size_t toLocal (uInt64& to, const void* from) const;
87  virtual size_t toLocal (float& to, const void* from) const;
88  virtual size_t toLocal (double& to, const void* from) const;
89  // </group>
90 
91  // Convert nr values from VAX format to local format.
92  // The from and to buffer should not overlap.
93  // <group>
94  virtual size_t toLocal (char* to, const void* from,
95  size_t nr) const;
96  virtual size_t toLocal (unsigned char* to, const void* from,
97  size_t nr) const;
98  virtual size_t toLocal (short* to, const void* from,
99  size_t nr) const;
100  virtual size_t toLocal (unsigned short* to, const void* from,
101  size_t nr) const;
102  virtual size_t toLocal (int* to, const void* from,
103  size_t nr) const;
104  virtual size_t toLocal (unsigned int* to, const void* from,
105  size_t nr) const;
106  virtual size_t toLocal (Int64* to, const void* from,
107  size_t nr) const;
108  virtual size_t toLocal (uInt64* to, const void* from,
109  size_t nr) const;
110  virtual size_t toLocal (float* to, const void* from,
111  size_t nr) const;
112  virtual size_t toLocal (double* to, const void* from,
113  size_t nr) const;
114  // </group>
115 
116  // Convert one value from local format to VAX format.
117  // The from and to buffer should not overlap.
118  // <group>
119  virtual size_t fromLocal (void* to, char from) const;
120  virtual size_t fromLocal (void* to, unsigned char from) const;
121  virtual size_t fromLocal (void* to, short from) const;
122  virtual size_t fromLocal (void* to, unsigned short from) const;
123  virtual size_t fromLocal (void* to, int from) const;
124  virtual size_t fromLocal (void* to, unsigned int from) const;
125  virtual size_t fromLocal (void* to, Int64 from) const;
126  virtual size_t fromLocal (void* to, uInt64 from) const;
127  virtual size_t fromLocal (void* to, float from) const;
128  virtual size_t fromLocal (void* to, double from) const;
129  // </group>
130 
131  // Convert nr values from local format to VAX format.
132  // The from and to buffer should not overlap.
133  // <group>
134  virtual size_t fromLocal (void* to, const char* from,
135  size_t nr) const;
136  virtual size_t fromLocal (void* to, const unsigned char* from,
137  size_t nr) const;
138  virtual size_t fromLocal (void* to, const short* from,
139  size_t nr) const;
140  virtual size_t fromLocal (void* to, const unsigned short* from,
141  size_t nr) const;
142  virtual size_t fromLocal (void* to, const int* from,
143  size_t nr) const;
144  virtual size_t fromLocal (void* to, const unsigned int* from,
145  size_t nr) const;
146  virtual size_t fromLocal (void* to, const Int64* from,
147  size_t nr) const;
148  virtual size_t fromLocal (void* to, const uInt64* from,
149  size_t nr) const;
150  virtual size_t fromLocal (void* to, const float* from,
151  size_t nr) const;
152  virtual size_t fromLocal (void* to, const double* from,
153  size_t nr) const;
154  // </group>
155 
156  // Determine if the data for a data type can be simply copied, thus
157  // if no conversion is needed.
158  // <group>
159  virtual Bool canCopy (const char*) const;
160  virtual Bool canCopy (const unsigned char*) const;
161  virtual Bool canCopy (const short*) const;
162  virtual Bool canCopy (const unsigned short*) const;
163  virtual Bool canCopy (const int*) const;
164  virtual Bool canCopy (const unsigned int*) const;
165  virtual Bool canCopy (const Int64*) const;
166  virtual Bool canCopy (const uInt64*) const;
167  virtual Bool canCopy (const float*) const;
168  virtual Bool canCopy (const double*) const;
169  // </group>
170 
171  // Get the external size of the data type.
172  // <group>
173  virtual unsigned int externalSize (const char*) const;
174  virtual unsigned int externalSize (const unsigned char*) const;
175  virtual unsigned int externalSize (const short*) const;
176  virtual unsigned int externalSize (const unsigned short*) const;
177  virtual unsigned int externalSize (const int*) const;
178  virtual unsigned int externalSize (const unsigned int*) const;
179  virtual unsigned int externalSize (const Int64*) const;
180  virtual unsigned int externalSize (const uInt64*) const;
181  virtual unsigned int externalSize (const float*) const;
182  virtual unsigned int externalSize (const double*) const;
183  // </group>
184 };
185 
186 
188 {}
189 
190 
191 
192 } //# NAMESPACE CASACORE - END
193 
194 #endif
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
Abstract base class with functions to convert any format.
unsigned long long uInt64
Definition: aipsxtype.h:39
virtual size_t toLocal(char &to, const void *from) const
Convert one value from VAX format to local format.
virtual unsigned int externalSize(const char *) const
Get the external size of the data type.
VAXDataConversion()
Construct the object.
virtual Bool canCopy(const char *) const
Determine if the data for a data type can be simply copied, thus if no conversion is needed...
A class with virtual functions to convert VAX format.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual size_t fromLocal(void *to, char from) const
Convert one value from local format to VAX format.