casacore
Loading...
Searching...
No Matches
RawDataConversion.h
Go to the documentation of this file.
1// # RawDataConversion.h: A class with virtual functions to copy without conversion
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: casa-feedback@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#ifndef CASA_RAWDATACONVERSION_H
27#define CASA_RAWDATACONVERSION_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/OS/DataConversion.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// <summary>
36// A class with virtual functions to copy without conversion
37// </summary>
38
39// <use visibility=export>
40
41// <reviewed reviewer="Friso Olnon" date="1996/11/06" tests="tDataConversion" demos="">
42// </reviewed>
43
44// <synopsis>
45// This class is a specialization of the abstract base class
46// <linkto class=DataConversion>DataConversion</linkto>.
47// It contains functions to copy data without conversion.
48// <p>
49// This class exists to make it possible to use a <src>DataConversion</src>
50// object when no conversion is actually needed.
51// </synopsis>
52
53// <example>
54// See example in class <linkto class=DataConversion>DataConversion</linkto>.
55// </example>
56
57// <motivation>
58// This class makes it possible to use the conversion framework
59// for operations where a conversion is only a simple copy.
60// </motivation>
61
62// <todo asof="$DATE$">
63// <li> Support data type long double.
64// </todo>
65
67 public:
68 // Construct the object.
70
72
73 // Copy one value from external to local (is a simple memcpy).
74 // The from and to buffer should not overlap.
75 // <group>
76 size_t toLocal(char& to, const void* from) const override;
77 size_t toLocal(unsigned char& to, const void* from) const override;
78 size_t toLocal(short& to, const void* from) const override;
79 size_t toLocal(unsigned short& to, const void* from) const override;
80 size_t toLocal(int& to, const void* from) const override;
81 size_t toLocal(unsigned int& to, const void* from) const override;
82 size_t toLocal(Int64& to, const void* from) const override;
83 size_t toLocal(uInt64& to, const void* from) const override;
84 size_t toLocal(float& to, const void* from) const override;
85 size_t toLocal(double& to, const void* from) const override;
86 // </group>
87
88 // Copy multiple values from external to local (is a simple memcpy).
89 // The from and to buffer should not overlap.
90 // <group>
91 size_t toLocal(char* to, const void* from, size_t nr) const override;
92 size_t toLocal(unsigned char* to, const void* from, size_t nr) const override;
93 size_t toLocal(short* to, const void* from, size_t nr) const override;
94 size_t toLocal(unsigned short* to, const void* from, size_t nr) const override;
95 size_t toLocal(int* to, const void* from, size_t nr) const override;
96 size_t toLocal(unsigned int* to, const void* from, size_t nr) const override;
97 size_t toLocal(Int64* to, const void* from, size_t nr) const override;
98 size_t toLocal(uInt64* to, const void* from, size_t nr) const override;
99 size_t toLocal(float* to, const void* from, size_t nr) const override;
100 size_t toLocal(double* to, const void* from, size_t nr) const override;
101 // </group>
102
103 // Copy one value from local to external (is a simple memcpy).
104 // The from and to buffer should not overlap.
105 // <group>
106 size_t fromLocal(void* to, char from) const override;
107 size_t fromLocal(void* to, unsigned char from) const override;
108 size_t fromLocal(void* to, short from) const override;
109 size_t fromLocal(void* to, unsigned short from) const override;
110 size_t fromLocal(void* to, int from) const override;
111 size_t fromLocal(void* to, unsigned int from) const override;
112 size_t fromLocal(void* to, Int64 from) const override;
113 size_t fromLocal(void* to, uInt64 from) const override;
114 size_t fromLocal(void* to, float from) const override;
115 size_t fromLocal(void* to, double from) const override;
116 // </group>
117
118 // Copy multiple values from local to external (is a simple memcpy).
119 // The from and to buffer should not overlap.
120 // <group>
121 size_t fromLocal(void* to, const char* from, size_t nr) const override;
122 size_t fromLocal(void* to, const unsigned char* from, size_t nr) const override;
123 size_t fromLocal(void* to, const short* from, size_t nr) const override;
124 size_t fromLocal(void* to, const unsigned short* from, size_t nr) const override;
125 size_t fromLocal(void* to, const int* from, size_t nr) const override;
126 size_t fromLocal(void* to, const unsigned int* from, size_t nr) const override;
127 size_t fromLocal(void* to, const Int64* from, size_t nr) const override;
128 size_t fromLocal(void* to, const uInt64* from, size_t nr) const override;
129 size_t fromLocal(void* to, const float* from, size_t nr) const override;
130 size_t fromLocal(void* to, const double* from, size_t nr) const override;
131 // </group>
132
133 // Determine if the data for a data type can be simply copied, thus
134 // if no conversion is needed. This is always True.
135 // <group>
136 Bool canCopy(const char*) const override;
137 Bool canCopy(const unsigned char*) const override;
138 Bool canCopy(const short*) const override;
139 Bool canCopy(const unsigned short*) const override;
140 Bool canCopy(const int*) const override;
141 Bool canCopy(const unsigned int*) const override;
142 Bool canCopy(const Int64*) const override;
143 Bool canCopy(const uInt64*) const override;
144 Bool canCopy(const float*) const override;
145 Bool canCopy(const double*) const override;
146 // </group>
147
148 // Get the external size of the data type.
149 // This returns the <src>sizeof</src>.
150 // <group>
151 unsigned int externalSize(const char*) const override;
152 unsigned int externalSize(const unsigned char*) const override;
153 unsigned int externalSize(const short*) const override;
154 unsigned int externalSize(const unsigned short*) const override;
155 unsigned int externalSize(const int*) const override;
156 unsigned int externalSize(const unsigned int*) const override;
157 unsigned int externalSize(const Int64*) const override;
158 unsigned int externalSize(const uInt64*) const override;
159 unsigned int externalSize(const float*) const override;
160 unsigned int externalSize(const double*) const override;
161 // </group>
162};
163
165
166} // namespace casacore
167
168#endif
DataConversion()
Construct the object.
size_t toLocal(short &to, const void *from) const override
size_t toLocal(double &to, const void *from) const override
unsigned int externalSize(const unsigned char *) const override
size_t toLocal(uInt64 &to, const void *from) const override
size_t fromLocal(void *to, short from) const override
size_t toLocal(unsigned short *to, const void *from, size_t nr) const override
unsigned int externalSize(const Int64 *) 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.
Bool canCopy(const uInt64 *) const override
unsigned int externalSize(const unsigned int *) const override
size_t fromLocal(void *to, const int *from, size_t nr) const override
size_t fromLocal(void *to, const unsigned int *from, size_t nr) const override
size_t fromLocal(void *to, float from) const override
size_t fromLocal(void *to, const uInt64 *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, Int64 from) const override
size_t toLocal(Int64 &to, const void *from) const override
unsigned int externalSize(const char *) const override
Get the external size of the data type.
size_t fromLocal(void *to, int from) const override
size_t toLocal(unsigned int &to, const void *from) const override
size_t toLocal(unsigned int *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, const double *from, size_t nr) const override
size_t fromLocal(void *to, const char *from, size_t nr) const override
Copy multiple values from local to external (is a simple memcpy).
unsigned int externalSize(const uInt64 *) const override
size_t fromLocal(void *to, unsigned short from) const override
size_t fromLocal(void *to, uInt64 from) const override
Bool canCopy(const short *) const override
unsigned int externalSize(const float *) const override
Bool canCopy(const float *) const override
Bool canCopy(const unsigned short *) const override
size_t toLocal(unsigned short &to, const void *from) const override
Bool canCopy(const unsigned char *) const override
unsigned int externalSize(const int *) const override
size_t fromLocal(void *to, unsigned int from) const override
size_t fromLocal(void *to, const unsigned char *from, size_t nr) const override
size_t fromLocal(void *to, const Int64 *from, size_t nr) const override
size_t toLocal(char *to, const void *from, size_t nr) const override
Copy multiple values from external to local (is a simple memcpy).
size_t toLocal(Int64 *to, const void *from, size_t nr) const override
size_t fromLocal(void *to, unsigned char from) const override
size_t toLocal(float &to, const void *from) const override
size_t toLocal(float *to, const void *from, size_t nr) const override
RawDataConversion()
Construct the object.
size_t toLocal(int *to, const void *from, size_t nr) const override
size_t fromLocal(void *to, const unsigned short *from, size_t nr) const override
unsigned int externalSize(const short *) const override
size_t fromLocal(void *to, double from) const override
size_t toLocal(char &to, const void *from) const override
Copy one value from external to local (is a simple memcpy).
unsigned int externalSize(const unsigned short *) const override
unsigned int externalSize(const double *) const override
Bool canCopy(const double *) const override
Bool canCopy(const unsigned int *) const override
Bool canCopy(const Int64 *) const override
size_t fromLocal(void *to, const float *from, size_t nr) const override
size_t toLocal(double *to, const void *from, size_t nr) const override
size_t toLocal(short *to, const void *from, size_t nr) const override
size_t toLocal(unsigned char &to, const void *from) const override
Bool canCopy(const int *) const override
size_t toLocal(uInt64 *to, const void *from, size_t nr) const override
size_t toLocal(int &to, const void *from) const override
size_t fromLocal(void *to, char from) const override
Copy one value from local to external (is a simple memcpy).
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