CARMA C++
ArchiveConvFn.h
Go to the documentation of this file.
1 // $Id: ArchiveConvFn.h,v 1.3 2012/04/05 22:35:51 eml Exp $
2 
3 #ifndef SZA_UTIL_ARCHIVECONVFN_H
4 #define SZA_UTIL_ARCHIVECONVFN_H
5 
16 #include "carma/szautil/DataType.h"
17 #include "carma/szautil/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 sza {
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  static ARC_CONV_FN(dateToCarmaString);
182 
183 
184  static void setConvFn(DataType::Type inType, DataType::Type outType,
185  ARC_CONV_FN(**fptr));
186 
187  static void setBoolConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
188  static void setUcharConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
189  static void setStringConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
190  static void setCharConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
191  static void setUshortConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
192  static void setShortConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
193  static void setUintConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
194  static void setIntConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
195  static void setUlongConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
196  static void setLongConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
197  static void setFloatConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
198  static void setDoubleConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
199  static void setComplexFloatConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
200  static void setDateConvFn(DataType::Type outType, ARC_CONV_FN(**fptr));
201 
202  // A function that will be called to dispatch a string formatted
203  // by one of the string conversion methods of this class
204 
205  static STRING_DISPATCH_FN(*stringDispatchFn_);
206  static void setStringDispatchFn(STRING_DISPATCH_FN(*stringDispatchFn_));
207 
208  static ARC_PRINT_FN(printBoolToBool);
209  static ARC_PRINT_FN(printBoolToUchar);
210  static ARC_PRINT_FN(printBoolToChar);
211  static ARC_PRINT_FN(printBoolToUshort);
212  static ARC_PRINT_FN(printBoolToShort);
213  static ARC_PRINT_FN(printBoolToUint);
214  static ARC_PRINT_FN(printBoolToInt);
215  static ARC_PRINT_FN(printBoolToUlong);
216  static ARC_PRINT_FN(printBoolToLong);
217  static ARC_PRINT_FN(printBoolToFloat);
218  static ARC_PRINT_FN(printBoolToDouble);
219  static ARC_PRINT_FN(printBoolToString);
220  static ARC_PRINT_FN(printBoolToBitmask);
221 
222  static ARC_PRINT_FN(printUcharToBool);
223  static ARC_PRINT_FN(printUcharToUchar);
224  static ARC_PRINT_FN(printUcharToChar);
225  static ARC_PRINT_FN(printUcharToUshort);
226  static ARC_PRINT_FN(printUcharToShort);
227  static ARC_PRINT_FN(printUcharToUint);
228  static ARC_PRINT_FN(printUcharToInt);
229  static ARC_PRINT_FN(printUcharToUlong);
230  static ARC_PRINT_FN(printUcharToLong);
231  static ARC_PRINT_FN(printUcharToFloat);
232  static ARC_PRINT_FN(printUcharToDouble);
233  static ARC_PRINT_FN(printUcharToString);
234  static ARC_PRINT_FN(printUcharToBitmask);
235 
236  static ARC_PRINT_FN(printCharToBool);
237  static ARC_PRINT_FN(printCharToUchar);
238  static ARC_PRINT_FN(printCharToChar);
239  static ARC_PRINT_FN(printCharToUshort);
240  static ARC_PRINT_FN(printCharToShort);
241  static ARC_PRINT_FN(printCharToUint);
242  static ARC_PRINT_FN(printCharToInt);
243  static ARC_PRINT_FN(printCharToUlong);
244  static ARC_PRINT_FN(printCharToLong);
245  static ARC_PRINT_FN(printCharToFloat);
246  static ARC_PRINT_FN(printCharToDouble);
247  static ARC_PRINT_FN(printCharToString);
248  static ARC_PRINT_FN(printCharToBitmask);
249 
250  static ARC_PRINT_FN(printUshortToBool);
251  static ARC_PRINT_FN(printUshortToUchar);
252  static ARC_PRINT_FN(printUshortToChar);
253  static ARC_PRINT_FN(printUshortToUshort);
254  static ARC_PRINT_FN(printUshortToShort);
255  static ARC_PRINT_FN(printUshortToUint);
256  static ARC_PRINT_FN(printUshortToInt);
257  static ARC_PRINT_FN(printUshortToUlong);
258  static ARC_PRINT_FN(printUshortToLong);
259  static ARC_PRINT_FN(printUshortToFloat);
260  static ARC_PRINT_FN(printUshortToDouble);
261  static ARC_PRINT_FN(printUshortToBitmask);
262 
263  static ARC_PRINT_FN(printShortToBool);
264  static ARC_PRINT_FN(printShortToUchar);
265  static ARC_PRINT_FN(printShortToChar);
266  static ARC_PRINT_FN(printShortToUshort);
267  static ARC_PRINT_FN(printShortToShort);
268  static ARC_PRINT_FN(printShortToUint);
269  static ARC_PRINT_FN(printShortToInt);
270  static ARC_PRINT_FN(printShortToUlong);
271  static ARC_PRINT_FN(printShortToLong);
272  static ARC_PRINT_FN(printShortToFloat);
273  static ARC_PRINT_FN(printShortToDouble);
274  static ARC_PRINT_FN(printShortToBitmask);
275  static ARC_PRINT_FN(printShortToString);
276 
277  static ARC_PRINT_FN(printUintToBool);
278  static ARC_PRINT_FN(printUintToUchar);
279  static ARC_PRINT_FN(printUintToChar);
280  static ARC_PRINT_FN(printUintToUshort);
281  static ARC_PRINT_FN(printUintToShort);
282  static ARC_PRINT_FN(printUintToUint);
283  static ARC_PRINT_FN(printUintToInt);
284  static ARC_PRINT_FN(printUintToUlong);
285  static ARC_PRINT_FN(printUintToLong);
286  static ARC_PRINT_FN(printUintToFloat);
287  static ARC_PRINT_FN(printUintToDouble);
288  static ARC_PRINT_FN(printUintToBitmask);
289  static ARC_PRINT_FN(printUintToString);
290 
291  static ARC_PRINT_FN(printIntToBool);
292  static ARC_PRINT_FN(printIntToUchar);
293  static ARC_PRINT_FN(printIntToChar);
294  static ARC_PRINT_FN(printIntToUshort);
295  static ARC_PRINT_FN(printIntToShort);
296  static ARC_PRINT_FN(printIntToUint);
297  static ARC_PRINT_FN(printIntToInt);
298  static ARC_PRINT_FN(printIntToUlong);
299  static ARC_PRINT_FN(printIntToLong);
300  static ARC_PRINT_FN(printIntToFloat);
301  static ARC_PRINT_FN(printIntToDouble);
302  static ARC_PRINT_FN(printIntToBitmask);
303  static ARC_PRINT_FN(printIntToString);
304 
305  static ARC_PRINT_FN(printUlongToBool);
306  static ARC_PRINT_FN(printUlongToUchar);
307  static ARC_PRINT_FN(printUlongToChar);
308  static ARC_PRINT_FN(printUlongToUshort);
309  static ARC_PRINT_FN(printUlongToShort);
310  static ARC_PRINT_FN(printUlongToUint);
311  static ARC_PRINT_FN(printUlongToInt);
312  static ARC_PRINT_FN(printUlongToUlong);
313  static ARC_PRINT_FN(printUlongToLong);
314  static ARC_PRINT_FN(printUlongToFloat);
315  static ARC_PRINT_FN(printUlongToDouble);
316  static ARC_PRINT_FN(printUlongToBitmask);
317  static ARC_PRINT_FN(printUlongToString);
318 
319  static ARC_PRINT_FN(printLongToBool);
320  static ARC_PRINT_FN(printLongToUchar);
321  static ARC_PRINT_FN(printLongToChar);
322  static ARC_PRINT_FN(printLongToUshort);
323  static ARC_PRINT_FN(printLongToShort);
324  static ARC_PRINT_FN(printLongToUint);
325  static ARC_PRINT_FN(printLongToInt);
326  static ARC_PRINT_FN(printLongToUlong);
327  static ARC_PRINT_FN(printLongToLong);
328  static ARC_PRINT_FN(printLongToFloat);
329  static ARC_PRINT_FN(printLongToDouble);
330  static ARC_PRINT_FN(printLongToBitmask);
331  static ARC_PRINT_FN(printLongToString);
332 
333  static ARC_PRINT_FN(printFloatToBool);
334  static ARC_PRINT_FN(printFloatToUchar);
335  static ARC_PRINT_FN(printFloatToChar);
336  static ARC_PRINT_FN(printFloatToUshort);
337  static ARC_PRINT_FN(printFloatToShort);
338  static ARC_PRINT_FN(printFloatToUint);
339  static ARC_PRINT_FN(printFloatToInt);
340  static ARC_PRINT_FN(printFloatToUlong);
341  static ARC_PRINT_FN(printFloatToLong);
342  static ARC_PRINT_FN(printFloatToFloat);
343  static ARC_PRINT_FN(printFloatToDouble);
344  static ARC_PRINT_FN(printFloatToBitmask);
345  static ARC_PRINT_FN(printFloatToString);
346 
347  static ARC_PRINT_FN(printDoubleToBool);
348  static ARC_PRINT_FN(printDoubleToUchar);
349  static ARC_PRINT_FN(printDoubleToChar);
350  static ARC_PRINT_FN(printDoubleToUshort);
351  static ARC_PRINT_FN(printDoubleToShort);
352  static ARC_PRINT_FN(printDoubleToUint);
353  static ARC_PRINT_FN(printDoubleToInt);
354  static ARC_PRINT_FN(printDoubleToUlong);
355  static ARC_PRINT_FN(printDoubleToLong);
356  static ARC_PRINT_FN(printDoubleToFloat);
357  static ARC_PRINT_FN(printDoubleToDouble);
358  static ARC_PRINT_FN(printDoubleToBitmask);
359  static ARC_PRINT_FN(printDoubleToString);
360 
361  static ARC_PRINT_FN(printComplexFloatToComplexFloat);
362 
363  static ARC_PRINT_FN(printDateToBool);
364  static ARC_PRINT_FN(printDateToUchar);
365  static ARC_PRINT_FN(printDateToChar);
366  static ARC_PRINT_FN(printDateToUshort);
367  static ARC_PRINT_FN(printDateToShort);
368  static ARC_PRINT_FN(printDateToUint);
369  static ARC_PRINT_FN(printDateToInt);
370  static ARC_PRINT_FN(printDateToUlong);
371  static ARC_PRINT_FN(printDateToLong);
372  static ARC_PRINT_FN(printDateToFloat);
373  static ARC_PRINT_FN(printDateToDouble);
374  static ARC_PRINT_FN(printDateToString);
375  static ARC_PRINT_FN(printDateToCarmaString);
376 
377  static void setPrintFn(DataType::Type inType, DataType::Type outType,
378  ARC_PRINT_FN(**fptr));
379 
380  static void setBoolPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
381  static void setUcharPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
382  static void setStringPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
383  static void setCharPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
384  static void setUshortPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
385  static void setShortPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
386  static void setUintPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
387  static void setIntPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
388  static void setUlongPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
389  static void setLongPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
390  static void setFloatPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
391  static void setDoublePrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
392  static void setComplexFloatPrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
393  static void setDatePrintFn(DataType::Type outType, ARC_PRINT_FN(**fptr));
394 
395  virtual ~ArchiveConvFn();
396 
397  private:
398 
399  ArchiveConvFn();
400 
401  }; // End class ArchiveConvFn
402 
403  } // End namespace util
404 } // End namespace sza
405 
406 
407 #endif // End #ifndef SZA_UTIL_ARCHIVECONVFN_H
Tagged: Tue Jun 22 22:32:16 UTC 2004.
Tagged: Fri Oct 1 22:25:34 UTC 2004.