00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef util_Basics_hpp
00025 #define util_Basics_hpp
00026
00027 namespace phdmesh {
00028
00035
00043 template< bool expression > struct StaticAssert {};
00044
00045 template<> struct StaticAssert<true> {
00046 enum { OK = true };
00047 static bool ok() { return true ; }
00048 };
00049
00050
00051
00052
00053 #ifndef DOXYGEN_COMPILE
00054
00055 template<
00056 unsigned size_char = sizeof( unsigned char ) ,
00057 unsigned size_short = sizeof( unsigned short ) ,
00058 unsigned size_int = sizeof( unsigned int ) ,
00059 unsigned size_long = sizeof( unsigned long ) ,
00060 unsigned size_ptr = sizeof( void * ) >
00061 struct IntegerFundamentalTypes ;
00062
00063 template<>
00064 struct IntegerFundamentalTypes<1,2,4,8,4> {
00065 typedef signed char int8_type ;
00066 typedef unsigned char uint8_type ;
00067 typedef signed short int16_type ;
00068 typedef unsigned short uint16_type ;
00069 typedef signed int int32_type ;
00070 typedef unsigned int uint32_type ;
00071 typedef signed long int64_type ;
00072 typedef unsigned long uint64_type ;
00073 typedef signed int intptr_type ;
00074 typedef unsigned int uintptr_type ;
00075 };
00076
00077 template<>
00078 struct IntegerFundamentalTypes<1,2,4,8,8> {
00079 typedef signed char int8_type ;
00080 typedef unsigned char uint8_type ;
00081 typedef signed short int16_type ;
00082 typedef unsigned short uint16_type ;
00083 typedef signed int int32_type ;
00084 typedef unsigned int uint32_type ;
00085 typedef signed long int64_type ;
00086 typedef unsigned long uint64_type ;
00087 typedef signed long intptr_type ;
00088 typedef unsigned long uintptr_type ;
00089 };
00090
00091 template<>
00092 struct IntegerFundamentalTypes<1,2,4,4,4> {
00093 typedef signed char int8_type ;
00094 typedef unsigned char uint8_type ;
00095 typedef signed short int16_type ;
00096 typedef unsigned short uint16_type ;
00097 typedef signed int int32_type ;
00098 typedef unsigned int uint32_type ;
00099 typedef signed long long int64_type ;
00100 typedef unsigned long long uint64_type ;
00101 typedef signed long intptr_type ;
00102 typedef unsigned long uintptr_type ;
00103 };
00104
00105 template<>
00106 struct IntegerFundamentalTypes<1,2,4,4,8> {
00107 typedef signed char int8_type ;
00108 typedef unsigned char uint8_type ;
00109 typedef signed short int16_type ;
00110 typedef unsigned short uint16_type ;
00111 typedef signed int int32_type ;
00112 typedef unsigned int uint32_type ;
00113 typedef signed long long int64_type ;
00114 typedef unsigned long long uint64_type ;
00115 typedef signed long long intptr_type ;
00116 typedef unsigned long long uintptr_type ;
00117 };
00118
00119 #endif
00120
00121 typedef IntegerFundamentalTypes<>::int8_type int8_type ;
00122 typedef IntegerFundamentalTypes<>::uint8_type uint8_type ;
00123 typedef IntegerFundamentalTypes<>::int16_type int16_type ;
00124 typedef IntegerFundamentalTypes<>::uint16_type uint16_type ;
00125 typedef IntegerFundamentalTypes<>::int32_type int32_type ;
00126 typedef IntegerFundamentalTypes<>::uint32_type uint32_type ;
00127 typedef IntegerFundamentalTypes<>::int64_type int64_type ;
00128 typedef IntegerFundamentalTypes<>::uint64_type uint64_type ;
00129 typedef IntegerFundamentalTypes<>::intptr_type intptr_type ;
00130 typedef IntegerFundamentalTypes<>::uintptr_type uintptr_type ;
00131
00134 }
00135
00136 #endif
00137