casacore
LECanonicalDataConversion.h
Go to the documentation of this file.
1 //# LECanonicalDataConversion.h: A class with virtual functions to convert little endian canonical format
2 //# Copyright (C) 2002
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_LECANONICALDATACONVERSION_H
29 #define CASA_LECANONICALDATACONVERSION_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 little endian canonical 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 little endian
51 // canonical format using the static functions in class
52 // <linkto class=LECanonicalConversion>LECanonicalConversion</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=LECanonicalConversion>
61 // LECanonicalConversion</linkto>
62 // to be able to use the conversion functions in a polymorphic way.
63 // </motivation>
64 
65 // <todo asof="$DATE$">
66 // <li> Support data type long double.
67 // </todo>
68 
69 
71 {
72 public:
73  // Construct the object.
75 
77 
78  // Convert one value from canonical format to local format.
79  // The from and to buffer should not overlap.
80  // <group>
81  size_t toLocal (char& to, const void* from) const override;
82  size_t toLocal (unsigned char& to, const void* from) const override;
83  size_t toLocal (short& to, const void* from) const override;
84  size_t toLocal (unsigned short& to, const void* from) const override;
85  size_t toLocal (int& to, const void* from) const override;
86  size_t toLocal (unsigned int& to, const void* from) const override;
87  size_t toLocal (Int64& to, const void* from) const override;
88  size_t toLocal (uInt64& to, const void* from) const override;
89  size_t toLocal (float& to, const void* from) const override;
90  size_t toLocal (double& to, const void* from) const override;
91  // </group>
92 
93  // Convert nr values from canonical format to local format.
94  // The from and to buffer should not overlap.
95  // <group>
96  size_t toLocal (char* to, const void* from,
97  size_t nr) const override;
98  size_t toLocal (unsigned char* to, const void* from,
99  size_t nr) const override;
100  size_t toLocal (short* to, const void* from,
101  size_t nr) const override;
102  size_t toLocal (unsigned short* to, const void* from,
103  size_t nr) const override;
104  size_t toLocal (int* to, const void* from,
105  size_t nr) const override;
106  size_t toLocal (unsigned int* to, const void* from,
107  size_t nr) const override;
108  size_t toLocal (Int64* to, const void* from,
109  size_t nr) const override;
110  size_t toLocal (uInt64* to, const void* from,
111  size_t nr) const override;
112  size_t toLocal (float* to, const void* from,
113  size_t nr) const override;
114  size_t toLocal (double* to, const void* from,
115  size_t nr) const override;
116  // </group>
117 
118  // Convert one value from local format to canonical format.
119  // The from and to buffer should not overlap.
120  // <group>
121  size_t fromLocal (void* to, char from) const override;
122  size_t fromLocal (void* to, unsigned char from) const override;
123  size_t fromLocal (void* to, short from) const override;
124  size_t fromLocal (void* to, unsigned short from) const override;
125  size_t fromLocal (void* to, int from) const override;
126  size_t fromLocal (void* to, unsigned int from) const override;
127  size_t fromLocal (void* to, Int64 from) const override;
128  size_t fromLocal (void* to, uInt64 from) const override;
129  size_t fromLocal (void* to, float from) const override;
130  size_t fromLocal (void* to, double from) const override;
131  // </group>
132 
133  // Convert nr values from local format to canonical format.
134  // The from and to buffer should not overlap.
135  // <group>
136  size_t fromLocal (void* to, const char* from,
137  size_t nr) const override;
138  size_t fromLocal (void* to, const unsigned char* from,
139  size_t nr) const override;
140  size_t fromLocal (void* to, const short* from,
141  size_t nr) const override;
142  size_t fromLocal (void* to, const unsigned short* from,
143  size_t nr) const override;
144  size_t fromLocal (void* to, const int* from,
145  size_t nr) const override;
146  size_t fromLocal (void* to, const unsigned int* from,
147  size_t nr) const override;
148  size_t fromLocal (void* to, const Int64* from,
149  size_t nr) const override;
150  size_t fromLocal (void* to, const uInt64* from,
151  size_t nr) const override;
152  size_t fromLocal (void* to, const float* from,
153  size_t nr) const override;
154  size_t fromLocal (void* to, const double* from,
155  size_t nr) const override;
156  // </group>
157 
158  // Determine if the data for a data type can be simply copied, thus
159  // if no conversion is needed.
160  // <group>
161  Bool canCopy (const char*) const override;
162  Bool canCopy (const unsigned char*) const override;
163  Bool canCopy (const short*) const override;
164  Bool canCopy (const unsigned short*) const override;
165  Bool canCopy (const int*) const override;
166  Bool canCopy (const unsigned int*) const override;
167  Bool canCopy (const Int64*) const override;
168  Bool canCopy (const uInt64*) const override;
169  Bool canCopy (const float*) const override;
170  Bool canCopy (const double*) const override;
171  // </group>
172 
173  // Get the external size of the data type.
174  // <group>
175  unsigned int externalSize (const char*) const override;
176  unsigned int externalSize (const unsigned char*) const override;
177  unsigned int externalSize (const short*) const override;
178  unsigned int externalSize (const unsigned short*) const override;
179  unsigned int externalSize (const int*) const override;
180  unsigned int externalSize (const unsigned int*) const override;
181  unsigned int externalSize (const Int64*) const override;
182  unsigned int externalSize (const uInt64*) const override;
183  unsigned int externalSize (const float*) const override;
184  unsigned int externalSize (const double*) const override;
185  // </group>
186 };
187 
188 
190 {}
191 
192 
193 
194 } //# NAMESPACE CASACORE - END
195 
196 #endif
size_t fromLocal(void *to, uInt64 from) const override
size_t toLocal(Int64 *to, const void *from, size_t nr) const override
Bool canCopy(const int *) const override
size_t toLocal(unsigned short *to, const void *from, size_t nr) const override
size_t fromLocal(void *to, const Int64 *from, size_t nr) const override
size_t fromLocal(void *to, unsigned short from) const override
unsigned int externalSize(const short *) const override
unsigned int externalSize(const float *) const override
Bool canCopy(const uInt64 *) const override
Bool canCopy(const unsigned short *) const override
size_t toLocal(char *to, const void *from, size_t nr) const override
Convert nr values from canonical format to local format.
size_t fromLocal(void *to, unsigned int from) const override
size_t fromLocal(void *to, float from) const override
size_t toLocal(uInt64 *to, const void *from, size_t nr) const override
size_t toLocal(int *to, const void *from, size_t nr) const override
unsigned int externalSize(const unsigned char *) const override
Bool canCopy(const unsigned int *) const override
size_t fromLocal(void *to, const unsigned char *from, size_t nr) const override
size_t toLocal(short &to, const void *from) const override
size_t toLocal(uInt64 &to, const void *from) const override
unsigned int externalSize(const Int64 *) const override
size_t fromLocal(void *to, const char *from, size_t nr) const override
Convert nr values from local format to canonical format.
size_t fromLocal(void *to, int from) const override
size_t toLocal(char &to, const void *from) const override
Convert one value from canonical format to local format.
Bool canCopy(const float *) const override
size_t fromLocal(void *to, short from) const override
size_t fromLocal(void *to, const unsigned int *from, size_t nr) const override
Bool canCopy(const double *) const override
unsigned int externalSize(const unsigned short *) const override
size_t toLocal(int &to, const void *from) const override
Bool canCopy(const Int64 *) const override
size_t toLocal(float *to, const void *from, size_t nr) const override
size_t toLocal(unsigned int *to, const void *from, size_t nr) const override
unsigned int externalSize(const unsigned int *) const override
size_t toLocal(float &to, const void *from) const override
size_t toLocal(Int64 &to, const void *from) const override
Bool canCopy(const unsigned char *) 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
size_t toLocal(short *to, const void *from, size_t nr) const override
Bool canCopy(const short *) const override
size_t fromLocal(void *to, const uInt64 *from, size_t nr) const override
size_t fromLocal(void *to, char from) const override
Convert one value from local format to canonical format.
size_t toLocal(unsigned char &to, const void *from) const override
size_t toLocal(unsigned short &to, const void *from) const override
unsigned int externalSize(const char *) const override
Get the external size of the data type.
size_t toLocal(unsigned int &to, const void *from) const override
unsigned int externalSize(const uInt64 *) const override
size_t fromLocal(void *to, const float *from, size_t nr) const override
size_t fromLocal(void *to, Int64 from) const override
size_t fromLocal(void *to, const double *from, size_t nr) const override
size_t toLocal(double &to, const void *from) const override
unsigned int externalSize(const double *) const override
size_t fromLocal(void *to, double from) 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.
unsigned int externalSize(const int *) const override
size_t toLocal(unsigned char *to, const void *from, size_t nr) const override
size_t fromLocal(void *to, const short *from, size_t nr) const override
size_t fromLocal(void *to, unsigned char from) const override
size_t toLocal(double *to, const void *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