tbb_stddef.h

00001 /*
00002     Copyright 2005-2011 Intel Corporation.  All Rights Reserved.
00003 
00004     The source code contained or described herein and all documents related
00005     to the source code ("Material") are owned by Intel Corporation or its
00006     suppliers or licensors.  Title to the Material remains with Intel
00007     Corporation or its suppliers and licensors.  The Material is protected
00008     by worldwide copyright laws and treaty provisions.  No part of the
00009     Material may be used, copied, reproduced, modified, published, uploaded,
00010     posted, transmitted, distributed, or disclosed in any way without
00011     Intel's prior express written permission.
00012 
00013     No license under any patent, copyright, trade secret or other
00014     intellectual property right is granted to or conferred upon you by
00015     disclosure or delivery of the Materials, either expressly, by
00016     implication, inducement, estoppel or otherwise.  Any license under such
00017     intellectual property rights must be express and approved by Intel in
00018     writing.
00019 */
00020 
00021 #ifndef __TBB_tbb_stddef_H
00022 #define __TBB_tbb_stddef_H
00023 
00024 // Marketing-driven product version
00025 #define TBB_VERSION_MAJOR 4
00026 #define TBB_VERSION_MINOR 0
00027 
00028 // Engineering-focused interface version
00029 #define TBB_INTERFACE_VERSION 6002
00030 #define TBB_INTERFACE_VERSION_MAJOR TBB_INTERFACE_VERSION/1000
00031 
00032 // The oldest major interface version still supported
00033 // To be used in SONAME, manifests, etc.
00034 #define TBB_COMPATIBLE_INTERFACE_VERSION 2
00035 
00036 #define __TBB_STRING_AUX(x) #x
00037 #define __TBB_STRING(x) __TBB_STRING_AUX(x)
00038 
00039 // We do not need defines below for resource processing on windows
00040 #if !defined RC_INVOKED
00041 
00042 // Define groups for Doxygen documentation
00052 // Simple text that is displayed on the main page of Doxygen documentation.
00094 // Define preprocessor symbols used to determine architecture
00095 #if _WIN32||_WIN64
00096 #   if defined(_M_X64)||defined(__x86_64__)  // the latter for MinGW support
00097 #       define __TBB_x86_64 1
00098 #   elif defined(_M_IA64)
00099 #       define __TBB_ipf 1
00100 #   elif defined(_M_IX86)||defined(__i386__) // the latter for MinGW support
00101 #       define __TBB_x86_32 1
00102 #   endif
00103 #else /* Assume generic Unix */
00104 #   if !__linux__ && !__APPLE__
00105 #       define __TBB_generic_os 1
00106 #   endif
00107 #   if __x86_64__
00108 #       define __TBB_x86_64 1
00109 #   elif __ia64__
00110 #       define __TBB_ipf 1
00111 #   elif __i386__||__i386  // __i386 is for Sun OS
00112 #       define __TBB_x86_32 1
00113 #   else
00114 #       define __TBB_generic_arch 1
00115 #   endif
00116 #endif
00117 
00118 // tbb_config.h should be included the first since it contains macro definitions used in other headers
00119 #include "tbb_config.h"
00120 
00121 #if _MSC_VER >=1400
00122     #define __TBB_EXPORTED_FUNC   __cdecl
00123     #define __TBB_EXPORTED_METHOD __thiscall
00124 #else
00125     #define __TBB_EXPORTED_FUNC
00126     #define __TBB_EXPORTED_METHOD
00127 #endif
00128 
00129 #include <cstddef>      /* Need size_t and ptrdiff_t */
00130 
00131 #if _MSC_VER
00132     #define __TBB_tbb_windef_H
00133     #include "internal/_tbb_windef.h"
00134     #undef __TBB_tbb_windef_H
00135 #else
00136     #include <stdint.h>
00137 #endif
00138 
00140 namespace tbb {
00141 
00142 #if _MSC_VER
00143     namespace internal {
00144         typedef __int8 int8_t;
00145         typedef __int16 int16_t;
00146         typedef __int32 int32_t;
00147         typedef __int64 int64_t;
00148         typedef unsigned __int8 uint8_t;
00149         typedef unsigned __int16 uint16_t;
00150         typedef unsigned __int32 uint32_t;
00151         typedef unsigned __int64 uint64_t;
00152     } // namespace internal
00153 #else /* Posix */
00154     namespace internal {
00155         using ::int8_t;
00156         using ::int16_t;
00157         using ::int32_t;
00158         using ::int64_t;
00159         using ::uint8_t;
00160         using ::uint16_t;
00161         using ::uint32_t;
00162         using ::uint64_t;
00163     } // namespace internal
00164 #endif /* Posix */
00165 
00166     using std::size_t;
00167     using std::ptrdiff_t;
00168 
00170     typedef void(*assertion_handler_type)( const char* filename, int line, const char* expression, const char * comment );
00171 
00172 #if TBB_USE_ASSERT
00173 
00175 
00178     #define __TBB_ASSERT(predicate,message) ((predicate)?((void)0):tbb::assertion_failure(__FILE__,__LINE__,#predicate,message))
00179     #define __TBB_ASSERT_EX __TBB_ASSERT
00180 
00182     assertion_handler_type __TBB_EXPORTED_FUNC set_assertion_handler( assertion_handler_type new_handler );
00183 
00185 
00188     void __TBB_EXPORTED_FUNC assertion_failure( const char* filename, int line, const char* expression, const char* comment );
00189 
00190 #else /* !TBB_USE_ASSERT */
00191 
00193     #define __TBB_ASSERT(predicate,comment) ((void)0)
00195     #define __TBB_ASSERT_EX(predicate,comment) ((void)(1 && (predicate)))
00196 
00197 #endif /* !TBB_USE_ASSERT */
00198 
00200 
00204 extern "C" int __TBB_EXPORTED_FUNC TBB_runtime_interface_version();
00205 
00207 
00211 class split {
00212 };
00213 
00218 namespace internal {
00219 
00221 
00224 const size_t NFS_MaxLineSize = 128;
00225 
00245 #define __TBB_atomic // intentionally empty, see above
00246 
00247 template<class T, int S>
00248 struct padded_base : T {
00249     char pad[NFS_MaxLineSize - sizeof(T) % NFS_MaxLineSize];
00250 };
00251 template<class T> struct padded_base<T, 0> : T {};
00252 
00254 template<class T>
00255 struct padded : padded_base<T, sizeof(T)> {};
00256 
00258 
00260 #define __TBB_offsetof(class_name, member_name) \
00261     ((ptrdiff_t)&(reinterpret_cast<class_name*>(0x1000)->member_name) - 0x1000)
00262 
00264 #define __TBB_get_object_ref(class_name, member_name, member_addr) \
00265     (*reinterpret_cast<class_name*>((char*)member_addr - __TBB_offsetof(class_name, member_name)))
00266 
00268 void __TBB_EXPORTED_FUNC handle_perror( int error_code, const char* aux_info );
00269 
00270 #if TBB_USE_EXCEPTIONS
00271     #define __TBB_TRY try
00272     #define __TBB_CATCH(e) catch(e)
00273     #define __TBB_THROW(e) throw e
00274     #define __TBB_RETHROW() throw
00275 #else /* !TBB_USE_EXCEPTIONS */
00276     inline bool __TBB_false() { return false; }
00277     #define __TBB_TRY
00278     #define __TBB_CATCH(e) if ( tbb::internal::__TBB_false() )
00279     #define __TBB_THROW(e) ((void)0)
00280     #define __TBB_RETHROW() ((void)0)
00281 #endif /* !TBB_USE_EXCEPTIONS */
00282 
00284 void __TBB_EXPORTED_FUNC runtime_warning( const char* format, ... );
00285 
00286 #if TBB_USE_ASSERT
00287 static void* const poisoned_ptr = reinterpret_cast<void*>(-1);
00288 
00290 template<typename T>
00291 inline void poison_pointer( T*& p ) { p = reinterpret_cast<T*>(poisoned_ptr); }
00292 
00294 template<typename T>
00295 inline bool is_poisoned( T* p ) { return p == reinterpret_cast<T*>(poisoned_ptr); }
00296 #else
00297 template<typename T>
00298 inline void poison_pointer( T* ) {/*do nothing*/}
00299 #endif /* !TBB_USE_ASSERT */
00300 
00302 
00304 template<typename T, typename U> 
00305 inline T punned_cast( U* ptr ) {
00306     uintptr_t x = reinterpret_cast<uintptr_t>(ptr);
00307     return reinterpret_cast<T>(x);
00308 }
00309 
00311 class no_assign {
00312     // Deny assignment
00313     void operator=( const no_assign& );
00314 public:
00315 #if __GNUC__
00317     no_assign() {}
00318 #endif /* __GNUC__ */
00319 };
00320 
00322 class no_copy: no_assign {
00324     no_copy( const no_copy& );
00325 public:
00327     no_copy() {}
00328 };
00329 
00331 template<typename T>
00332 struct allocator_type {
00333     typedef T value_type;
00334 };
00335 
00336 #if _MSC_VER
00338 template<typename T>
00339 struct allocator_type<const T> {
00340     typedef T value_type;
00341 };
00342 #endif
00343 
00344 // Struct to be used as a version tag for inline functions.
00347 struct version_tag_v3 {};
00348 
00349 typedef version_tag_v3 version_tag;
00350 
00351 } // internal
00353 
00354 } // tbb
00355 
00356 #endif /* RC_INVOKED */
00357 #endif /* __TBB_tbb_stddef_H */

Copyright © 2005-2011 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.