Teuchos_OrdinalTraits.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _TEUCHOS_ORDINALTRAITS_HPP_
00033 #define _TEUCHOS_ORDINALTRAITS_HPP_
00034
00039 #include "Teuchos_ConfigDefs.hpp"
00040
00054
00055
00056
00057 namespace Teuchos {
00058
00059 template<class T>
00060 struct UndefinedOrdinalTraits
00061 {
00063 static inline T notDefined() { return T::this_type_is_missing_a_specialization(); }
00064 };
00065
00066 template<class T>
00067 struct OrdinalTraits {
00068
00070 static const bool hasMachineParameters = false;
00071
00073 static inline T zero() { return UndefinedOrdinalTraits<T>::notDefined(); }
00074
00076 static inline T one() { return UndefinedOrdinalTraits<T>::notDefined(); }
00077
00079 static inline std::string name() { return UndefinedOrdinalTraits<T>::notDefined(); }
00080 };
00081
00082 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00083
00084 template<>
00085 struct OrdinalTraits<char> {
00086 static const bool hasMachineParameters = false;
00087 static inline char zero() {return(0);}
00088 static inline char one() {return(1);}
00089 static inline std::string name() {return("char");}
00090 };
00091
00092 template<>
00093 struct OrdinalTraits<short int> {
00094 static const bool hasMachineParameters = false;
00095 static inline short int zero() {return(0);}
00096 static inline short int one() {return(1);}
00097 static inline std::string name() {return("short int");}
00098 };
00099
00100 template<>
00101 struct OrdinalTraits<int> {
00102 static const bool hasMachineParameters = false;
00103 static inline int zero() {return(0);}
00104 static inline int one() {return(1);}
00105 static inline std::string name() {return("int");}
00106 };
00107
00108 template<>
00109 struct OrdinalTraits<long int> {
00110 static const bool hasMachineParameters = false;
00111 static inline long int zero() {return(static_cast<long int>(0));}
00112 static inline long int one() {return(static_cast<long int>(1));}
00113 static inline std::string name() {return("long int");}
00114 };
00115
00116 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
00117
00118 template<>
00119 struct OrdinalTraits<long long int> {
00120 static const bool hasMachineParameters = false;
00121 static inline long long int zero() {return(static_cast<long long int>(0));}
00122 static inline long long int one() {return(static_cast<long long int>(1));}
00123 static inline std::string name() {return("long long int");}
00124 };
00125
00126 #endif // HAVE_TEUCHOS_LONG_LONG_INT
00127
00128 #endif // DOXYGEN_SHOULD_SKIP_THIS
00129
00130 }
00131
00132 #endif // _TEUCHOS_ORDINALTRAITS_HPP_