casacore
Loading...
Searching...
No Matches
ModcompDataConversion.h
Go to the documentation of this file.
1// # ModcompDataConversion.h: A DataConversion class to convert Modcomp format.
2// # Copyright (C) 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_MODCOMPDATACONVERSION_H
27#define CASA_MODCOMPDATACONVERSION_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/casa/OS/DataConversion.h>
31
32namespace casacore { // # NAMESPACE CASACORE - BEGIN
33
34// <summary>A DataConversion class to convert between Modcomp format.</summary>
35
36// <use visibility=export>
37
38// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
39// </reviewed>
40
41// <synopsis>
42// This class is a specialization of the abstract base class
43// <linkto class=DataConversion>DataConversion</linkto>.
44// It contains functions to convert data from/to the Modcomp format
45// using the static functions in class <linkto class=ModcompConversion>
46// ModcompConversion</linkto>.
47// </synopsis>
48
49// <example>
50// See example in class <linkto class=DataConversion>DataConversion</linkto>.
51// </example>
52
53// <motivation>
54// This class is an addition to <linkto class=ModcompConversion>
55// ModcompConversion</linkto>
56// to be able to use the conversion functions in a polymorphic way.
57// </motivation>
58
59// <todo asof="$DATE$">
60// <li> Support data type long Double.
61// </todo>
62
64 public:
65 // Construct the object.
67
69
70 // Convert one value from Modcomp format to local format.
71 // The from and to buffer should not overlap.
72 // <group>
73 virtual size_t toLocal(Char& to, const void* from) const;
74 virtual size_t toLocal(uChar& to, const void* from) const;
75 virtual size_t toLocal(Short& to, const void* from) const;
76 virtual size_t toLocal(uShort& to, const void* from) const;
77 virtual size_t toLocal(Int& to, const void* from) const;
78 virtual size_t toLocal(uInt& to, const void* from) const;
79 virtual size_t toLocal(Int64& to, const void* from) const;
80 virtual size_t toLocal(uInt64& to, const void* from) const;
81 virtual size_t toLocal(Float& to, const void* from) const;
82 virtual size_t toLocal(Double& to, const void* from) const;
83 // </group>
84
85 // Convert nr values from Modcomp format to local format.
86 // The from and to buffer should not overlap.
87 // <group>
88 virtual size_t toLocal(Char* to, const void* from, size_t nr) const;
89 virtual size_t toLocal(uChar* to, const void* from, size_t nr) const;
90 virtual size_t toLocal(Short* to, const void* from, size_t nr) const;
91 virtual size_t toLocal(uShort* to, const void* from, size_t nr) const;
92 virtual size_t toLocal(Int* to, const void* from, size_t nr) const;
93 virtual size_t toLocal(uInt* to, const void* from, size_t nr) const;
94 virtual size_t toLocal(Int64* to, const void* from, size_t nr) const;
95 virtual size_t toLocal(uInt64* to, const void* from, size_t nr) const;
96 virtual size_t toLocal(Float* to, const void* from, size_t nr) const;
97 virtual size_t toLocal(Double* to, const void* from, size_t nr) const;
98 // </group>
99
100 // Convert one value from local format to Modcomp format.
101 // The from and to buffer should not overlap.
102 // <group>
103 virtual size_t fromLocal(void* to, Char from) const;
104 virtual size_t fromLocal(void* to, uChar from) const;
105 virtual size_t fromLocal(void* to, Short from) const;
106 virtual size_t fromLocal(void* to, uShort from) const;
107 virtual size_t fromLocal(void* to, Int from) const;
108 virtual size_t fromLocal(void* to, uInt from) const;
109 virtual size_t fromLocal(void* to, Int64 from) const;
110 virtual size_t fromLocal(void* to, uInt64 from) const;
111 virtual size_t fromLocal(void* to, Float from) const;
112 virtual size_t fromLocal(void* to, Double from) const;
113 // </group>
114
115 // Convert nr values from local format to ModComp format.
116 // The from and to buffer should not overlap.
117 // <group>
118 virtual size_t fromLocal(void* to, const Char* from, size_t nr) const;
119 virtual size_t fromLocal(void* to, const uChar* from, size_t nr) const;
120 virtual size_t fromLocal(void* to, const Short* from, size_t nr) const;
121 virtual size_t fromLocal(void* to, const uShort* from, size_t nr) const;
122 virtual size_t fromLocal(void* to, const Int* from, size_t nr) const;
123 virtual size_t fromLocal(void* to, const uInt* from, size_t nr) const;
124 virtual size_t fromLocal(void* to, const Int64* from, size_t nr) const;
125 virtual size_t fromLocal(void* to, const uInt64* from, size_t nr) const;
126 virtual size_t fromLocal(void* to, const Float* from, size_t nr) const;
127 virtual size_t fromLocal(void* to, const Double* from, size_t nr) const;
128 // </group>
129
130 // Determine if the data for a data type can be simply copied, thus
131 // if no conversion is needed.
132 // <group>
133 virtual Bool canCopy(const Char*) const;
134 virtual Bool canCopy(const uChar*) const;
135 virtual Bool canCopy(const Short*) const;
136 virtual Bool canCopy(const uShort*) const;
137 virtual Bool canCopy(const Int*) const;
138 virtual Bool canCopy(const uInt*) const;
139 virtual Bool canCopy(const Int64*) const;
140 virtual Bool canCopy(const uInt64*) const;
141 virtual Bool canCopy(const Float*) const;
142 virtual Bool canCopy(const Double*) const;
143 // </group>
144
145 // Get the external size of the data type.
146 // <group>
147 virtual uInt externalSize(const Char*) const;
148 virtual uInt externalSize(const uChar*) const;
149 virtual uInt externalSize(const Short*) const;
150 virtual uInt externalSize(const uShort*) const;
151 virtual uInt externalSize(const Int*) const;
152 virtual uInt externalSize(const uInt*) const;
153 virtual uInt externalSize(const Int64*) const;
154 virtual uInt externalSize(const uInt64*) const;
155 virtual uInt externalSize(const Float*) const;
156 virtual uInt externalSize(const Double*) const;
157 // </group>
158};
159
161
162} // namespace casacore
163
164#endif
DataConversion()
Construct the object.
virtual size_t fromLocal(void *to, const uShort *from, size_t nr) const
virtual size_t toLocal(Int64 &to, const void *from) const
virtual Bool canCopy(const Int *) const
virtual size_t fromLocal(void *to, Int64 from) const
virtual size_t toLocal(Double *to, const void *from, size_t nr) const
virtual size_t fromLocal(void *to, const uInt64 *from, size_t nr) const
virtual uInt externalSize(const Char *) const
Get the external size of the data type.
virtual Bool canCopy(const Float *) const
virtual Bool canCopy(const uInt *) const
virtual size_t fromLocal(void *to, Char from) const
Convert one value from local format to Modcomp format.
virtual size_t toLocal(uInt64 *to, const void *from, size_t nr) const
virtual size_t toLocal(uInt &to, const void *from) const
virtual Bool canCopy(const uChar *) const
virtual uInt externalSize(const Int *) const
virtual size_t fromLocal(void *to, const Int *from, size_t nr) const
virtual size_t fromLocal(void *to, const Short *from, size_t nr) const
virtual size_t toLocal(Float &to, const void *from) const
virtual size_t toLocal(Short &to, const void *from) const
virtual size_t fromLocal(void *to, uChar from) const
virtual size_t fromLocal(void *to, uInt from) const
virtual size_t fromLocal(void *to, uInt64 from) const
virtual size_t fromLocal(void *to, Int from) const
virtual size_t fromLocal(void *to, Short from) const
virtual size_t toLocal(Short *to, const void *from, size_t nr) const
virtual size_t toLocal(Int &to, const void *from) const
virtual size_t fromLocal(void *to, const uChar *from, size_t nr) const
virtual size_t toLocal(uChar &to, const void *from) const
virtual uInt externalSize(const uInt64 *) const
virtual size_t fromLocal(void *to, const Char *from, size_t nr) const
Convert nr values from local format to ModComp format.
virtual size_t fromLocal(void *to, const Int64 *from, size_t nr) const
virtual Bool canCopy(const Int64 *) const
virtual size_t toLocal(Double &to, const void *from) const
virtual size_t toLocal(Char *to, const void *from, size_t nr) const
Convert nr values from Modcomp format to local format.
virtual Bool canCopy(const Char *) const
Determine if the data for a data type can be simply copied, thus if no conversion is needed.
virtual size_t toLocal(Int64 *to, const void *from, size_t nr) const
virtual size_t fromLocal(void *to, uShort from) const
virtual uInt externalSize(const Double *) const
virtual uInt externalSize(const Short *) const
virtual size_t toLocal(uInt *to, const void *from, size_t nr) const
virtual size_t toLocal(Float *to, const void *from, size_t nr) const
virtual size_t fromLocal(void *to, const Double *from, size_t nr) const
virtual size_t fromLocal(void *to, const Float *from, size_t nr) const
virtual uInt externalSize(const uChar *) const
virtual uInt externalSize(const uInt *) const
virtual size_t toLocal(uShort *to, const void *from, size_t nr) const
virtual uInt externalSize(const uShort *) const
virtual size_t toLocal(uShort &to, const void *from) const
virtual Bool canCopy(const uInt64 *) const
virtual size_t toLocal(Char &to, const void *from) const
Convert one value from Modcomp format to local format.
ModcompDataConversion()
Construct the object.
virtual size_t toLocal(Int *to, const void *from, size_t nr) const
virtual Bool canCopy(const Short *) const
virtual size_t toLocal(uInt64 &to, const void *from) const
virtual size_t toLocal(uChar *to, const void *from, size_t nr) const
virtual size_t fromLocal(void *to, Float from) const
virtual size_t fromLocal(void *to, Double from) const
virtual Bool canCopy(const uShort *) const
virtual Bool canCopy(const Double *) const
virtual size_t fromLocal(void *to, const uInt *from, size_t nr) const
virtual uInt externalSize(const Float *) const
virtual uInt externalSize(const Int64 *) const
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned char uChar
Definition aipstype.h:45
short Short
Definition aipstype.h:46
unsigned int uInt
Definition aipstype.h:49
unsigned short uShort
Definition aipstype.h:47
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
Definition aipsxtype.h:36
float Float
Definition aipstype.h:52
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53
char Char
Definition aipstype.h:44
unsigned long long uInt64
Definition aipsxtype.h:37