00001 // -*- C++ -*- 00002 /*************************************************************************** 00003 * 00004 * The IPPL Framework 00005 * 00006 * 00007 * Visit http://people.web.psi.ch/adelmann/ for more details 00008 * 00009 ***************************************************************************/ 00010 00011 #ifndef APPTYPE_TRAITS_H 00012 #define APPTYPE_TRAITS_H 00013 00014 00015 00016 // templated traits struct for general IPPL AppType 00017 template <class T> 00018 struct AppTypeTraits { 00019 typedef typename T::Element_t Element_t; 00020 enum { ElemDim = T::ElemDim }; 00021 }; 00022 00023 // specialized versions for built-in types 00024 #define BUILTIN_APPTYPE_TRAITS(T) \ 00025 template <> \ 00026 struct AppTypeTraits< T > { \ 00027 typedef T Element_t; \ 00028 enum { ElemDim = 0 }; \ 00029 }; 00030 00031 BUILTIN_APPTYPE_TRAITS(bool) 00032 BUILTIN_APPTYPE_TRAITS(char) 00033 BUILTIN_APPTYPE_TRAITS(unsigned char) 00034 BUILTIN_APPTYPE_TRAITS(short) 00035 BUILTIN_APPTYPE_TRAITS(unsigned short) 00036 BUILTIN_APPTYPE_TRAITS(int) 00037 BUILTIN_APPTYPE_TRAITS(unsigned int) 00038 BUILTIN_APPTYPE_TRAITS(long) 00039 BUILTIN_APPTYPE_TRAITS(unsigned long) 00040 #if defined(IPPL_LONGLONG) 00041 BUILTIN_APPTYPE_TRAITS(long long) 00042 #endif 00043 BUILTIN_APPTYPE_TRAITS(float) 00044 BUILTIN_APPTYPE_TRAITS(double) 00045 BUILTIN_APPTYPE_TRAITS(long double) 00046 #ifdef IPPL_HAS_TEMPLATED_COMPLEX 00047 BUILTIN_APPTYPE_TRAITS(complex<float>) 00048 BUILTIN_APPTYPE_TRAITS(complex<double>) 00049 #else 00050 BUILTIN_APPTYPE_TRAITS(complex) 00051 #endif 00052 00053 #undef BUILTIN_APPTYPE_TRAITS 00054 00055 #endif // APPTYPE_TRAITS_H 00056 00057 /*************************************************************************** 00058 * $RCSfile: AppTypeTraits.h,v $ $Author: adelmann $ 00059 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:24 $ 00060 * IPPL_VERSION_ID: $Id: AppTypeTraits.h,v 1.1.1.1 2003/01/23 07:40:24 adelmann Exp $ 00061 ***************************************************************************/ 00062