ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkIntTypes.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkIntTypes_h
00019 #define __itkIntTypes_h
00020 
00021 #include "itkConfigure.h"
00022 
00023 #if defined( ITK_HAVE_STDINT_H )
00024 #include <stdint.h>
00025 #else
00026 // the system doesn't have the C or C++ version of stdint so lets use
00027 // itksys's types for fixed widths
00028 #include "itksys/FundamentalType.h"
00029 
00030 #ifdef ITK_HAVE_STDDEF_H
00031 #include <stddef.h>
00032 #endif //ITK_HAVE_STDDEF_H
00033 
00034 #endif // ITK_HAVE_CSTDINT
00035 
00036 #include <limits.h>
00037 
00038 namespace itk
00039 {
00040 #if defined( ITK_HAVE_STDINT_H )
00041 
00042 // Note: these types are technically optional in C99 stdint.h file. As
00043 // such a try complile for their existance may be needed.
00044 typedef::int8_t   int8_t;
00045 typedef::uint8_t  uint8_t;
00046 typedef::int16_t  int16_t;
00047 typedef::uint16_t uint16_t;
00048 typedef::int32_t  int32_t;
00049 typedef::uint32_t uint32_t;
00050 typedef::int64_t  int64_t;
00051 typedef::uint64_t uint64_t;
00052 
00053 // Note: these types are required for the C99 stdint.h file.
00054 typedef::int_least8_t   int_least8_t;
00055 typedef::uint_least8_t  uint_least8_t;
00056 typedef::int_least16_t  int_least16_t;
00057 typedef::uint_least16_t uint_least16_t;
00058 typedef::int_least32_t  int_least32_t;
00059 typedef::uint_least32_t uint_least32_t;
00060 typedef::int_least64_t  int_least64_t;
00061 typedef::uint_least64_t uint_least64_t;
00062 
00063 // Note: these types are required for the C99 stdint.h file.
00064 typedef::int_fast8_t   int_fast8_t;
00065 typedef::uint_fast8_t  uint_fast8_t;
00066 typedef::int_fast16_t  int_fast16_t;
00067 typedef::uint_fast16_t uint_fast16_t;
00068 typedef::int_fast32_t  int_fast32_t;
00069 typedef::uint_fast32_t uint_fast32_t;
00070 typedef::int_fast64_t  int_fast64_t;
00071 typedef::uint_fast64_t uint_fast64_t;
00072 
00073 typedef::intmax_t  intmax_t;
00074 typedef::uintmax_t uintmax_t;
00075 
00076 typedef::intptr_t  intptr_t;
00077 typedef::uintptr_t uintptr_t;
00078 
00079 #else // ITK_HAVE_STDINT_H
00080 
00082 typedef::itksysFundamentalType_Int8   int8_t;
00083 typedef::itksysFundamentalType_UInt8  uint8_t;
00084 typedef::itksysFundamentalType_Int16  int16_t;
00085 typedef::itksysFundamentalType_UInt16 uint16_t;
00086 typedef::itksysFundamentalType_Int32  int32_t;
00087 typedef::itksysFundamentalType_UInt32 uint32_t;
00088 typedef::itksysFundamentalType_Int64  int64_t;
00089 typedef::itksysFundamentalType_UInt64 uint64_t;
00090 
00093 typedef int8_t   int_least8_t;
00094 typedef uint8_t  uint_least8_t;
00095 typedef int16_t  int_least16_t;
00096 typedef uint16_t uint_least16_t;
00097 typedef int32_t  int_least32_t;
00098 typedef uint32_t uint_least32_t;
00099 typedef int64_t  int_least64_t;
00100 typedef uint64_t uint_least64_t;
00101 
00104 typedef int8_t   int_fast8_t;
00105 typedef uint8_t  uint_fast8_t;
00106 typedef int16_t  int_fast16_t;
00107 typedef uint16_t uint_fast16_t;
00108 typedef int32_t  int_fast32_t;
00109 typedef uint32_t uint_fast32_t;
00110 typedef int64_t  int_fast64_t;
00111 typedef uint64_t uint_fast64_t;
00112 
00114 typedef int64_t  intmax_t;
00115 typedef uint64_t uintmax_t;
00116 
00117 typedef::ptrdiff_t intptr_t;
00118 typedef::size_t    uintptr_t;
00119 
00120 #endif // ITK_HAVE_STDINT_H
00121 
00122 #if !defined(ITKV3_COMPATIBILITY) && defined(ITK_USE_64BITS_IDS) && ((ULLONG_MAX != ULONG_MAX) || (LLONG_MAX != LONG_MAX))
00123 
00126 typedef uint64_t      SizeValueType;
00127 
00130 typedef SizeValueType IdentifierType;
00131 
00133 typedef int64_t       IndexValueType;
00134 
00137 typedef int64_t       OffsetValueType;
00138 
00139 #else
00140 
00143 typedef unsigned long     SizeValueType;
00144 
00147 typedef SizeValueType IdentifierType;
00148 
00150 typedef signed long   IndexValueType;
00151 
00154 typedef signed long   OffsetValueType;
00155 
00156 #endif
00157 
00159 typedef unsigned int  ThreadIdType;
00160 
00161 }
00162 
00163 #endif  /* __itkIntTypes_h */
00164