casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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_MODCOMPDATACONVERSION_H
29 #define CASA_MODCOMPDATACONVERSION_H
30 
31 #include <casacore/casa/aips.h>
33 
34 namespace casacore { //# NAMESPACE CASACORE - BEGIN
35 
36 // <summary>A DataConversion class to convert between Modcomp format.</summary>
37 
38 // <use visibility=export>
39 
40 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" 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 Modcomp format
47 // using the static functions in class <linkto class=ModcompConversion>
48 // ModcompConversion</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=ModcompConversion>
57 // ModcompConversion</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 
65 
67 {
68 public:
69  // Construct the object.
71 
72  virtual ~ModcompDataConversion();
73 
74  // Convert one value from Modcomp format to local format.
75  // The from and to buffer should not overlap.
76  // <group>
77  virtual size_t toLocal (Char& to, const void* from) const;
78  virtual size_t toLocal (uChar& to, const void* from) const;
79  virtual size_t toLocal (Short& to, const void* from) const;
80  virtual size_t toLocal (uShort& to, const void* from) const;
81  virtual size_t toLocal (Int& to, const void* from) const;
82  virtual size_t toLocal (uInt& to, const void* from) const;
83  virtual size_t toLocal (Int64& to, const void* from) const;
84  virtual size_t toLocal (uInt64& to, const void* from) const;
85  virtual size_t toLocal (Float& to, const void* from) const;
86  virtual size_t toLocal (Double& to, const void* from) const;
87  // </group>
88 
89  // Convert nr values from Modcomp format to local format.
90  // The from and to buffer should not overlap.
91  // <group>
92  virtual size_t toLocal (Char* to, const void* from, size_t nr) const;
93  virtual size_t toLocal (uChar* to, const void* from, size_t nr) const;
94  virtual size_t toLocal (Short* to, const void* from, size_t nr) const;
95  virtual size_t toLocal (uShort* to, const void* from, size_t nr) const;
96  virtual size_t toLocal (Int* to, const void* from, size_t nr) const;
97  virtual size_t toLocal (uInt* to, const void* from, size_t nr) const;
98  virtual size_t toLocal (Int64* to, const void* from, size_t nr) const;
99  virtual size_t toLocal (uInt64* to, const void* from, size_t nr) const;
100  virtual size_t toLocal (Float* to, const void* from, size_t nr) const;
101  virtual size_t toLocal (Double* to, const void* from, size_t nr) const;
102  // </group>
103 
104  // Convert one value from local format to Modcomp format.
105  // The from and to buffer should not overlap.
106  // <group>
107  virtual size_t fromLocal (void* to, Char from) const;
108  virtual size_t fromLocal (void* to, uChar from) const;
109  virtual size_t fromLocal (void* to, Short from) const;
110  virtual size_t fromLocal (void* to, uShort from) const;
111  virtual size_t fromLocal (void* to, Int from) const;
112  virtual size_t fromLocal (void* to, uInt from) const;
113  virtual size_t fromLocal (void* to, Int64 from) const;
114  virtual size_t fromLocal (void* to, uInt64 from) const;
115  virtual size_t fromLocal (void* to, Float from) const;
116  virtual size_t fromLocal (void* to, Double from) const;
117  // </group>
118 
119  // Convert nr values from local format to ModComp format.
120  // The from and to buffer should not overlap.
121  // <group>
122  virtual size_t fromLocal (void* to, const Char* from, size_t nr) const;
123  virtual size_t fromLocal (void* to, const uChar* from, size_t nr) const;
124  virtual size_t fromLocal (void* to, const Short* from, size_t nr) const;
125  virtual size_t fromLocal (void* to, const uShort* from, size_t nr) const;
126  virtual size_t fromLocal (void* to, const Int* from, size_t nr) const;
127  virtual size_t fromLocal (void* to, const uInt* from, size_t nr) const;
128  virtual size_t fromLocal (void* to, const Int64* from, size_t nr) const;
129  virtual size_t fromLocal (void* to, const uInt64* from, size_t nr) const;
130  virtual size_t fromLocal (void* to, const Float* from, size_t nr) const;
131  virtual size_t fromLocal (void* to, const Double* from, size_t nr) const;
132  // </group>
133 
134  // Determine if the data for a data type can be simply copied, thus
135  // if no conversion is needed.
136  // <group>
137  virtual Bool canCopy (const Char*) const;
138  virtual Bool canCopy (const uChar*) const;
139  virtual Bool canCopy (const Short*) const;
140  virtual Bool canCopy (const uShort*) const;
141  virtual Bool canCopy (const Int*) const;
142  virtual Bool canCopy (const uInt*) const;
143  virtual Bool canCopy (const Int64*) const;
144  virtual Bool canCopy (const uInt64*) const;
145  virtual Bool canCopy (const Float*) const;
146  virtual Bool canCopy (const Double*) const;
147  // </group>
148 
149  // Get the external size of the data type.
150  // <group>
151  virtual uInt externalSize (const Char*) const;
152  virtual uInt externalSize (const uChar*) const;
153  virtual uInt externalSize (const Short*) const;
154  virtual uInt externalSize (const uShort*) const;
155  virtual uInt externalSize (const Int*) const;
156  virtual uInt externalSize (const uInt*) const;
157  virtual uInt externalSize (const Int64*) const;
158  virtual uInt externalSize (const uInt64*) const;
159  virtual uInt externalSize (const Float*) const;
160  virtual uInt externalSize (const Double*) const;
161  // </group>
162 };
163 
164 
166 }
167 
168 } //# NAMESPACE CASACORE - END
169 
170 #endif
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
int Int
Definition: aipstype.h:50
Abstract base class with functions to convert any format.
unsigned long long uInt64
Definition: aipsxtype.h:39
unsigned char uChar
Definition: aipstype.h:47
char Char
Definition: aipstype.h:46
short Short
Definition: aipstype.h:48
virtual size_t toLocal(Char &to, const void *from) const
Convert one value from Modcomp format to local format.
double Double
Definition: aipstype.h:55
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A DataConversion class to convert between Modcomp format.
float Float
Definition: aipstype.h:54
ModcompDataConversion()
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...
virtual size_t fromLocal(void *to, Char from) const
Convert one value from local format to Modcomp format.
virtual uInt externalSize(const Char *) const
Get the external size of the data type.
unsigned int uInt
Definition: aipstype.h:51
unsigned short uShort
Definition: aipstype.h:49