LAMA
|
00001 00034 #ifndef TYPETRAITS_HPP_ 00035 #define TYPETRAITS_HPP_ 00036 00037 namespace lama 00038 { 00039 00047 template<typename T> 00048 class TypeTraits 00049 { 00050 public: 00054 typedef typename T::IndexType IndexType; 00058 typedef typename T::ValueType ValueType; 00059 00060 typedef typename T::ExpressionMemberType ExpressionMemberType; 00061 00062 static const long size = sizeof(T); 00063 }; 00064 00065 template<> 00066 class TypeTraits<long> 00067 { 00068 public: 00069 typedef long IndexType; 00070 typedef long ValueType; 00071 00072 typedef const long ExpressionMemberType; 00073 00074 static const long size = 8; 00075 }; 00076 00077 template<> 00078 class TypeTraits<int> 00079 { 00080 public: 00081 typedef int IndexType; 00082 typedef int ValueType; 00083 typedef const int ExpressionMemberType; 00084 static const long size = 4; 00085 }; 00086 00087 template<> 00088 class TypeTraits<float> 00089 { 00090 public: 00091 typedef int IndexType; 00092 typedef float ValueType; 00093 typedef const float ExpressionMemberType; 00094 static const long size = sizeof(float); 00095 }; 00096 00097 template<> 00098 class TypeTraits<double> 00099 { 00100 public: 00101 typedef int IndexType; 00102 typedef double ValueType; 00103 typedef const double ExpressionMemberType; 00104 static const long size = sizeof(double); 00105 }; 00106 00107 } //namespace lama 00108 00109 #endif // TYPETRAITS_HPP_