00001 #ifndef _WINC_CONVERT 00002 #define _WINC_CONVERT 00003 00004 #include <WXP/Const.h> 00005 00006 namespace WXP { 00012 struct Convert { 00013 /* 00014 Define some simple unit conversion macros 00015 */ 00017 static inline float CtoF( float t ){ 00018 return t != Const::MISS ? t*9/5+32 : Const::MISS;} 00020 static inline float KtoF( float t ){ 00021 return t != Const::MISS ? (t-273.15)*9/5+32 : Const::MISS;} 00023 static inline float CtoK( float t ){ 00024 return t != Const::MISS ? t+273.15 : Const::MISS;} 00026 static inline float FtoK( float t ){ 00027 return t != Const::MISS ? (t-32.)*5/9+273.15 : Const::MISS;} 00029 static inline float FtoC( float t ){ 00030 return t != Const::MISS ? (t-32.)*5/9 : Const::MISS;} 00032 static inline float KtoC( float t ){ 00033 return t != Const::MISS ? t-273.15 : Const::MISS;} 00035 static inline float INtoMB( float p ){ 00036 return p != Const::MISS ? p*33.85399 : Const::MISS;} 00038 static inline float MBtoIN( float p ){ 00039 return p != Const::MISS ? p*.0295386 : Const::MISS;} 00041 static inline float KTtoMPS( float w ){ 00042 return w != Const::MISS ? w*.5144 : Const::MISS;} 00044 static inline float MPStoKT( float w ){ 00045 return w != Const::MISS ? w*1.944 : Const::MISS;} 00047 static inline float KTtoKMH( float l ){ 00048 return l != Const::MISS ? l*1.852 : Const::MISS;} 00050 static inline float KMHtoKT( float l ){ 00051 return l != Const::MISS ? l*0.53996 : Const::MISS;} 00053 static inline float KTtoMPH( float l ){ 00054 return l != Const::MISS ? l*1.1508 : Const::MISS;} 00056 static inline float MPHtoKT( float l ){ 00057 return l != Const::MISS ? l*0.86897 : Const::MISS;} 00059 static inline float MPHtoMPS( float l ){ 00060 return l != Const::MISS ? l*0.4470 : Const::MISS;} 00062 static inline float MPStoMPH( float l ){ 00063 return l != Const::MISS ? l*2.23694 : Const::MISS;} 00065 static inline float FTtoM( float l ){ 00066 return l != Const::MISS ? l*.3048 : Const::MISS;} 00068 static inline float MtoFT( float l ){ 00069 return l != Const::MISS ? l*3.2808 : Const::MISS;} 00071 static inline float MtoMI( float l ){ 00072 return l != Const::MISS ? l*6.2136E-4 : Const::MISS;} 00074 static inline float INtoMM( float l ){ 00075 return l != Const::MISS ? l*25.4 : Const::MISS;} 00077 static inline float MMtoIN( float l ){ 00078 return l != Const::MISS ? l*.03937 : Const::MISS;} 00080 static inline float INtoCM( float l ){ 00081 return l != Const::MISS ? l*2.54 : Const::MISS;} 00083 static inline float CMtoIN( float l ){ 00084 return l != Const::MISS ? l*.3937 : Const::MISS;} 00086 static inline float SMtoKM( float l ){ 00087 return l != Const::MISS ? l*1.60934 : Const::MISS;} 00089 static inline float KMtoSM( float l ){ 00090 return l != Const::MISS ? l*.62137 : Const::MISS;} 00092 static inline float SMtoNM( float l ){ 00093 return l != Const::MISS ? l*.86897 : Const::MISS;} 00095 static inline float NMtoSM( float l ){ 00096 return l != Const::MISS ? l*1.1508 : Const::MISS;} 00098 static inline float NMtoKM( float l ){ 00099 return l != Const::MISS ? l*1.852 : Const::MISS;} 00101 static inline float KMtoNM( float l ){ 00102 return l != Const::MISS ? l*.53996 : Const::MISS;} 00104 static inline float NMtoFT( float l ){ 00105 return l != Const::MISS ? l*6076.22 : Const::MISS;} 00106 00107 }; 00108 } 00109 #endif
1.6.1