config.hxx

Go to the documentation of this file.
00001 #ifndef CONFIG_HXX
00002 #define CONFIG_HXX
00003 #ifdef OPENGM_CONFIGFILE
00004 // include own include file with 
00005 // g++ ... -DOPENGM_CONFIGFILE=path/config.hxx ....
00006 #include OPENGM_CONFIGFILE
00007 #else // OPENGM_CONFIGFILE
00008 
00016 
00017 // has no typedef ? (TODO make this a option in cmake  list or
00018 // find out in cmake if this define should be active or not
00019 #ifdef OPENGM_NO_TYPENAME 
00020 #  define typename 
00021 #endif
00022 #include "opengm/utilities/metaprogramming.hxx"
00023 
00024 #define OPENGM_WORD_LENGTH                   sizeof(void *)
00025 #define OPENGM_SIZE_OF_BOOL                  1
00026 #define OPENGM_SIZE_OF_CHAR                  sizeof(char)
00027 #define OPENGM_SIZE_OF_SIGNED_CHAR           sizeof(unsigned char)
00028 #define OPENGM_SIZE_OF_UNSIGNED_CHAR         sizeof(unsigned char)
00029 #define OPENGM_SIZE_OF_WCHAR_T               sizeof(wchar_t) 
00030 #define OPENGM_SIZE_OF_SHORT                 sizeof(short)
00031 #define OPENGM_SIZE_OF_UNSIGNED_SHORT        sizeof(unsigned short)
00032 #define OPENGM_SIZE_OF_INT                   sizeof(int)
00033 #define OPENGM_SIZE_OF_UNSIGNED_INT          sizeof(unsigned int)
00034 #define OPENGM_SIZE_OF_LONG                  sizeof(long)
00035 #define OPENGM_SIZE_OF_UNSIGNED_LONG         sizeof(unsigned long)
00036 #define OPENGM_SIZE_OF_LONG_LONG             sizeof(long long)
00037 #define OPENGM_SIZE_OF_UNSIGNED_LONG_LONG    sizeof(unsigned long long)
00038 #define OPENGM_SIZE_OF_FLOAT                 sizeof(float)
00039 #define OPENGM_SIZE_OF_DOUBLE                sizeof(double)
00040 #define OPENGM_SIZE_OF_LONG_DOUBLE           sizeof(long double)
00041 
00042 
00043 namespace opengm{
00044    
00045 
00047 const unsigned int  VERSION_MAJOR = 2;
00049 const unsigned int  VERSION_MINOR = 0;
00051 const unsigned int  VERSION_PATCH = 2;
00052 
00058 const size_t USUAL_MAX_FACTOR_ORDER=5;
00059 
00061 #ifdef NDEBUG
00062 const bool NO_DEBUG = true;
00063 #else
00064 const bool NO_DEBUG = false;
00065 #endif
00066 
00067 namespace detail_types{
00068 // structs to identify if am system
00069 // does not have a certain type   
00070 struct NoCharOnSystem;
00071 struct NoUnsignedCharOnSystem;
00072 struct NoSignedCharOnSystem;
00073 struct NoWCharTOnSystem;
00074 struct NoShortOnSystem;
00075 struct NoUnsignedShortOnSystem;
00076 struct NoIntOnSystem;
00077 struct NoUnsignedIntOnSystem;
00078 struct NoLongOnSystem;
00079 struct NoUnsignedLongOnSystem;
00080 struct NoUnsignedLongLongOnSystem;
00081 struct NoLongLongOnSystem;
00082 struct NoFloatOnSystem;
00083 struct NoDoubleOnSystem;
00084 struct NoLongDoubleOnSystem;
00085 struct NoUIntTypeOnSystem;
00086 struct NoIntTypeOnSystem;
00087 struct NoFloatTypeOnSystem;
00088 struct NoUInt8OnSystem;
00089 struct NoUInt16OnSystem;
00090 struct NoUInt32OnSystem;
00091 struct NoUInt64OnSystem;
00092 struct NoInt8OnSystem;
00093 struct NoInt16OnSystem;
00094 struct NoInt32OnSystem;
00095 struct NoInt64OnSystem;
00096 struct NoFloat32OnSystem;
00097 struct NoFloat64OnSystem;
00098 struct NoFloat128OnSystem;
00099 // typedefs to types to identify if am system
00100 // does not have a certain type
00101 #ifdef OPENGM_NO_CHAR
00102 typedef opengm::meta::InvalideType<NoCharOnSystem> Char;
00103 #else
00104 typedef char Char;
00105 #endif
00106 #ifdef OPENGM_NO_UNSIGNED_CHAR
00107 typedef opengm::meta::InvalideType<NoUnsignedCharOnSystem> UnsignedChar;
00108 #else
00109 typedef unsigned char UnsignedChar;
00110 #endif
00111 #ifdef OPENGM_NO_SIGNED_CHAR
00112 typedef opengm::meta::InvalideType<NoSignedCharOnSystem> SignedChar;
00113 #else
00114 typedef signed char SignedChar;
00115 #endif
00116 #ifdef OPENGM_NO_WCHAR_T
00117 typedef opengm::meta::InvalideType<NoWCharTOnSystem> WCharT;
00118 #else
00119 typedef wchar_t WCharT;
00120 #endif
00121 #ifdef OPENGM_NO_SHORT
00122 typedef NoShortOnSystem Short;
00123 #else
00124 typedef short Short;
00125 #endif
00126 #ifdef OPENGM_NO_UNSIGNED_SHORT
00127 typedef opengm::meta::InvalideType<NoUnsignedShortOnSystem> UnsignedShort;
00128 #else
00129 typedef unsigned short UnsignedShort;
00130 #endif
00131 #ifdef OPENGM_NO_INT
00132 typedef opengm::meta::InvalideType<NoIntOnSystem> Int;
00133 #else
00134 typedef int Int;
00135 #endif
00136 #ifdef OPENGM_NO_UNSIGNED_INT
00137 typedef opengm::meta::InvalideType<NoUnsignedIntOnSystem> UnsignedInt;
00138 #else
00139 typedef unsigned int UnsignedInt; 
00140 #endif
00141 #ifdef OPENGM_NO_LONG
00142 typedef opengm::meta::InvalideType<NoLongOnSystem> Long;
00143 #else
00144 typedef long Long;
00145 #endif
00146 #ifdef OPENGM_NO_UNSIGNED_LONG
00147 typedef opengm::meta::InvalideType<NoUnsignedLongOnSystem> UnsignedLong;
00148 #else
00149 typedef unsigned long UnsignedLong;
00150 #endif
00151 #ifdef OPENGM_NO_LONG_LONG
00152 typedef opengm::meta::InvalideType<NoLongLongOnSystem> LongLong;
00153 #else
00154 typedef long long LongLong;
00155 #endif
00156 #ifdef OPENGM_NO_UNSIGNED_LONG
00157 typedef opengm::meta::InvalideType<NoUnsignedLongLongOnSystem> UnsignedLongLong;
00158 #else
00159 typedef unsigned long long UnsignedLongLong;
00160 #endif
00161 #ifdef OPENGM_NO_Float
00162 typedef opengm::meta::InvalideType<NoFloatOnSystem> Float;
00163 #else
00164 typedef float Float;
00165 #endif
00166 #ifdef OPENGM_NO_DOUBLE
00167 typedef opengm::meta::InvalideType<NoDoubleOnSystem> Double;
00168 #else
00169 typedef double Double;
00170 #endif
00171 #ifdef OPENGM_NO_LONG_DOUBLE
00172 typedef opengm::meta::InvalideType<NoLongDoubleOnSystem> LongDouble;
00173 #else
00174 typedef long double LongDouble;
00175 #endif
00176 typedef bool Bool ;
00177 // typelists of the basic c++ types
00178 // Floats:
00179 typedef opengm::meta::TypeListGenerator<
00180    Float,Double , LongDouble
00181 >::type StdFloatingPointTypesTypeList;
00182 // UInt:
00183 typedef opengm::meta::TypeListGenerator<
00184    UnsignedChar,UnsignedShort, UnsignedInt, UnsignedLong, UnsignedLongLong
00185 >::type StdUnsignedIntegerTypesTypeList;
00186 // Int:
00187 typedef opengm::meta::TypeListGenerator<
00188    Char, SignedChar, Short, Int, Long,LongLong
00189 >::type StdSignedIntegerTypesTypeList;
00190 // typelists of the sizes of the basic c++ types
00191 // Float sizes:
00192 typedef opengm::meta::TypeListGenerator<
00193    opengm::meta::SizeT<OPENGM_SIZE_OF_FLOAT>,meta::SizeT<OPENGM_SIZE_OF_DOUBLE>,
00194    opengm::meta::SizeT<OPENGM_SIZE_OF_LONG_DOUBLE>
00195 >::type StdFloatingPointSizesTypeList;
00196 // UInt sizes:
00197 typedef opengm::meta::TypeListGenerator<
00198    opengm::meta::SizeT<OPENGM_SIZE_OF_UNSIGNED_CHAR>, opengm::meta::SizeT<OPENGM_SIZE_OF_UNSIGNED_SHORT>,
00199    opengm::meta::SizeT<OPENGM_SIZE_OF_UNSIGNED_INT>, opengm::meta::SizeT<OPENGM_SIZE_OF_UNSIGNED_LONG>, 
00200    opengm::meta::SizeT<OPENGM_SIZE_OF_UNSIGNED_LONG_LONG>
00201 >::type StdUnsignedIntegerSizesTypeList;
00202 // Int sizes:
00203 typedef opengm::meta::TypeListGenerator<
00204    opengm::meta::SizeT<OPENGM_SIZE_OF_CHAR>, opengm::meta::SizeT<OPENGM_SIZE_OF_SIGNED_CHAR>, 
00205    opengm::meta::SizeT<OPENGM_SIZE_OF_SHORT>,opengm::meta::SizeT<OPENGM_SIZE_OF_INT>,
00206    opengm::meta::SizeT<OPENGM_SIZE_OF_LONG>,opengm::meta::SizeT<OPENGM_SIZE_OF_LONG_LONG>
00207 >::type StdSignedIntegerSizesTypeList;
00208 // platform independent
00209 // UInt :
00210 typedef opengm::meta::FindSizedType<StdUnsignedIntegerTypesTypeList,StdUnsignedIntegerSizesTypeList,
00211    1,meta::InvalidType<NoUInt8OnSystem > >::type UInt8Type ;
00212 typedef opengm::meta::FindSizedType<StdUnsignedIntegerTypesTypeList,StdUnsignedIntegerSizesTypeList,
00213    2,meta::InvalidType<NoUInt16OnSystem> >::type  UInt16Type ;
00214 typedef opengm::meta::FindSizedType<StdUnsignedIntegerTypesTypeList,StdUnsignedIntegerSizesTypeList,
00215    4,meta::InvalidType<NoUInt32OnSystem> >::type  UInt32Type ;
00216 typedef opengm::meta::FindSizedType<StdUnsignedIntegerTypesTypeList,StdUnsignedIntegerSizesTypeList,
00217    8,meta::InvalidType<NoUInt64OnSystem> >::type  UInt64Type ;
00218 //Int :
00219 typedef opengm::meta::FindSizedType<StdSignedIntegerTypesTypeList,StdSignedIntegerSizesTypeList,
00220    1,meta::InvalidType<NoInt8OnSystem > >::type  Int8Type ;
00221 typedef opengm::meta::FindSizedType<StdSignedIntegerTypesTypeList,StdSignedIntegerSizesTypeList,
00222    2,meta::InvalidType<NoInt16OnSystem> >::type  Int16Type ;
00223 typedef opengm::meta::FindSizedType<StdSignedIntegerTypesTypeList,StdSignedIntegerSizesTypeList,
00224    4,meta::InvalidType<NoInt32OnSystem> >::type  Int32Type ;
00225 typedef opengm::meta::FindSizedType<StdSignedIntegerTypesTypeList,StdSignedIntegerSizesTypeList,
00226    8,meta::InvalidType<NoInt64OnSystem> >::type  Int64Type ;
00227 // Float :
00228 typedef opengm::meta::FindSizedType<StdFloatingPointTypesTypeList,StdFloatingPointSizesTypeList,
00229    4,meta::InvalidType<NoFloat32OnSystem> >::type  Float32Type ;
00230 typedef opengm::meta::FindSizedType<StdFloatingPointTypesTypeList,StdFloatingPointSizesTypeList,
00231    8,meta::InvalidType<NoFloat64OnSystem> >::type  Float64Type ;
00232 typedef opengm::meta::FindSizedType<StdFloatingPointTypesTypeList,StdFloatingPointSizesTypeList,
00233    16,meta::InvalidType<NoFloat128OnSystem> >::type  Float128Type ;
00234 // opengm::meta-"switch-cases" typelists to find out the
00235 // biggest and smallest uint, int and float type
00236 typedef opengm::meta::TypeListGenerator<
00237    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< UInt64Type >::value >::value ,UInt64Type>,
00238    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< UInt32Type >::value >::value ,UInt32Type>,
00239    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< UInt16Type >::value >::value ,UInt16Type>,
00240    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< UInt8Type  >::value >::value ,UInt8Type>
00241 >::type UIntSwitchCasesBiggest;
00242 typedef opengm::meta::TypeListGenerator<
00243    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Int64Type >::value >::value ,Int64Type>,
00244    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Int32Type >::value >::value ,Int32Type>,
00245    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Int16Type >::value >::value ,Int16Type>,
00246    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Int8Type  >::value >::value ,Int8Type>
00247 >::type IntSwitchCasesBiggest;
00248 typedef opengm::meta::TypeListGenerator<
00249    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Float128Type >::value >::value ,Float128Type>,
00250    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Float64Type  >::value >::value ,Float64Type>,
00251    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Float32Type  >::value >::value ,Float32Type>
00252 >::type FloatSwitchCasesBiggest;
00253 typedef opengm::meta::TypeListGenerator<
00254    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< UInt8Type  >::value >::value ,UInt8Type>,
00255    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< UInt16Type >::value >::value ,UInt16Type>,
00256    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< UInt32Type >::value >::value ,UInt32Type>,
00257    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< UInt64Type >::value >::value ,UInt64Type>
00258 >::type UIntSwitchCasesSmallest;
00259 typedef opengm::meta::TypeListGenerator<
00260    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Int8Type >::value >::value ,Int8Type>,
00261    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Int16Type >::value >::value ,Int16Type>,
00262    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Int32Type >::value >::value ,Int32Type>,
00263    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Int64Type  >::value >::value ,Int64Type>
00264 >::type IntSwitchCasesSmallest;
00265 typedef opengm::meta::TypeListGenerator<
00266    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Float32Type  >::value >::value,Float32Type >,
00267    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Float64Type  >::value >::value ,Float64Type>,
00268    opengm::meta::SwitchCase< opengm::meta::Not< opengm::meta::IsInvalidType< Float128Type  >::value >::value ,Float128Type>
00269 >::type FloatSwitchCasesSmallest;
00270 // biggest type
00271 typedef opengm::meta::Switch< UIntSwitchCasesBiggest  ,
00272    NoUIntTypeOnSystem  >::type BiggestUIntType;
00273 typedef opengm::meta::Switch< IntSwitchCasesBiggest   , 
00274    NoIntTypeOnSystem   >::type BiggestIntType;
00275 typedef opengm::meta::Switch< FloatSwitchCasesBiggest , 
00276    NoFloatTypeOnSystem >::type BiggestFloatType;
00277 // smallest types
00278 typedef opengm::meta::Switch< UIntSwitchCasesSmallest  ,
00279    NoUIntTypeOnSystem  >::type SmallestUIntType;
00280 typedef opengm::meta::Switch< IntSwitchCasesSmallest   ,
00281    NoIntTypeOnSystem   >::type SmallestIntType;
00282 typedef opengm::meta::Switch< FloatSwitchCasesSmallest ,
00283    NoFloatTypeOnSystem >::type SmallestFloatType;
00284 } // end namespace detail_types
00285 
00286 
00287 
00288 
00291 //typedef size_t ::size_t;
00292 // UInt Types
00294 typedef detail_types::UInt8Type           UInt8Type;
00296 typedef detail_types::UInt16Type          UInt16Type;
00298 typedef detail_types::UInt32Type          UInt32Type;
00300 typedef detail_types::UInt64Type          UInt64Type;
00301 // Int Types:
00302 typedef detail_types::Int8Type            Int8Type;
00304 typedef detail_types::Int16Type           Int16Type;
00306 typedef detail_types::Int32Type           Int32Type;
00308 typedef detail_types::Int64Type           Int64Type;
00309 // Float Types:
00311 typedef detail_types::Float32Type         Float32Type;
00313 typedef detail_types::Float64Type         Float64Type;
00315 typedef detail_types::BiggestUIntType     BiggestUIntType;
00317 typedef detail_types::BiggestIntType      BiggestIntType;
00318 typedef detail_types::BiggestFloatType    BiggestFloatType;
00319 // smallest Types:
00321 typedef detail_types::SmallestUIntType    SmallestUIntType;
00322 typedef detail_types::SmallestIntType     SmallestIntType;
00323 typedef detail_types::SmallestFloatType   SmallestFloatType;
00324 // default Types:
00326 typedef BiggestUIntType                   UIntType;
00328 typedef BiggestIntType                    IntType;
00330 typedef SmallestFloatType                 FloatType;
00331 } // end namespace opengm
00332 
00333 #endif // OPENGM_CONFIGFILE
00334 #endif // CONFIG_HXX 
00335 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Mon Jun 17 16:31:01 2013 for OpenGM by  doxygen 1.6.3