Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

basics/typedefs.hh
Go to the documentation of this file.
00001 /* basic typedefs
00002  */
00003 
00004 #ifndef typedefs_hh
00005 #define typedefs_hh
00006 
00007 #include <sys/types.h>
00008 #include <string>
00009 #include <complex>
00010 
00011 namespace concepts {
00012 
00018   typedef double Real;
00019 
00021   typedef std::complex<Real> Cmplx;
00022 
00024   typedef signed int sint;
00025 
00027   typedef unsigned char uchar;
00028 
00030   typedef unsigned short ushort;
00031 
00032   // **************************************************************** number **
00033 
00049   template<typename F>
00050   struct number {};
00051 
00053   template<>
00054   struct number<double> {
00055     static inline std::string name() { return "double"; }
00056   };
00057 
00059   template<>
00060   struct number<long double> {
00061     static inline std::string name() { return "long double"; }
00062   };
00063 
00065   template<>
00066   struct number<std::complex<double> > {
00067     static inline std::string name() { return "complex<double>"; }
00068   };
00069 
00071   template<>
00072   struct number<std::complex<long double> > {
00073     static inline std::string name() { return "complex<long double>"; }
00074   };
00075 
00076   // ************************************************************** Realtype **
00077 
00081   template<typename F>
00082   struct Realtype {
00083     typedef F type;
00084   };
00085 
00086   template<typename F>
00087   struct Realtype<std::complex<F> > {
00088     typedef F type;
00089   };
00090 
00091   // ************************************************************* Cmplxtype **
00092 
00096   template<typename F>
00097   struct Cmplxtype {
00098     typedef std::complex<F> type;
00099   };
00100 
00101   template<typename F>
00102   struct Cmplxtype<std::complex<F> > {
00103     typedef std::complex<F> type;
00104   };
00105 
00106   // ************************************************************** Combtype **
00107   
00116   template<typename F, typename G>
00117   struct Combtype {
00118     typedef F type;
00119   };
00120 
00124   template<typename F>
00125   struct Combtype<std::complex<F>, F> {
00126     typedef std::complex<F> type;
00127   };
00128 
00132   template<typename F>
00133   struct Combtype<F, std::complex<F> > {
00134     typedef std::complex<F> type;
00135   };
00136 
00137   // ************************************************************** Datatype **
00138 
00141   template<typename F>
00142   struct Datatype {
00143     typedef F type;
00144   };
00145 
00146 } // namespace concepts
00147 
00148 #endif // typedefs_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)