casacore
Loading...
Searching...
No Matches
LECanonicalDataConversion.h
Go to the documentation of this file.
1// # LECanonicalDataConversion.h: A class with virtual functions to convert little endian canonical
2// format # Copyright (C) 2002 # Associated Universities, Inc. Washington DC, USA.
3// #
4// # This library is free software; you can redistribute it and/or modify it
5// # under the terms of the GNU Library General Public License as published by
6// # the Free Software Foundation; either version 2 of the License, or (at your
7// # option) any later version.
8// #
9// # This library is distributed in the hope that it will be useful, but WITHOUT
10// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12// # License for more details.
13// #
14// # You should have received a copy of the GNU Library General Public License
15// # along with this library; if not, write to the Free Software Foundation,
16// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17// #
18// # Correspondence concerning AIPS++ should be addressed as follows:
19// # Internet email: casa-feedback@nrao.edu.
20// # Postal address: AIPS++ Project Office
21// # National Radio Astronomy Observatory
22// # 520 Edgemont Road
23// # Charlottesville, VA 22903-2475 USA
24
25#ifndef CASA_LECANONICALDATACONVERSION_H
26#define CASA_LECANONICALDATACONVERSION_H
27
28// # Includes
29#include <casacore/casa/aips.h>
30#include <casacore/casa/OS/DataConversion.h>
31
32namespace casacore { // # NAMESPACE CASACORE - BEGIN
33
34// <summary>
35// A class with virtual functions to convert little endian canonical format.
36// </summary>
37
38// <use visibility=export>
39
40// <reviewed reviewer="Friso Olnon" date="1996/11/06" tests="tDataConversion" demos="">
41// </reviewed>
42
43// <synopsis>
44// This class is a specialization of the abstract base class
45// <linkto class=DataConversion>DataConversion</linkto>.
46// It contains functions to convert data from/to the little endian
47// canonical format using the static functions in class
48// <linkto class=LECanonicalConversion>LECanonicalConversion</linkto>.
49// </synopsis>
50
51// <example>
52// See example in class <linkto class=DataConversion>DataConversion</linkto>.
53// </example>
54
55// <motivation>
56// This class is an addition to <linkto class=LECanonicalConversion>
57// LECanonicalConversion</linkto>
58// to be able to use the conversion functions in a polymorphic way.
59// </motivation>
60
61// <todo asof="$DATE$">
62// <li> Support data type long double.
63// </todo>
64
66 public:
67 // Construct the object.
69
71
72 // Convert one value from canonical format to local format.
73 // The from and to buffer should not overlap.
74 // <group>
75 size_t toLocal(char& to, const void* from) const override;
76 size_t toLocal(unsigned char& to, const void* from) const override;
77 size_t toLocal(short& to, const void* from) const override;
78 size_t toLocal(unsigned short& to, const void* from) const override;
79 size_t toLocal(int& to, const void* from) const override;
80 size_t toLocal(unsigned int& to, const void* from) const override;
81 size_t toLocal(Int64& to, const void* from) const override;
82 size_t toLocal(uInt64& to, const void* from) const override;
83 size_t toLocal(float& to, const void* from) const override;
84 size_t toLocal(double& to, const void* from) const override;
85 // </group>
86
87 // Convert nr values from canonical format to local format.
88 // The from and to buffer should not overlap.
89 // <group>
90 size_t toLocal(char* to, const void* from, size_t nr) const override;
91 size_t toLocal(unsigned char* to, const void* from, size_t nr) const override;
92 size_t toLocal(short* to, const void* from, size_t nr) const override;
93 size_t toLocal(unsigned short* to, const void* from, size_t nr) const override;
94 size_t toLocal(int* to, const void* from, size_t nr) const override;
95 size_t toLocal(unsigned int* to, const void* from, size_t nr) const override;
96 size_t toLocal(Int64* to, const void* from, size_t nr) const override;
97 size_t toLocal(uInt64* to, const void* from, size_t nr) const override;
98 size_t toLocal(float* to, const void* from, size_t nr) const override;
99 size_t toLocal(double* to, const void* from, size_t nr) const override;
100 // </group>
101
102 // Convert one value from local format to canonical format.
103 // The from and to buffer should not overlap.
104 // <group>
105 size_t fromLocal(void* to, char from) const override;
106 size_t fromLocal(void* to, unsigned char from) const override;
107 size_t fromLocal(void* to, short from) const override;
108 size_t fromLocal(void* to, unsigned short from) const override;
109 size_t fromLocal(void* to, int from) const override;
110 size_t fromLocal(void* to, unsigned int from) const override;
111 size_t fromLocal(void* to, Int64 from) const override;
112 size_t fromLocal(void* to, uInt64 from) const override;
113 size_t fromLocal(void* to, float from) const override;
114 size_t fromLocal(void* to, double from) const override;
115 // </group>
116
117 // Convert nr values from local format to canonical format.
118 // The from and to buffer should not overlap.
119 // <group>
120 size_t fromLocal(void* to, const char* from, size_t nr) const override;
121 size_t fromLocal(void* to, const unsigned char* from, size_t nr) const override;
122 size_t fromLocal(void* to, const short* from, size_t nr) const override;
123 size_t fromLocal(void* to, const unsigned short* from, size_t nr) const override;
124 size_t fromLocal(void* to, const int* from, size_t nr) const override;
125 size_t fromLocal(void* to, const unsigned int* from, size_t nr) const override;
126 size_t fromLocal(void* to, const Int64* from, size_t nr) const override;
127 size_t fromLocal(void* to, const uInt64* from, size_t nr) const override;
128 size_t fromLocal(void* to, const float* from, size_t nr) const override;
129 size_t fromLocal(void* to, const double* from, size_t nr) const override;
130 // </group>
131
132 // Determine if the data for a data type can be simply copied, thus
133 // if no conversion is needed.
134 // <group>
135 Bool canCopy(const char*) const override;
136 Bool canCopy(const unsigned char*) const override;
137 Bool canCopy(const short*) const override;
138 Bool canCopy(const unsigned short*) const override;
139 Bool canCopy(const int*) const override;
140 Bool canCopy(const unsigned int*) const override;
141 Bool canCopy(const Int64*) const override;
142 Bool canCopy(const uInt64*) const override;
143 Bool canCopy(const float*) const override;
144 Bool canCopy(const double*) const override;
145 // </group>
146
147 // Get the external size of the data type.
148 // <group>
149 unsigned int externalSize(const char*) const override;
150 unsigned int externalSize(const unsigned char*) const override;
151 unsigned int externalSize(const short*) const override;
152 unsigned int externalSize(const unsigned short*) const override;
153 unsigned int externalSize(const int*) const override;
154 unsigned int externalSize(const unsigned int*) const override;
155 unsigned int externalSize(const Int64*) const override;
156 unsigned int externalSize(const uInt64*) const override;
157 unsigned int externalSize(const float*) const override;
158 unsigned int externalSize(const double*) const override;
159 // </group>
160};
161
163
164} // namespace casacore
165
166#endif
DataConversion()
Construct the object.
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
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
Definition aipsxtype.h:36
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
unsigned long long uInt64
Definition aipsxtype.h:37