typePromoter.h

Go to the documentation of this file.
00001 
00015 #ifndef DLR_COMMON_TYPEPROMOTER_H
00016 #define DLR_COMMON_TYPEPROMOTER_H
00017 
00018 #include <dlrCommon/types.h>
00019 
00020 namespace dlr {
00021 
00022   namespace common {
00023     
00030     template <class Type0, class Type1>
00031     struct TypePromoter {
00032       /* ==================== Public typedefs to be ==================== */
00033       /* ==================== provided by specializations ============== */
00034       /* ==================== of this template ========================= */
00035 
00036       // /**
00037       //  * This typedef reflects the type resulting from arithmetic
00038       //  * operations on combinations of Type0 and Type1.b
00039       //  */
00040       // typedef Type0 ResultType;
00041     };
00042 
00043         
00044     // Specializations for <Int8, Type>
00045 
00046     template <>
00047     struct TypePromoter<Int8, Int8> {
00048       typedef Int8 ResultType;
00049     };
00050 
00051     template <>
00052     struct TypePromoter<Int8, Int16> {
00053       typedef Int16 ResultType;
00054     };
00055 
00056     template <>
00057     struct TypePromoter<Int8, Int32> {
00058       typedef Int32 ResultType;
00059     };
00060 
00061     template <>
00062     struct TypePromoter<Int8, Int64> {
00063       typedef Int64 ResultType;
00064     };
00065 
00066     template <>
00067     struct TypePromoter<Int8, Float32> {
00068       typedef Float32 ResultType;
00069     };
00070 
00071     template <>
00072     struct TypePromoter<Int8, Float64> {
00073       typedef Float64 ResultType;
00074     };
00075 
00076     template <>
00077     struct TypePromoter<Int8, UnsignedInt8> {
00078       typedef Int8 ResultType;
00079     };
00080 
00081     template <>
00082     struct TypePromoter<Int8, UnsignedInt16> {
00083       typedef UnsignedInt16 ResultType;
00084     };
00085 
00086     template <>
00087     struct TypePromoter<Int8, UnsignedInt32> {
00088       typedef UnsignedInt32 ResultType;
00089     };
00090 
00091     template <>
00092     struct TypePromoter<Int8, UnsignedInt64> {
00093       typedef UnsignedInt64 ResultType;
00094     };
00095 
00096 
00097     // Specializations for <Int16, Type>
00098     
00099     template <>
00100     struct TypePromoter<Int16, Int8> {
00101       typedef Int16 ResultType;
00102     };
00103 
00104     template <>
00105     struct TypePromoter<Int16, Int16> {
00106       typedef Int16 ResultType;
00107     };
00108 
00109     template <>
00110     struct TypePromoter<Int16, Int32> {
00111       typedef Int32 ResultType;
00112     };
00113 
00114     template <>
00115     struct TypePromoter<Int16, Int64> {
00116       typedef Int64 ResultType;
00117     };
00118 
00119     template <>
00120     struct TypePromoter<Int16, Float32> {
00121       typedef Float32 ResultType;
00122     };
00123 
00124     template <>
00125     struct TypePromoter<Int16, Float64> {
00126       typedef Float64 ResultType;
00127     };
00128 
00129     template <>
00130     struct TypePromoter<Int16, UnsignedInt8> {
00131       typedef Int16 ResultType;
00132     };
00133 
00134     template <>
00135     struct TypePromoter<Int16, UnsignedInt16> {
00136       typedef Int16 ResultType;
00137     };
00138 
00139     template <>
00140     struct TypePromoter<Int16, UnsignedInt32> {
00141       typedef Int32 ResultType;
00142     };
00143 
00144     template <>
00145     struct TypePromoter<Int16, UnsignedInt64> {
00146       typedef UnsignedInt64 ResultType;
00147     };
00148 
00149     // Specializations for <Int32, Type>
00150     
00151     template <>
00152     struct TypePromoter<Int32, Int8> {
00153       typedef Int32 ResultType;
00154     };
00155 
00156     template <>
00157     struct TypePromoter<Int32, Int16> {
00158       typedef Int32 ResultType;
00159     };
00160 
00161     template <>
00162     struct TypePromoter<Int32, Int32> {
00163       typedef Int32 ResultType;
00164     };
00165 
00166     template <>
00167     struct TypePromoter<Int32, Int64> {
00168       typedef Int64 ResultType;
00169     };
00170 
00171     template <>
00172     struct TypePromoter<Int32, Float32> {
00173       typedef Float32 ResultType;
00174     };
00175 
00176     template <>
00177     struct TypePromoter<Int32, Float64> {
00178       typedef Float64 ResultType;
00179     };
00180 
00181     template <>
00182     struct TypePromoter<Int32, UnsignedInt8> {
00183       typedef Int32 ResultType;
00184     };
00185 
00186     template <>
00187     struct TypePromoter<Int32, UnsignedInt16> {
00188       typedef Int32 ResultType;
00189     };
00190 
00191     template <>
00192     struct TypePromoter<Int32, UnsignedInt32> {
00193       typedef Int32 ResultType;
00194     };
00195 
00196     template <>
00197     struct TypePromoter<Int32, UnsignedInt64> {
00198       typedef UnsignedInt64 ResultType;
00199     };
00200 
00201     // Specializations for <Int64, Type>
00202     
00203     template <>
00204     struct TypePromoter<Int64, Int8> {
00205       typedef Int64 ResultType;
00206     };
00207 
00208     template <>
00209     struct TypePromoter<Int64, Int16> {
00210       typedef Int64 ResultType;
00211     };
00212 
00213     template <>
00214     struct TypePromoter<Int64, Int32> {
00215       typedef Int64 ResultType;
00216     };
00217 
00218     template <>
00219     struct TypePromoter<Int64, Int64> {
00220       typedef Int64 ResultType;
00221     };
00222 
00223     template <>
00224     struct TypePromoter<Int64, Float32> {
00225       typedef Float32 ResultType;
00226     };
00227 
00228     template <>
00229     struct TypePromoter<Int64, Float64> {
00230       typedef Float64 ResultType;
00231     };
00232 
00233     template <>
00234     struct TypePromoter<Int64, UnsignedInt8> {
00235       typedef Int64 ResultType;
00236     };
00237 
00238     template <>
00239     struct TypePromoter<Int64, UnsignedInt16> {
00240       typedef Int64 ResultType;
00241     };
00242 
00243     template <>
00244     struct TypePromoter<Int64, UnsignedInt32> {
00245       typedef Int64 ResultType;
00246     };
00247 
00248     template <>
00249     struct TypePromoter<Int64, UnsignedInt64> {
00250       typedef Int64 ResultType;
00251     };
00252 
00253     // Specializations for <Float32, Type>
00254     
00255     template <>
00256     struct TypePromoter<Float32, Int8> {
00257       typedef Float32 ResultType;
00258     };
00259 
00260     template <>
00261     struct TypePromoter<Float32, Int16> {
00262       typedef Float32 ResultType;
00263     };
00264 
00265     template <>
00266     struct TypePromoter<Float32, Int32> {
00267       typedef Float32 ResultType;
00268     };
00269 
00270     template <>
00271     struct TypePromoter<Float32, Int64> {
00272       typedef Float32 ResultType;
00273     };
00274 
00275     template <>
00276     struct TypePromoter<Float32, Float32> {
00277       typedef Float32 ResultType;
00278     };
00279 
00280     template <>
00281     struct TypePromoter<Float32, Float64> {
00282       typedef Float64 ResultType;
00283     };
00284 
00285     template <>
00286     struct TypePromoter<Float32, UnsignedInt8> {
00287       typedef Float32 ResultType;
00288     };
00289 
00290     template <>
00291     struct TypePromoter<Float32, UnsignedInt16> {
00292       typedef Float32 ResultType;
00293     };
00294 
00295     template <>
00296     struct TypePromoter<Float32, UnsignedInt32> {
00297       typedef Float32 ResultType;
00298     };
00299 
00300     template <>
00301     struct TypePromoter<Float32, UnsignedInt64> {
00302       typedef Float32 ResultType;
00303     };
00304 
00305     // Specializations for <Float64, Type>
00306     
00307     template <>
00308     struct TypePromoter<Float64, Int8> {
00309       typedef Float64 ResultType;
00310     };
00311 
00312     template <>
00313     struct TypePromoter<Float64, Int16> {
00314       typedef Float64 ResultType;
00315     };
00316 
00317     template <>
00318     struct TypePromoter<Float64, Int32> {
00319       typedef Float64 ResultType;
00320     };
00321 
00322     template <>
00323     struct TypePromoter<Float64, Int64> {
00324       typedef Float64 ResultType;
00325     };
00326 
00327     template <>
00328     struct TypePromoter<Float64, Float32> {
00329       typedef Float64 ResultType;
00330     };
00331 
00332     template <>
00333     struct TypePromoter<Float64, Float64> {
00334       typedef Float64 ResultType;
00335     };
00336 
00337     template <>
00338     struct TypePromoter<Float64, UnsignedInt8> {
00339       typedef Float64 ResultType;
00340     };
00341 
00342     template <>
00343     struct TypePromoter<Float64, UnsignedInt16> {
00344       typedef Float64 ResultType;
00345     };
00346 
00347     template <>
00348     struct TypePromoter<Float64, UnsignedInt32> {
00349       typedef Float64 ResultType;
00350     };
00351 
00352     template <>
00353     struct TypePromoter<Float64, UnsignedInt64> {
00354       typedef Float64 ResultType;
00355     };
00356 
00357     // Specializations for <UnsignedInt8, Type>
00358 
00359     template <>
00360     struct TypePromoter<UnsignedInt8, Int8> {
00361       typedef Int8 ResultType;
00362     };
00363 
00364     template <>
00365     struct TypePromoter<UnsignedInt8, Int16> {
00366       typedef Int16 ResultType;
00367     };
00368 
00369     template <>
00370     struct TypePromoter<UnsignedInt8, Int32> {
00371       typedef Int32 ResultType;
00372     };
00373 
00374     template <>
00375     struct TypePromoter<UnsignedInt8, Int64> {
00376       typedef Int64 ResultType;
00377     };
00378 
00379     template <>
00380     struct TypePromoter<UnsignedInt8, Float32> {
00381       typedef Float32 ResultType;
00382     };
00383 
00384     template <>
00385     struct TypePromoter<UnsignedInt8, Float64> {
00386       typedef Float64 ResultType;
00387     };
00388 
00389     template <>
00390     struct TypePromoter<UnsignedInt8, UnsignedInt8> {
00391       typedef UnsignedInt8 ResultType;
00392     };
00393 
00394     template <>
00395     struct TypePromoter<UnsignedInt8, UnsignedInt16> {
00396       typedef UnsignedInt16 ResultType;
00397     };
00398 
00399     template <>
00400     struct TypePromoter<UnsignedInt8, UnsignedInt32> {
00401       typedef UnsignedInt32 ResultType;
00402     };
00403 
00404     template <>
00405     struct TypePromoter<UnsignedInt8, UnsignedInt64> {
00406       typedef UnsignedInt64 ResultType;
00407     };
00408 
00409 
00410     // Specializations for <UnsignedInt16, Type>
00411 
00412     template <>
00413     struct TypePromoter<UnsignedInt16, Int8> {
00414       typedef UnsignedInt16 ResultType;
00415     };
00416 
00417     template <>
00418     struct TypePromoter<UnsignedInt16, Int16> {
00419       typedef Int16 ResultType;
00420     };
00421 
00422     template <>
00423     struct TypePromoter<UnsignedInt16, Int32> {
00424       typedef Int32 ResultType;
00425     };
00426 
00427     template <>
00428     struct TypePromoter<UnsignedInt16, Int64> {
00429       typedef Int64 ResultType;
00430     };
00431 
00432     template <>
00433     struct TypePromoter<UnsignedInt16, Float32> {
00434       typedef Float32 ResultType;
00435     };
00436 
00437     template <>
00438     struct TypePromoter<UnsignedInt16, Float64> {
00439       typedef Float64 ResultType;
00440     };
00441 
00442     template <>
00443     struct TypePromoter<UnsignedInt16, UnsignedInt8> {
00444       typedef UnsignedInt16 ResultType;
00445     };
00446 
00447     template <>
00448     struct TypePromoter<UnsignedInt16, UnsignedInt16> {
00449       typedef UnsignedInt16 ResultType;
00450     };
00451 
00452     template <>
00453     struct TypePromoter<UnsignedInt16, UnsignedInt32> {
00454       typedef UnsignedInt32 ResultType;
00455     };
00456 
00457     template <>
00458     struct TypePromoter<UnsignedInt16, UnsignedInt64> {
00459       typedef UnsignedInt64 ResultType;
00460     };
00461 
00462 
00463     // Specializations for <UnsignedInt32, Type>
00464 
00465     template <>
00466     struct TypePromoter<UnsignedInt32, Int8> {
00467       typedef UnsignedInt32 ResultType;
00468     };
00469 
00470     template <>
00471     struct TypePromoter<UnsignedInt32, Int16> {
00472       typedef UnsignedInt32 ResultType;
00473     };
00474 
00475     template <>
00476     struct TypePromoter<UnsignedInt32, Int32> {
00477       typedef Int32 ResultType;
00478     };
00479 
00480     template <>
00481     struct TypePromoter<UnsignedInt32, Int64> {
00482       typedef Int64 ResultType;
00483     };
00484 
00485     template <>
00486     struct TypePromoter<UnsignedInt32, Float32> {
00487       typedef Float32 ResultType;
00488     };
00489 
00490     template <>
00491     struct TypePromoter<UnsignedInt32, Float64> {
00492       typedef Float64 ResultType;
00493     };
00494 
00495     template <>
00496     struct TypePromoter<UnsignedInt32, UnsignedInt8> {
00497       typedef UnsignedInt32 ResultType;
00498     };
00499 
00500     template <>
00501     struct TypePromoter<UnsignedInt32, UnsignedInt16> {
00502       typedef UnsignedInt32 ResultType;
00503     };
00504 
00505     template <>
00506     struct TypePromoter<UnsignedInt32, UnsignedInt32> {
00507       typedef UnsignedInt32 ResultType;
00508     };
00509 
00510     template <>
00511     struct TypePromoter<UnsignedInt32, UnsignedInt64> {
00512       typedef UnsignedInt64 ResultType;
00513     };
00514 
00515 
00516     // Specializations for <UnsignedInt64, Type>
00517 
00518     template <>
00519     struct TypePromoter<UnsignedInt64, Int8> {
00520       typedef UnsignedInt64 ResultType;
00521     };
00522 
00523     template <>
00524     struct TypePromoter<UnsignedInt64, Int16> {
00525       typedef UnsignedInt64 ResultType;
00526     };
00527 
00528     template <>
00529     struct TypePromoter<UnsignedInt64, Int32> {
00530       typedef UnsignedInt64 ResultType;
00531     };
00532 
00533     template <>
00534     struct TypePromoter<UnsignedInt64, Int64> {
00535       typedef Int64 ResultType;
00536     };
00537 
00538     template <>
00539     struct TypePromoter<UnsignedInt64, Float32> {
00540       typedef Float32 ResultType;
00541     };
00542 
00543     template <>
00544     struct TypePromoter<UnsignedInt64, Float64> {
00545       typedef Float64 ResultType;
00546     };
00547 
00548     template <>
00549     struct TypePromoter<UnsignedInt64, UnsignedInt8> {
00550       typedef UnsignedInt64 ResultType;
00551     };
00552 
00553     template <>
00554     struct TypePromoter<UnsignedInt64, UnsignedInt16> {
00555       typedef UnsignedInt64 ResultType;
00556     };
00557 
00558     template <>
00559     struct TypePromoter<UnsignedInt64, UnsignedInt32> {
00560       typedef UnsignedInt64 ResultType;
00561     };
00562 
00563     template <>
00564     struct TypePromoter<UnsignedInt64, UnsignedInt64> {
00565       typedef UnsignedInt64 ResultType;
00566     };
00567 
00568 
00569   } // namespace 
00570 
00571 } // namespace dlr
00572 
00573 #endif /* #ifndef DLR_COMMON_TYPEPROMOTER_H */

Generated on Tue Nov 24 23:57:55 2009 for dlrCommon Utility Library by  doxygen 1.5.8