My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
ArchiveConvFn.h
Go to the documentation of this file.
1 // $Id: ArchiveConvFn.h,v 1.3 2011/08/26 23:59:34 eml Exp $
2 
3 #ifndef GCP_UTIL_ARCHIVECONVFN_H
4 #define GCP_UTIL_ARCHIVECONVFN_H
5 
16 #include "gcp/util/common/DataType.h"
17 #include "gcp/util/common/RegCal.h"
18 
19 #include <iostream>
20 
21 #define ARC_CONV_FN(fn) void (fn)(void* in, void* reOut, void* imOut, void* args, RegCal::RegCalSlot* cals, unsigned& n, unsigned* inInds, unsigned* outInds, unsigned iAdd)
22 
23 #define ARC_PRINT_FN(fn) void (fn)(void* in, std::ostringstream& os, void* args, RegCal::RegCalSlot* cals, unsigned& n, int width, int precision)
24 
25 #define STRING_DISPATCH_FN(fn) void (fn)(const char* carr, void* args, unsigned& ind)
26 
27 namespace gcp {
28  namespace util {
29 
30  class ArchiveConvFn {
31  public:
32 
33  static ARC_CONV_FN(boolToBool);
34  static ARC_CONV_FN(boolToUchar);
35  static ARC_CONV_FN(boolToChar);
36  static ARC_CONV_FN(boolToUshort);
37  static ARC_CONV_FN(boolToShort);
38  static ARC_CONV_FN(boolToUint);
39  static ARC_CONV_FN(boolToInt);
40  static ARC_CONV_FN(boolToUlong);
41  static ARC_CONV_FN(boolToLong);
42  static ARC_CONV_FN(boolToFloat);
43  static ARC_CONV_FN(boolToDouble);
44 
45  static ARC_CONV_FN(ucharToBool);
46  static ARC_CONV_FN(ucharToUchar);
47  static ARC_CONV_FN(ucharToChar);
48  static ARC_CONV_FN(ucharToUshort);
49  static ARC_CONV_FN(ucharToShort);
50  static ARC_CONV_FN(ucharToUint);
51  static ARC_CONV_FN(ucharToInt);
52  static ARC_CONV_FN(ucharToUlong);
53  static ARC_CONV_FN(ucharToLong);
54  static ARC_CONV_FN(ucharToFloat);
55  static ARC_CONV_FN(ucharToDouble);
56  static ARC_CONV_FN(ucharToString);
57 
58  static ARC_CONV_FN(charToBool);
59  static ARC_CONV_FN(charToUchar);
60  static ARC_CONV_FN(charToChar);
61  static ARC_CONV_FN(charToUshort);
62  static ARC_CONV_FN(charToShort);
63  static ARC_CONV_FN(charToUint);
64  static ARC_CONV_FN(charToInt);
65  static ARC_CONV_FN(charToUlong);
66  static ARC_CONV_FN(charToLong);
67  static ARC_CONV_FN(charToFloat);
68  static ARC_CONV_FN(charToDouble);
69  static ARC_CONV_FN(charToString);
70 
71  static ARC_CONV_FN(ushortToBool);
72  static ARC_CONV_FN(ushortToUchar);
73  static ARC_CONV_FN(ushortToChar);
74  static ARC_CONV_FN(ushortToUshort);
75  static ARC_CONV_FN(ushortToShort);
76  static ARC_CONV_FN(ushortToUint);
77  static ARC_CONV_FN(ushortToInt);
78  static ARC_CONV_FN(ushortToUlong);
79  static ARC_CONV_FN(ushortToLong);
80  static ARC_CONV_FN(ushortToFloat);
81  static ARC_CONV_FN(ushortToDouble);
82 
83  static ARC_CONV_FN(shortToBool);
84  static ARC_CONV_FN(shortToUchar);
85  static ARC_CONV_FN(shortToChar);
86  static ARC_CONV_FN(shortToUshort);
87  static ARC_CONV_FN(shortToShort);
88  static ARC_CONV_FN(shortToUint);
89  static ARC_CONV_FN(shortToInt);
90  static ARC_CONV_FN(shortToUlong);
91  static ARC_CONV_FN(shortToLong);
92  static ARC_CONV_FN(shortToFloat);
93  static ARC_CONV_FN(shortToDouble);
94 
95  static ARC_CONV_FN(uintToBool);
96  static ARC_CONV_FN(uintToUchar);
97  static ARC_CONV_FN(uintToChar);
98  static ARC_CONV_FN(uintToUshort);
99  static ARC_CONV_FN(uintToShort);
100  static ARC_CONV_FN(uintToUint);
101  static ARC_CONV_FN(uintToInt);
102  static ARC_CONV_FN(uintToUlong);
103  static ARC_CONV_FN(uintToLong);
104  static ARC_CONV_FN(uintToFloat);
105  static ARC_CONV_FN(uintToDouble);
106 
107  static ARC_CONV_FN(intToBool);
108  static ARC_CONV_FN(intToUchar);
109  static ARC_CONV_FN(intToChar);
110  static ARC_CONV_FN(intToUshort);
111  static ARC_CONV_FN(intToShort);
112  static ARC_CONV_FN(intToUint);
113  static ARC_CONV_FN(intToInt);
114  static ARC_CONV_FN(intToUlong);
115  static ARC_CONV_FN(intToLong);
116  static ARC_CONV_FN(intToFloat);
117  static ARC_CONV_FN(intToDouble);
118 
119  static ARC_CONV_FN(ulongToBool);
120  static ARC_CONV_FN(ulongToUchar);
121  static ARC_CONV_FN(ulongToChar);
122  static ARC_CONV_FN(ulongToUshort);
123  static ARC_CONV_FN(ulongToShort);
124  static ARC_CONV_FN(ulongToUint);
125  static ARC_CONV_FN(ulongToInt);
126  static ARC_CONV_FN(ulongToUlong);
127  static ARC_CONV_FN(ulongToLong);
128  static ARC_CONV_FN(ulongToFloat);
129  static ARC_CONV_FN(ulongToDouble);
130 
131  static ARC_CONV_FN(longToBool);
132  static ARC_CONV_FN(longToUchar);
133  static ARC_CONV_FN(longToChar);
134  static ARC_CONV_FN(longToUshort);
135  static ARC_CONV_FN(longToShort);
136  static ARC_CONV_FN(longToUint);
137  static ARC_CONV_FN(longToInt);
138  static ARC_CONV_FN(longToUlong);
139  static ARC_CONV_FN(longToLong);
140  static ARC_CONV_FN(longToFloat);
141  static ARC_CONV_FN(longToDouble);
142 
143  static ARC_CONV_FN(floatToBool);
144  static ARC_CONV_FN(floatToUchar);
145  static ARC_CONV_FN(floatToChar);
146  static ARC_CONV_FN(floatToUshort);
147  static ARC_CONV_FN(floatToShort);
148  static ARC_CONV_FN(floatToUint);
149  static ARC_CONV_FN(floatToInt);
150  static ARC_CONV_FN(floatToUlong);
151  static ARC_CONV_FN(floatToLong);
152  static ARC_CONV_FN(floatToFloat);
153  static ARC_CONV_FN(floatToDouble);
154 
155  static ARC_CONV_FN(doubleToBool);
156  static ARC_CONV_FN(doubleToUchar);
157  static ARC_CONV_FN(doubleToChar);
158  static ARC_CONV_FN(doubleToUshort);
159  static ARC_CONV_FN(doubleToShort);
160  static ARC_CONV_FN(doubleToUint);
161  static ARC_CONV_FN(doubleToInt);
162  static ARC_CONV_FN(doubleToUlong);
163  static ARC_CONV_FN(doubleToLong);
164  static ARC_CONV_FN(doubleToFloat);
165  static ARC_CONV_FN(doubleToDouble);
166 
167  static ARC_CONV_FN(complexFloatToComplexFloat);
168 
169  static ARC_CONV_FN(dateToBool);
170  static ARC_CONV_FN(dateToUchar);
171  static ARC_CONV_FN(dateToChar);
172  static ARC_CONV_FN(dateToUshort);
173  static ARC_CONV_FN(dateToShort);
174  static ARC_CONV_FN(dateToUint);
175  static ARC_CONV_FN(dateToInt);
176  static ARC_CONV_FN(dateToUlong);
177  static ARC_CONV_FN(dateToLong);
178  static ARC_CONV_FN(dateToFloat);
179  static ARC_CONV_FN(dateToDouble);
180  static ARC_CONV_FN(dateToString);
181 
182  static void setConvFn(DataType::Type inType, DataType::Type outType,
183  ARC_CONV_FN(**fptr));
184 
185  static void setBoolConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
186  static void setUcharConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
187  static void setCharConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
188  static void setUshortConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
189  static void setShortConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
190  static void setUintConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
191  static void setIntConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
192  static void setUlongConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
193  static void setLongConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
194  static void setFloatConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
195  static void setDoubleConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
196  static void setComplexFloatConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
197  static void setDateConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
198 
199  // A function that will be called to dispatch a string formatted
200  // by one of the string conversion methods of this class
201 
202  static STRING_DISPATCH_FN(*stringDispatchFn_);
203  static void setStringDispatchFn(STRING_DISPATCH_FN(*stringDispatchFn_));
204 
205  static ARC_PRINT_FN(printBoolToBool);
206  static ARC_PRINT_FN(printBoolToUchar);
207  static ARC_PRINT_FN(printBoolToChar);
208  static ARC_PRINT_FN(printBoolToUshort);
209  static ARC_PRINT_FN(printBoolToShort);
210  static ARC_PRINT_FN(printBoolToUint);
211  static ARC_PRINT_FN(printBoolToInt);
212  static ARC_PRINT_FN(printBoolToUlong);
213  static ARC_PRINT_FN(printBoolToLong);
214  static ARC_PRINT_FN(printBoolToFloat);
215  static ARC_PRINT_FN(printBoolToDouble);
216  static ARC_PRINT_FN(printBoolToString);
217 
218  static ARC_PRINT_FN(printUcharToBool);
219  static ARC_PRINT_FN(printUcharToUchar);
220  static ARC_PRINT_FN(printUcharToChar);
221  static ARC_PRINT_FN(printUcharToUshort);
222  static ARC_PRINT_FN(printUcharToShort);
223  static ARC_PRINT_FN(printUcharToUint);
224  static ARC_PRINT_FN(printUcharToInt);
225  static ARC_PRINT_FN(printUcharToUlong);
226  static ARC_PRINT_FN(printUcharToLong);
227  static ARC_PRINT_FN(printUcharToFloat);
228  static ARC_PRINT_FN(printUcharToDouble);
229  static ARC_PRINT_FN(printUcharToString);
230 
231  static ARC_PRINT_FN(printCharToBool);
232  static ARC_PRINT_FN(printCharToUchar);
233  static ARC_PRINT_FN(printCharToChar);
234  static ARC_PRINT_FN(printCharToUshort);
235  static ARC_PRINT_FN(printCharToShort);
236  static ARC_PRINT_FN(printCharToUint);
237  static ARC_PRINT_FN(printCharToInt);
238  static ARC_PRINT_FN(printCharToUlong);
239  static ARC_PRINT_FN(printCharToLong);
240  static ARC_PRINT_FN(printCharToFloat);
241  static ARC_PRINT_FN(printCharToDouble);
242  static ARC_PRINT_FN(printCharToString);
243 
244  static ARC_PRINT_FN(printUshortToBool);
245  static ARC_PRINT_FN(printUshortToUchar);
246  static ARC_PRINT_FN(printUshortToChar);
247  static ARC_PRINT_FN(printUshortToUshort);
248  static ARC_PRINT_FN(printUshortToShort);
249  static ARC_PRINT_FN(printUshortToUint);
250  static ARC_PRINT_FN(printUshortToInt);
251  static ARC_PRINT_FN(printUshortToUlong);
252  static ARC_PRINT_FN(printUshortToLong);
253  static ARC_PRINT_FN(printUshortToFloat);
254  static ARC_PRINT_FN(printUshortToDouble);
255 
256  static ARC_PRINT_FN(printShortToBool);
257  static ARC_PRINT_FN(printShortToUchar);
258  static ARC_PRINT_FN(printShortToChar);
259  static ARC_PRINT_FN(printShortToUshort);
260  static ARC_PRINT_FN(printShortToShort);
261  static ARC_PRINT_FN(printShortToUint);
262  static ARC_PRINT_FN(printShortToInt);
263  static ARC_PRINT_FN(printShortToUlong);
264  static ARC_PRINT_FN(printShortToLong);
265  static ARC_PRINT_FN(printShortToFloat);
266  static ARC_PRINT_FN(printShortToDouble);
267 
268  static ARC_PRINT_FN(printUintToBool);
269  static ARC_PRINT_FN(printUintToUchar);
270  static ARC_PRINT_FN(printUintToChar);
271  static ARC_PRINT_FN(printUintToUshort);
272  static ARC_PRINT_FN(printUintToShort);
273  static ARC_PRINT_FN(printUintToUint);
274  static ARC_PRINT_FN(printUintToInt);
275  static ARC_PRINT_FN(printUintToUlong);
276  static ARC_PRINT_FN(printUintToLong);
277  static ARC_PRINT_FN(printUintToFloat);
278  static ARC_PRINT_FN(printUintToDouble);
279 
280  static ARC_PRINT_FN(printIntToBool);
281  static ARC_PRINT_FN(printIntToUchar);
282  static ARC_PRINT_FN(printIntToChar);
283  static ARC_PRINT_FN(printIntToUshort);
284  static ARC_PRINT_FN(printIntToShort);
285  static ARC_PRINT_FN(printIntToUint);
286  static ARC_PRINT_FN(printIntToInt);
287  static ARC_PRINT_FN(printIntToUlong);
288  static ARC_PRINT_FN(printIntToLong);
289  static ARC_PRINT_FN(printIntToFloat);
290  static ARC_PRINT_FN(printIntToDouble);
291 
292  static ARC_PRINT_FN(printUlongToBool);
293  static ARC_PRINT_FN(printUlongToUchar);
294  static ARC_PRINT_FN(printUlongToChar);
295  static ARC_PRINT_FN(printUlongToUshort);
296  static ARC_PRINT_FN(printUlongToShort);
297  static ARC_PRINT_FN(printUlongToUint);
298  static ARC_PRINT_FN(printUlongToInt);
299  static ARC_PRINT_FN(printUlongToUlong);
300  static ARC_PRINT_FN(printUlongToLong);
301  static ARC_PRINT_FN(printUlongToFloat);
302  static ARC_PRINT_FN(printUlongToDouble);
303 
304  static ARC_PRINT_FN(printLongToBool);
305  static ARC_PRINT_FN(printLongToUchar);
306  static ARC_PRINT_FN(printLongToChar);
307  static ARC_PRINT_FN(printLongToUshort);
308  static ARC_PRINT_FN(printLongToShort);
309  static ARC_PRINT_FN(printLongToUint);
310  static ARC_PRINT_FN(printLongToInt);
311  static ARC_PRINT_FN(printLongToUlong);
312  static ARC_PRINT_FN(printLongToLong);
313  static ARC_PRINT_FN(printLongToFloat);
314  static ARC_PRINT_FN(printLongToDouble);
315 
316  static ARC_PRINT_FN(printFloatToBool);
317  static ARC_PRINT_FN(printFloatToUchar);
318  static ARC_PRINT_FN(printFloatToChar);
319  static ARC_PRINT_FN(printFloatToUshort);
320  static ARC_PRINT_FN(printFloatToShort);
321  static ARC_PRINT_FN(printFloatToUint);
322  static ARC_PRINT_FN(printFloatToInt);
323  static ARC_PRINT_FN(printFloatToUlong);
324  static ARC_PRINT_FN(printFloatToLong);
325  static ARC_PRINT_FN(printFloatToFloat);
326  static ARC_PRINT_FN(printFloatToDouble);
327 
328  static ARC_PRINT_FN(printDoubleToBool);
329  static ARC_PRINT_FN(printDoubleToUchar);
330  static ARC_PRINT_FN(printDoubleToChar);
331  static ARC_PRINT_FN(printDoubleToUshort);
332  static ARC_PRINT_FN(printDoubleToShort);
333  static ARC_PRINT_FN(printDoubleToUint);
334  static ARC_PRINT_FN(printDoubleToInt);
335  static ARC_PRINT_FN(printDoubleToUlong);
336  static ARC_PRINT_FN(printDoubleToLong);
337  static ARC_PRINT_FN(printDoubleToFloat);
338  static ARC_PRINT_FN(printDoubleToDouble);
339 
340  static ARC_PRINT_FN(printComplexFloatToComplexFloat);
341 
342  static ARC_PRINT_FN(printDateToBool);
343  static ARC_PRINT_FN(printDateToUchar);
344  static ARC_PRINT_FN(printDateToChar);
345  static ARC_PRINT_FN(printDateToUshort);
346  static ARC_PRINT_FN(printDateToShort);
347  static ARC_PRINT_FN(printDateToUint);
348  static ARC_PRINT_FN(printDateToInt);
349  static ARC_PRINT_FN(printDateToUlong);
350  static ARC_PRINT_FN(printDateToLong);
351  static ARC_PRINT_FN(printDateToFloat);
352  static ARC_PRINT_FN(printDateToDouble);
353  static ARC_PRINT_FN(printDateToString);
354 
355  static void setPrintFn(DataType::Type inType, DataType::Type outType,
356  ARC_PRINT_FN(**fptr));
357 
358  static void setBoolPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
359  static void setUcharPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
360  static void setCharPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
361  static void setUshortPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
362  static void setShortPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
363  static void setUintPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
364  static void setIntPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
365  static void setUlongPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
366  static void setLongPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
367  static void setFloatPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
368  static void setDoublePrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
369  static void setComplexFloatPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
370  static void setDatePrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
371 
372  virtual ~ArchiveConvFn();
373 
374  private:
375 
376  ArchiveConvFn();
377 
378  }; // End class ArchiveConvFn
379 
380  } // End namespace util
381 } // End namespace gcp
382 
383 
384 #endif // End #ifndef GCP_UTIL_ARCHIVECONVFN_H
static void setStringDispatchFn(STRING_DISPATCH_FN(*stringDispatchFn_))
Definition: ArchiveConvFn.cc:108
virtual ~ArchiveConvFn()
Definition: ArchiveConvFn.cc:103
Definition: ArchiveConvFn.h:30