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 &) IT_THROW_DECL((TypeCastException));
00027         static void smf_convert(const Boolean, String &) IT_THROW_DECL((TypeCastException));
00028         static void smf_convert(const Boolean, Byte &) IT_THROW_DECL((TypeCastException));
00029         static void smf_convert(const Boolean, UByte &) IT_THROW_DECL((TypeCastException));
00030         static void smf_convert(const Boolean, Short &) IT_THROW_DECL((TypeCastException));
00031         static void smf_convert(const Boolean, UShort &) IT_THROW_DECL((TypeCastException));
00032         static void smf_convert(const Boolean, Int &) IT_THROW_DECL((TypeCastException));
00033         static void smf_convert(const Boolean, UInt &) IT_THROW_DECL((TypeCastException));
00034         static void smf_convert(const Boolean, Long &) IT_THROW_DECL((TypeCastException));
00035         static void smf_convert(const Boolean, ULong &) IT_THROW_DECL((TypeCastException));
00036         static void smf_convert(const Boolean, Float &) IT_THROW_DECL((TypeCastException));
00037         static void smf_convert(const Boolean, Double &) IT_THROW_DECL((TypeCastException));
00038         static void smf_convert(const Boolean, Decimal &) IT_THROW_DECL((TypeCastException));
00039         static void smf_convert(const Boolean, DateTime &) IT_THROW_DECL((TypeCastException));
00040 
00041         /* String to all simple types convsions */
00042         static void smf_convert(const String&, Boolean &) IT_THROW_DECL((TypeCastException));
00043         static void smf_convert(const String&, String &) IT_THROW_DECL((TypeCastException));
00044         static void smf_convert(const String&, Byte &) IT_THROW_DECL((TypeCastException));
00045         static void smf_convert(const String&, UByte &) IT_THROW_DECL((TypeCastException));
00046         static void smf_convert(const String&, Short &) IT_THROW_DECL((TypeCastException));
00047         static void smf_convert(const String&, UShort &) IT_THROW_DECL((TypeCastException));
00048         static void smf_convert(const String&, Int &) IT_THROW_DECL((TypeCastException));
00049         static void smf_convert(const String&, UInt &) IT_THROW_DECL((TypeCastException));
00050         static void smf_convert(const String&, Long &) IT_THROW_DECL((TypeCastException));
00051         static void smf_convert(const String&, ULong &) IT_THROW_DECL((TypeCastException));
00052         static void smf_convert(const String&, Float &) IT_THROW_DECL((TypeCastException));
00053         static void smf_convert(const String&, Double &) IT_THROW_DECL((TypeCastException));
00054         static void smf_convert(const String&, Decimal &) IT_THROW_DECL((TypeCastException));
00055         static void smf_convert(const String&, DateTime &) IT_THROW_DECL((TypeCastException));
00056 
00057         /* Signed Byte to all simple types casting */
00058         static void smf_convert(const Byte, Boolean &) IT_THROW_DECL((TypeCastException));
00059         static void smf_convert(const Byte, String &) IT_THROW_DECL((TypeCastException));
00060         static void smf_convert(const Byte, Byte &) IT_THROW_DECL((TypeCastException));
00061         static void smf_convert(const Byte, UByte &) IT_THROW_DECL((TypeCastException));
00062         static void smf_convert(const Byte, Short &) IT_THROW_DECL((TypeCastException));
00063         static void smf_convert(const Byte, UShort &) IT_THROW_DECL((TypeCastException));
00064         static void smf_convert(const Byte, Int &) IT_THROW_DECL((TypeCastException));
00065         static void smf_convert(const Byte, UInt &) IT_THROW_DECL((TypeCastException));
00066         static void smf_convert(const Byte, Long &) IT_THROW_DECL((TypeCastException));
00067         static void smf_convert(const Byte, ULong &) IT_THROW_DECL((TypeCastException));
00068         static void smf_convert(const Byte, Float &) IT_THROW_DECL((TypeCastException));
00069         static void smf_convert(const Byte, Double &) IT_THROW_DECL((TypeCastException));
00070         static void smf_convert(const Byte, Decimal &) IT_THROW_DECL((TypeCastException));
00071         static void smf_convert(const Byte, DateTime &) IT_THROW_DECL((TypeCastException));
00072 
00073         /* Unsigned Byte to all simple types casting */
00074         static void smf_convert(const UByte, Boolean &) IT_THROW_DECL((TypeCastException));
00075         static void smf_convert(const UByte, String &) IT_THROW_DECL((TypeCastException));
00076         static void smf_convert(const UByte, Byte &) IT_THROW_DECL((TypeCastException));
00077         static void smf_convert(const UByte, UByte &) IT_THROW_DECL((TypeCastException));
00078         static void smf_convert(const UByte, Short &) IT_THROW_DECL((TypeCastException));
00079         static void smf_convert(const UByte, UShort &) IT_THROW_DECL((TypeCastException));
00080         static void smf_convert(const UByte, Int &) IT_THROW_DECL((TypeCastException));
00081         static void smf_convert(const UByte, UInt &) IT_THROW_DECL((TypeCastException));
00082         static void smf_convert(const UByte, Long &) IT_THROW_DECL((TypeCastException));
00083         static void smf_convert(const UByte, ULong &) IT_THROW_DECL((TypeCastException));
00084         static void smf_convert(const UByte, Float &) IT_THROW_DECL((TypeCastException));
00085         static void smf_convert(const UByte, Double &) IT_THROW_DECL((TypeCastException));
00086         static void smf_convert(const UByte, Decimal &) IT_THROW_DECL((TypeCastException));
00087         static void smf_convert(const UByte, DateTime &) IT_THROW_DECL((TypeCastException));
00088 
00089         /* Signed Short to all simple types casting */
00090         static void smf_convert(const Short, Boolean &) IT_THROW_DECL((TypeCastException));
00091         static void smf_convert(const Short, String &) IT_THROW_DECL((TypeCastException));
00092         static void smf_convert(const Short, Byte &) IT_THROW_DECL((TypeCastException));
00093         static void smf_convert(const Short, UByte &) IT_THROW_DECL((TypeCastException));
00094         static void smf_convert(const Short, Short &) IT_THROW_DECL((TypeCastException));
00095         static void smf_convert(const Short, UShort &) IT_THROW_DECL((TypeCastException));
00096         static void smf_convert(const Short, Int &) IT_THROW_DECL((TypeCastException));
00097         static void smf_convert(const Short, UInt &) IT_THROW_DECL((TypeCastException));
00098         static void smf_convert(const Short, Long &) IT_THROW_DECL((TypeCastException));
00099         static void smf_convert(const Short, ULong &) IT_THROW_DECL((TypeCastException));
00100         static void smf_convert(const Short, Float &) IT_THROW_DECL((TypeCastException));
00101         static void smf_convert(const Short, Double &) IT_THROW_DECL((TypeCastException));
00102         static void smf_convert(const Short, Decimal &) IT_THROW_DECL((TypeCastException));
00103         static void smf_convert(const Short, DateTime &) IT_THROW_DECL((TypeCastException));
00104 
00105         /* Unsigned Short to all simple types casting */
00106         static void smf_convert(const UShort, Boolean &) IT_THROW_DECL((TypeCastException));
00107         static void smf_convert(const UShort, String &) IT_THROW_DECL((TypeCastException));
00108         static void smf_convert(const UShort, Byte &) IT_THROW_DECL((TypeCastException));
00109         static void smf_convert(const UShort, UByte &) IT_THROW_DECL((TypeCastException));
00110         static void smf_convert(const UShort, Short &) IT_THROW_DECL((TypeCastException));
00111         static void smf_convert(const UShort, UShort &) IT_THROW_DECL((TypeCastException));
00112         static void smf_convert(const UShort, Int &) IT_THROW_DECL((TypeCastException));
00113         static void smf_convert(const UShort, UInt &) IT_THROW_DECL((TypeCastException));
00114         static void smf_convert(const UShort, Long &) IT_THROW_DECL((TypeCastException));
00115         static void smf_convert(const UShort, ULong &) IT_THROW_DECL((TypeCastException));
00116         static void smf_convert(const UShort, Float &) IT_THROW_DECL((TypeCastException));
00117         static void smf_convert(const UShort, Double &) IT_THROW_DECL((TypeCastException));
00118         static void smf_convert(const UShort, Decimal &) IT_THROW_DECL((TypeCastException));
00119         static void smf_convert(const UShort, DateTime &) IT_THROW_DECL((TypeCastException));
00120 
00121         /* Signed Int to all simple types casting */
00122         static void smf_convert(const Int, Boolean &) IT_THROW_DECL((TypeCastException));
00123         static void smf_convert(const Int, String &) IT_THROW_DECL((TypeCastException));
00124         static void smf_convert(const Int, Byte &) IT_THROW_DECL((TypeCastException));
00125         static void smf_convert(const Int, UByte &) IT_THROW_DECL((TypeCastException));
00126         static void smf_convert(const Int, Short &) IT_THROW_DECL((TypeCastException));
00127         static void smf_convert(const Int, UShort &) IT_THROW_DECL((TypeCastException));
00128         static void smf_convert(const Int, Int &) IT_THROW_DECL((TypeCastException));
00129         static void smf_convert(const Int, UInt &) IT_THROW_DECL((TypeCastException));
00130         static void smf_convert(const Int, Long &) IT_THROW_DECL((TypeCastException));
00131         static void smf_convert(const Int, ULong &) IT_THROW_DECL((TypeCastException));
00132         static void smf_convert(const Int, Float &) IT_THROW_DECL((TypeCastException));
00133         static void smf_convert(const Int, Double &) IT_THROW_DECL((TypeCastException));
00134         static void smf_convert(const Int, Decimal &) IT_THROW_DECL((TypeCastException));
00135         static void smf_convert(const Int, DateTime &) IT_THROW_DECL((TypeCastException));
00136 
00137         /* Unsigned Int to all simple types casting */
00138         static void smf_convert(const UInt, Boolean &) IT_THROW_DECL((TypeCastException));
00139         static void smf_convert(const UInt, String &) IT_THROW_DECL((TypeCastException));
00140         static void smf_convert(const UInt, Byte &) IT_THROW_DECL((TypeCastException));
00141         static void smf_convert(const UInt, UByte &) IT_THROW_DECL((TypeCastException));
00142         static void smf_convert(const UInt, Short &) IT_THROW_DECL((TypeCastException));
00143         static void smf_convert(const UInt, UShort &) IT_THROW_DECL((TypeCastException));
00144         static void smf_convert(const UInt, Int &) IT_THROW_DECL((TypeCastException));
00145         static void smf_convert(const UInt, UInt &) IT_THROW_DECL((TypeCastException));
00146         static void smf_convert(const UInt, Long &) IT_THROW_DECL((TypeCastException));
00147         static void smf_convert(const UInt, ULong &) IT_THROW_DECL((TypeCastException));
00148         static void smf_convert(const UInt, Float &) IT_THROW_DECL((TypeCastException));
00149         static void smf_convert(const UInt, Double &) IT_THROW_DECL((TypeCastException));
00150         static void smf_convert(const UInt, Decimal &) IT_THROW_DECL((TypeCastException));
00151         static void smf_convert(const UInt, DateTime &) IT_THROW_DECL((TypeCastException));
00152 
00153         /* Signed Long to all simple types casting */
00154         static void smf_convert(const Long&, Boolean &) IT_THROW_DECL((TypeCastException));
00155         static void smf_convert(const Long&, String &) IT_THROW_DECL((TypeCastException));
00156         static void smf_convert(const Long&, Byte &) IT_THROW_DECL((TypeCastException));
00157         static void smf_convert(const Long&, UByte &) IT_THROW_DECL((TypeCastException));
00158         static void smf_convert(const Long&, Short &) IT_THROW_DECL((TypeCastException));
00159         static void smf_convert(const Long&, UShort &) IT_THROW_DECL((TypeCastException));
00160         static void smf_convert(const Long&, Int &) IT_THROW_DECL((TypeCastException));
00161         static void smf_convert(const Long&, UInt &) IT_THROW_DECL((TypeCastException));
00162         static void smf_convert(const Long&, Long &) IT_THROW_DECL((TypeCastException));
00163         static void smf_convert(const Long&, ULong &) IT_THROW_DECL((TypeCastException));
00164         static void smf_convert(const Long&, Float &) IT_THROW_DECL((TypeCastException));
00165         static void smf_convert(const Long&, Double &) IT_THROW_DECL((TypeCastException));
00166         static void smf_convert(const Long&, Decimal &) IT_THROW_DECL((TypeCastException));
00167         static void smf_convert(const Long&, DateTime &) IT_THROW_DECL((TypeCastException));
00168 
00169         /* Unsigned Long to all simple types casting */
00170         static void smf_convert(const ULong&, Boolean &) IT_THROW_DECL((TypeCastException));
00171         static void smf_convert(const ULong&, String &) IT_THROW_DECL((TypeCastException));
00172         static void smf_convert(const ULong&, Byte &) IT_THROW_DECL((TypeCastException));
00173         static void smf_convert(const ULong&, UByte &) IT_THROW_DECL((TypeCastException));
00174         static void smf_convert(const ULong&, Short &) IT_THROW_DECL((TypeCastException));
00175         static void smf_convert(const ULong&, UShort &) IT_THROW_DECL((TypeCastException));
00176         static void smf_convert(const ULong&, Int &) IT_THROW_DECL((TypeCastException));
00177         static void smf_convert(const ULong&, UInt &) IT_THROW_DECL((TypeCastException));
00178         static void smf_convert(const ULong&, Long &) IT_THROW_DECL((TypeCastException));
00179         static void smf_convert(const ULong&, ULong &) IT_THROW_DECL((TypeCastException));
00180         static void smf_convert(const ULong&, Float &) IT_THROW_DECL((TypeCastException));
00181         static void smf_convert(const ULong&, Double &) IT_THROW_DECL((TypeCastException));
00182         static void smf_convert(const ULong&, Decimal &) IT_THROW_DECL((TypeCastException));
00183         static void smf_convert(const ULong&, DateTime &) IT_THROW_DECL((TypeCastException));
00184 
00185         /* Float to all simple types casting */
00186         static void smf_convert(const Float, Boolean &) IT_THROW_DECL((TypeCastException));
00187         static void smf_convert(const Float, String &) IT_THROW_DECL((TypeCastException));
00188         static void smf_convert(const Float, Byte &) IT_THROW_DECL((TypeCastException));
00189         static void smf_convert(const Float, UByte &) IT_THROW_DECL((TypeCastException));
00190         static void smf_convert(const Float, Short &) IT_THROW_DECL((TypeCastException));
00191         static void smf_convert(const Float, UShort &) IT_THROW_DECL((TypeCastException));
00192         static void smf_convert(const Float, Int &) IT_THROW_DECL((TypeCastException));
00193         static void smf_convert(const Float, UInt &) IT_THROW_DECL((TypeCastException));
00194         static void smf_convert(const Float, Long &) IT_THROW_DECL((TypeCastException));
00195         static void smf_convert(const Float, ULong &) IT_THROW_DECL((TypeCastException));
00196         static void smf_convert(const Float, Float &) IT_THROW_DECL((TypeCastException));
00197         static void smf_convert(const Float, Double &) IT_THROW_DECL((TypeCastException));
00198         static void smf_convert(const Float, Decimal &) IT_THROW_DECL((TypeCastException));
00199         static void smf_convert(const Float, DateTime &) IT_THROW_DECL((TypeCastException));
00200 
00201         /* Double to all simple types casting */
00202         static void smf_convert(const Double&, Boolean &) IT_THROW_DECL((TypeCastException));
00203         static void smf_convert(const Double&, String &) IT_THROW_DECL((TypeCastException));
00204         static void smf_convert(const Double&, Byte &) IT_THROW_DECL((TypeCastException));
00205         static void smf_convert(const Double&, UByte &) IT_THROW_DECL((TypeCastException));
00206         static void smf_convert(const Double&, Short &) IT_THROW_DECL((TypeCastException));
00207         static void smf_convert(const Double&, UShort &) IT_THROW_DECL((TypeCastException));
00208         static void smf_convert(const Double&, Int &) IT_THROW_DECL((TypeCastException));
00209         static void smf_convert(const Double&, UInt &) IT_THROW_DECL((TypeCastException));
00210         static void smf_convert(const Double&, Long &) IT_THROW_DECL((TypeCastException));
00211         static void smf_convert(const Double&, ULong &) IT_THROW_DECL((TypeCastException));
00212         static void smf_convert(const Double&, Float &) IT_THROW_DECL((TypeCastException));
00213         static void smf_convert(const Double&, Double &) IT_THROW_DECL((TypeCastException));
00214         static void smf_convert(const Double&, Decimal &) IT_THROW_DECL((TypeCastException));
00215         static void smf_convert(const Double&, DateTime &) IT_THROW_DECL((TypeCastException));
00216 
00217         /* Decimal to all simple types casting */
00218         static void smf_convert(const Decimal&, Boolean &) IT_THROW_DECL((TypeCastException));
00219         static void smf_convert(const Decimal&, String &) IT_THROW_DECL((TypeCastException));
00220         static void smf_convert(const Decimal&, Byte &) IT_THROW_DECL((TypeCastException));
00221         static void smf_convert(const Decimal&, UByte &) IT_THROW_DECL((TypeCastException));
00222         static void smf_convert(const Decimal&, Short &) IT_THROW_DECL((TypeCastException));
00223         static void smf_convert(const Decimal&, UShort &) IT_THROW_DECL((TypeCastException));
00224         static void smf_convert(const Decimal&, Int &) IT_THROW_DECL((TypeCastException));
00225         static void smf_convert(const Decimal&, UInt &) IT_THROW_DECL((TypeCastException));
00226         static void smf_convert(const Decimal&, Long &) IT_THROW_DECL((TypeCastException));
00227         static void smf_convert(const Decimal&, ULong &) IT_THROW_DECL((TypeCastException));
00228         static void smf_convert(const Decimal&, Float &) IT_THROW_DECL((TypeCastException));
00229         static void smf_convert(const Decimal&, Double &) IT_THROW_DECL((TypeCastException));
00230         static void smf_convert(const Decimal&, Decimal &) IT_THROW_DECL((TypeCastException));
00231         static void smf_convert(const Decimal&, DateTime &) IT_THROW_DECL((TypeCastException));
00232 
00233         /* DateTime to all simple types casting */
00234         static void smf_convert(const DateTime&, Boolean &) IT_THROW_DECL((TypeCastException));
00235         static void smf_convert(const DateTime&, String &) IT_THROW_DECL((TypeCastException));
00236         static void smf_convert(const DateTime&, Byte &) IT_THROW_DECL((TypeCastException));
00237         static void smf_convert(const DateTime&, UByte &) IT_THROW_DECL((TypeCastException));
00238         static void smf_convert(const DateTime&, Short &) IT_THROW_DECL((TypeCastException));
00239         static void smf_convert(const DateTime&, UShort &) IT_THROW_DECL((TypeCastException));
00240         static void smf_convert(const DateTime&, Int &) IT_THROW_DECL((TypeCastException));
00241         static void smf_convert(const DateTime&, UInt &) IT_THROW_DECL((TypeCastException));
00242         static void smf_convert(const DateTime&, Long &) IT_THROW_DECL((TypeCastException));
00243         static void smf_convert(const DateTime&, ULong &) IT_THROW_DECL((TypeCastException));
00244         static void smf_convert(const DateTime&, Float &) IT_THROW_DECL((TypeCastException));
00245         static void smf_convert(const DateTime&, Double &) IT_THROW_DECL((TypeCastException));
00246         static void smf_convert(const DateTime&, Decimal &) IT_THROW_DECL((TypeCastException));
00247         static void smf_convert(const DateTime&, DateTime &) IT_THROW_DECL((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         ) IT_THROW_DECL((TypeCastException));
00260     };
00261 
00262     template <class T, class F>
00263     inline T
00264     IT_Bus::SimpleTypeCast<T,F>::value_of(const F &s) IT_THROW_DECL((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 Thu Sep 7 11:39:36 2006 for Artix by  doxygen 1.4.7