it_bus_pdk/simple_type_cast.h

00001 #ifndef _SIMPLE_TYPE_CAST_H_
00002 #define _SIMPLE_TYPE_CAST_H_
00003 
00004 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 
00007 #include <it_bus/types.h>
00008 #include <it_bus_pdk/type_cast_exception.h>
00009 
00010 namespace IT_Bus
00011 {
00012     Int
00013     afc_abs(
00014       Int value
00015     );
00016 
00017     Long
00018     afc_abs(
00019       Long value
00020     );
00021 
00022     class IT_AFC_API SimpleTypeConverter
00023     {
00024       public:
00025         /* Boolean to all simple types convsions */
00026         static void smf_convert(const Boolean, Boolean &) throw((TypeCastException));
00027         static void smf_convert(const Boolean, String &) throw((TypeCastException));
00028         static void smf_convert(const Boolean, Byte &) throw((TypeCastException));
00029         static void smf_convert(const Boolean, UByte &) throw((TypeCastException));
00030         static void smf_convert(const Boolean, Short &) throw((TypeCastException));
00031         static void smf_convert(const Boolean, UShort &) throw((TypeCastException));
00032         static void smf_convert(const Boolean, Int &) throw((TypeCastException));
00033         static void smf_convert(const Boolean, UInt &) throw((TypeCastException));
00034         static void smf_convert(const Boolean, Long &) throw((TypeCastException));
00035         static void smf_convert(const Boolean, ULong &) throw((TypeCastException));
00036         static void smf_convert(const Boolean, Float &) throw((TypeCastException));
00037         static void smf_convert(const Boolean, Double &) throw((TypeCastException));
00038         static void smf_convert(const Boolean, Decimal &) throw((TypeCastException));
00039         static void smf_convert(const Boolean, DateTime &) throw((TypeCastException));
00040 
00041         /* String to all simple types convsions */
00042         static void smf_convert(const String&, Boolean &) throw((TypeCastException));
00043         static void smf_convert(const String&, String &) throw((TypeCastException));
00044         static void smf_convert(const String&, Byte &) throw((TypeCastException));
00045         static void smf_convert(const String&, UByte &) throw((TypeCastException));
00046         static void smf_convert(const String&, Short &) throw((TypeCastException));
00047         static void smf_convert(const String&, UShort &) throw((TypeCastException));
00048         static void smf_convert(const String&, Int &) throw((TypeCastException));
00049         static void smf_convert(const String&, UInt &) throw((TypeCastException));
00050         static void smf_convert(const String&, Long &) throw((TypeCastException));
00051         static void smf_convert(const String&, ULong &) throw((TypeCastException));
00052         static void smf_convert(const String&, Float &) throw((TypeCastException));
00053         static void smf_convert(const String&, Double &) throw((TypeCastException));
00054         static void smf_convert(const String&, Decimal &) throw((TypeCastException));
00055         static void smf_convert(const String&, DateTime &) throw((TypeCastException));
00056 
00057         /* Signed Byte to all simple types casting */
00058         static void smf_convert(const Byte, Boolean &) throw((TypeCastException));
00059         static void smf_convert(const Byte, String &) throw((TypeCastException));
00060         static void smf_convert(const Byte, Byte &) throw((TypeCastException));
00061         static void smf_convert(const Byte, UByte &) throw((TypeCastException));
00062         static void smf_convert(const Byte, Short &) throw((TypeCastException));
00063         static void smf_convert(const Byte, UShort &) throw((TypeCastException));
00064         static void smf_convert(const Byte, Int &) throw((TypeCastException));
00065         static void smf_convert(const Byte, UInt &) throw((TypeCastException));
00066         static void smf_convert(const Byte, Long &) throw((TypeCastException));
00067         static void smf_convert(const Byte, ULong &) throw((TypeCastException));
00068         static void smf_convert(const Byte, Float &) throw((TypeCastException));
00069         static void smf_convert(const Byte, Double &) throw((TypeCastException));
00070         static void smf_convert(const Byte, Decimal &) throw((TypeCastException));
00071         static void smf_convert(const Byte, DateTime &) throw((TypeCastException));
00072 
00073         /* Unsigned Byte to all simple types casting */
00074         static void smf_convert(const UByte, Boolean &) throw((TypeCastException));
00075         static void smf_convert(const UByte, String &) throw((TypeCastException));
00076         static void smf_convert(const UByte, Byte &) throw((TypeCastException));
00077         static void smf_convert(const UByte, UByte &) throw((TypeCastException));
00078         static void smf_convert(const UByte, Short &) throw((TypeCastException));
00079         static void smf_convert(const UByte, UShort &) throw((TypeCastException));
00080         static void smf_convert(const UByte, Int &) throw((TypeCastException));
00081         static void smf_convert(const UByte, UInt &) throw((TypeCastException));
00082         static void smf_convert(const UByte, Long &) throw((TypeCastException));
00083         static void smf_convert(const UByte, ULong &) throw((TypeCastException));
00084         static void smf_convert(const UByte, Float &) throw((TypeCastException));
00085         static void smf_convert(const UByte, Double &) throw((TypeCastException));
00086         static void smf_convert(const UByte, Decimal &) throw((TypeCastException));
00087         static void smf_convert(const UByte, DateTime &) throw((TypeCastException));
00088 
00089         /* Signed Short to all simple types casting */
00090         static void smf_convert(const Short, Boolean &) throw((TypeCastException));
00091         static void smf_convert(const Short, String &) throw((TypeCastException));
00092         static void smf_convert(const Short, Byte &) throw((TypeCastException));
00093         static void smf_convert(const Short, UByte &) throw((TypeCastException));
00094         static void smf_convert(const Short, Short &) throw((TypeCastException));
00095         static void smf_convert(const Short, UShort &) throw((TypeCastException));
00096         static void smf_convert(const Short, Int &) throw((TypeCastException));
00097         static void smf_convert(const Short, UInt &) throw((TypeCastException));
00098         static void smf_convert(const Short, Long &) throw((TypeCastException));
00099         static void smf_convert(const Short, ULong &) throw((TypeCastException));
00100         static void smf_convert(const Short, Float &) throw((TypeCastException));
00101         static void smf_convert(const Short, Double &) throw((TypeCastException));
00102         static void smf_convert(const Short, Decimal &) throw((TypeCastException));
00103         static void smf_convert(const Short, DateTime &) throw((TypeCastException));
00104 
00105         /* Unsigned Short to all simple types casting */
00106         static void smf_convert(const UShort, Boolean &) throw((TypeCastException));
00107         static void smf_convert(const UShort, String &) throw((TypeCastException));
00108         static void smf_convert(const UShort, Byte &) throw((TypeCastException));
00109         static void smf_convert(const UShort, UByte &) throw((TypeCastException));
00110         static void smf_convert(const UShort, Short &) throw((TypeCastException));
00111         static void smf_convert(const UShort, UShort &) throw((TypeCastException));
00112         static void smf_convert(const UShort, Int &) throw((TypeCastException));
00113         static void smf_convert(const UShort, UInt &) throw((TypeCastException));
00114         static void smf_convert(const UShort, Long &) throw((TypeCastException));
00115         static void smf_convert(const UShort, ULong &) throw((TypeCastException));
00116         static void smf_convert(const UShort, Float &) throw((TypeCastException));
00117         static void smf_convert(const UShort, Double &) throw((TypeCastException));
00118         static void smf_convert(const UShort, Decimal &) throw((TypeCastException));
00119         static void smf_convert(const UShort, DateTime &) throw((TypeCastException));
00120 
00121         /* Signed Int to all simple types casting */
00122         static void smf_convert(const Int, Boolean &) throw((TypeCastException));
00123         static void smf_convert(const Int, String &) throw((TypeCastException));
00124         static void smf_convert(const Int, Byte &) throw((TypeCastException));
00125         static void smf_convert(const Int, UByte &) throw((TypeCastException));
00126         static void smf_convert(const Int, Short &) throw((TypeCastException));
00127         static void smf_convert(const Int, UShort &) throw((TypeCastException));
00128         static void smf_convert(const Int, Int &) throw((TypeCastException));
00129         static void smf_convert(const Int, UInt &) throw((TypeCastException));
00130         static void smf_convert(const Int, Long &) throw((TypeCastException));
00131         static void smf_convert(const Int, ULong &) throw((TypeCastException));
00132         static void smf_convert(const Int, Float &) throw((TypeCastException));
00133         static void smf_convert(const Int, Double &) throw((TypeCastException));
00134         static void smf_convert(const Int, Decimal &) throw((TypeCastException));
00135         static void smf_convert(const Int, DateTime &) throw((TypeCastException));
00136 
00137         /* Unsigned Int to all simple types casting */
00138         static void smf_convert(const UInt, Boolean &) throw((TypeCastException));
00139         static void smf_convert(const UInt, String &) throw((TypeCastException));
00140         static void smf_convert(const UInt, Byte &) throw((TypeCastException));
00141         static void smf_convert(const UInt, UByte &) throw((TypeCastException));
00142         static void smf_convert(const UInt, Short &) throw((TypeCastException));
00143         static void smf_convert(const UInt, UShort &) throw((TypeCastException));
00144         static void smf_convert(const UInt, Int &) throw((TypeCastException));
00145         static void smf_convert(const UInt, UInt &) throw((TypeCastException));
00146         static void smf_convert(const UInt, Long &) throw((TypeCastException));
00147         static void smf_convert(const UInt, ULong &) throw((TypeCastException));
00148         static void smf_convert(const UInt, Float &) throw((TypeCastException));
00149         static void smf_convert(const UInt, Double &) throw((TypeCastException));
00150         static void smf_convert(const UInt, Decimal &) throw((TypeCastException));
00151         static void smf_convert(const UInt, DateTime &) throw((TypeCastException));
00152 
00153         /* Signed Long to all simple types casting */
00154         static void smf_convert(const Long&, Boolean &) throw((TypeCastException));
00155         static void smf_convert(const Long&, String &) throw((TypeCastException));
00156         static void smf_convert(const Long&, Byte &) throw((TypeCastException));
00157         static void smf_convert(const Long&, UByte &) throw((TypeCastException));
00158         static void smf_convert(const Long&, Short &) throw((TypeCastException));
00159         static void smf_convert(const Long&, UShort &) throw((TypeCastException));
00160         static void smf_convert(const Long&, Int &) throw((TypeCastException));
00161         static void smf_convert(const Long&, UInt &) throw((TypeCastException));
00162         static void smf_convert(const Long&, Long &) throw((TypeCastException));
00163         static void smf_convert(const Long&, ULong &) throw((TypeCastException));
00164         static void smf_convert(const Long&, Float &) throw((TypeCastException));
00165         static void smf_convert(const Long&, Double &) throw((TypeCastException));
00166         static void smf_convert(const Long&, Decimal &) throw((TypeCastException));
00167         static void smf_convert(const Long&, DateTime &) throw((TypeCastException));
00168 
00169         /* Unsigned Long to all simple types casting */
00170         static void smf_convert(const ULong&, Boolean &) throw((TypeCastException));
00171         static void smf_convert(const ULong&, String &) throw((TypeCastException));
00172         static void smf_convert(const ULong&, Byte &) throw((TypeCastException));
00173         static void smf_convert(const ULong&, UByte &) throw((TypeCastException));
00174         static void smf_convert(const ULong&, Short &) throw((TypeCastException));
00175         static void smf_convert(const ULong&, UShort &) throw((TypeCastException));
00176         static void smf_convert(const ULong&, Int &) throw((TypeCastException));
00177         static void smf_convert(const ULong&, UInt &) throw((TypeCastException));
00178         static void smf_convert(const ULong&, Long &) throw((TypeCastException));
00179         static void smf_convert(const ULong&, ULong &) throw((TypeCastException));
00180         static void smf_convert(const ULong&, Float &) throw((TypeCastException));
00181         static void smf_convert(const ULong&, Double &) throw((TypeCastException));
00182         static void smf_convert(const ULong&, Decimal &) throw((TypeCastException));
00183         static void smf_convert(const ULong&, DateTime &) throw((TypeCastException));
00184 
00185         /* Float to all simple types casting */
00186         static void smf_convert(const Float, Boolean &) throw((TypeCastException));
00187         static void smf_convert(const Float, String &) throw((TypeCastException));
00188         static void smf_convert(const Float, Byte &) throw((TypeCastException));
00189         static void smf_convert(const Float, UByte &) throw((TypeCastException));
00190         static void smf_convert(const Float, Short &) throw((TypeCastException));
00191         static void smf_convert(const Float, UShort &) throw((TypeCastException));
00192         static void smf_convert(const Float, Int &) throw((TypeCastException));
00193         static void smf_convert(const Float, UInt &) throw((TypeCastException));
00194         static void smf_convert(const Float, Long &) throw((TypeCastException));
00195         static void smf_convert(const Float, ULong &) throw((TypeCastException));
00196         static void smf_convert(const Float, Float &) throw((TypeCastException));
00197         static void smf_convert(const Float, Double &) throw((TypeCastException));
00198         static void smf_convert(const Float, Decimal &) throw((TypeCastException));
00199         static void smf_convert(const Float, DateTime &) throw((TypeCastException));
00200 
00201         /* Double to all simple types casting */
00202         static void smf_convert(const Double&, Boolean &) throw((TypeCastException));
00203         static void smf_convert(const Double&, String &) throw((TypeCastException));
00204         static void smf_convert(const Double&, Byte &) throw((TypeCastException));
00205         static void smf_convert(const Double&, UByte &) throw((TypeCastException));
00206         static void smf_convert(const Double&, Short &) throw((TypeCastException));
00207         static void smf_convert(const Double&, UShort &) throw((TypeCastException));
00208         static void smf_convert(const Double&, Int &) throw((TypeCastException));
00209         static void smf_convert(const Double&, UInt &) throw((TypeCastException));
00210         static void smf_convert(const Double&, Long &) throw((TypeCastException));
00211         static void smf_convert(const Double&, ULong &) throw((TypeCastException));
00212         static void smf_convert(const Double&, Float &) throw((TypeCastException));
00213         static void smf_convert(const Double&, Double &) throw((TypeCastException));
00214         static void smf_convert(const Double&, Decimal &) throw((TypeCastException));
00215         static void smf_convert(const Double&, DateTime &) throw((TypeCastException));
00216 
00217         /* Decimal to all simple types casting */
00218         static void smf_convert(const Decimal&, Boolean &) throw((TypeCastException));
00219         static void smf_convert(const Decimal&, String &) throw((TypeCastException));
00220         static void smf_convert(const Decimal&, Byte &) throw((TypeCastException));
00221         static void smf_convert(const Decimal&, UByte &) throw((TypeCastException));
00222         static void smf_convert(const Decimal&, Short &) throw((TypeCastException));
00223         static void smf_convert(const Decimal&, UShort &) throw((TypeCastException));
00224         static void smf_convert(const Decimal&, Int &) throw((TypeCastException));
00225         static void smf_convert(const Decimal&, UInt &) throw((TypeCastException));
00226         static void smf_convert(const Decimal&, Long &) throw((TypeCastException));
00227         static void smf_convert(const Decimal&, ULong &) throw((TypeCastException));
00228         static void smf_convert(const Decimal&, Float &) throw((TypeCastException));
00229         static void smf_convert(const Decimal&, Double &) throw((TypeCastException));
00230         static void smf_convert(const Decimal&, Decimal &) throw((TypeCastException));
00231         static void smf_convert(const Decimal&, DateTime &) throw((TypeCastException));
00232 
00233         /* DateTime to all simple types casting */
00234         static void smf_convert(const DateTime&, Boolean &) throw((TypeCastException));
00235         static void smf_convert(const DateTime&, String &) throw((TypeCastException));
00236         static void smf_convert(const DateTime&, Byte &) throw((TypeCastException));
00237         static void smf_convert(const DateTime&, UByte &) throw((TypeCastException));
00238         static void smf_convert(const DateTime&, Short &) throw((TypeCastException));
00239         static void smf_convert(const DateTime&, UShort &) throw((TypeCastException));
00240         static void smf_convert(const DateTime&, Int &) throw((TypeCastException));
00241         static void smf_convert(const DateTime&, UInt &) throw((TypeCastException));
00242         static void smf_convert(const DateTime&, Long &) throw((TypeCastException));
00243         static void smf_convert(const DateTime&, ULong &) throw((TypeCastException));
00244         static void smf_convert(const DateTime&, Float &) throw((TypeCastException));
00245         static void smf_convert(const DateTime&, Double &) throw((TypeCastException));
00246         static void smf_convert(const DateTime&, Decimal &) throw((TypeCastException));
00247         static void smf_convert(const DateTime&, DateTime &) throw((TypeCastException));
00248 
00249     };
00250 
00251     template <class T, class F>
00252     class SimpleTypeCast
00253     {
00254       public:
00255         static
00256         T
00257         value_of(
00258             const F &
00259         ) throw((TypeCastException));
00260     };
00261 
00262     template <class T, class F>
00263     inline T
00264     IT_Bus::SimpleTypeCast<T,F>::value_of(const F &s) throw((TypeCastException))
00265     {
00266         T t;
00267         SimpleTypeConverter::smf_convert(s, t);
00268         return t;
00269     }
00270 
00271 }
00272 
00273 #endif // #define _SIMPLE_TYPE_CAST_H_

Generated on Tue Mar 20 15:27:53 2007 for Artix by  doxygen 1.5.1-p1