26 #ifndef __OgrePrerequisites_H__
27 #define __OgrePrerequisites_H__
38 # if OGRE_MEMORY_TRACKER_DEBUG_MODE
39 # define OGRE_MEMORY_TRACKER 1
41 # define OGRE_MEMORY_TRACKER 0
44 # if OGRE_MEMORY_TRACKER_RELEASE_MODE
45 # define OGRE_MEMORY_TRACKER 1
47 # define OGRE_MEMORY_TRACKER 0
56 #define OGRE_VERSION_MAJOR 1
57 #define OGRE_VERSION_MINOR 9
58 #define OGRE_VERSION_PATCH 0
59 #define OGRE_VERSION_SUFFIX "unstable"
60 #define OGRE_VERSION_NAME "Ghadamon"
62 #define OGRE_VERSION ((OGRE_VERSION_MAJOR << 16) | (OGRE_VERSION_MINOR << 8) | OGRE_VERSION_PATCH)
66 #if OGRE_DOUBLE_PRECISION == 1
78 #if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310 && !defined(STLPORT)
79 # if OGRE_COMP_VER >= 430
80 # define HashMap ::std::tr1::unordered_map
81 # define HashSet ::std::tr1::unordered_set
83 # define HashMap ::__gnu_cxx::hash_map
84 # define HashSet ::__gnu_cxx::hash_set
86 #elif OGRE_COMPILER == OGRE_COMPILER_CLANG
87 # if defined(_LIBCPP_VERSION)
88 # define HashMap ::std::unordered_map
89 # define HashSet ::std::unordered_set
91 # define HashMap ::std::tr1::unordered_map
92 # define HashSet ::std::tr1::unordered_set
95 # if OGRE_COMPILER == OGRE_COMPILER_MSVC && !defined(_STLP_MSVC)
96 # if _MSC_FULL_VER >= 150030729 // VC++ 9.0 SP1+
97 # define HashMap ::std::tr1::unordered_map
98 # define HashSet ::std::tr1::unordered_set
99 # elif OGRE_THREAD_PROVIDER == 1
100 # define HashMap ::boost::unordered_map
101 # define HashSet ::boost::unordered_set
103 # define HashMap ::std::unordered_map
104 # define HashSet ::std::unordered_set
107 # define HashMap ::std::unordered_map
108 # define HashSet ::std::unordered_set
112 #define OGRE_DEFINE_STATIC_LOCAL(type, name, arguments) \
113 static type& name = *new type arguments
336 #if OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR
337 #if OGRE_WCHAR_T_STRINGS
338 typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, STLAllocator<wchar_t,GeneralAllocPolicy > >
_StringBase;
340 typedef std::basic_string<char, std::char_traits<char>, STLAllocator<char,GeneralAllocPolicy > >
_StringBase;
343 #if OGRE_WCHAR_T_STRINGS
344 typedef std::basic_stringstream<wchar_t,std::char_traits<wchar_t>,STLAllocator<wchar_t,GeneralAllocPolicy >>
_StringStreamBase;
346 typedef std::basic_stringstream<char,std::char_traits<char>,STLAllocator<char,GeneralAllocPolicy > >
_StringStreamBase;
349 #define StdStringT(T) std::basic_string<T, std::char_traits<T>, std::allocator<T> >
350 #define CustomMemoryStringT(T) std::basic_string<T, std::char_traits<T>, STLAllocator<T,GeneralAllocPolicy> >
353 bool operator <(
const CustomMemoryStringT(T)& l,
const StdStringT(T)& o)
355 return l.compare(0,l.length(),o.c_str(),o.length())<0;
358 bool operator <(
const StdStringT(T)& l,
const CustomMemoryStringT(T)& o)
360 return l.compare(0,l.length(),o.c_str(),o.length())<0;
363 bool operator <=(
const CustomMemoryStringT(T)& l,
const StdStringT(T)& o)
365 return l.compare(0,l.length(),o.c_str(),o.length())<=0;
368 bool operator <=(
const StdStringT(T)& l,
const CustomMemoryStringT(T)& o)
370 return l.compare(0,l.length(),o.c_str(),o.length())<=0;
373 bool operator >(
const CustomMemoryStringT(T)& l,
const StdStringT(T)& o)
375 return l.compare(0,l.length(),o.c_str(),o.length())>0;
378 bool operator >(
const StdStringT(T)& l,
const CustomMemoryStringT(T)& o)
380 return l.compare(0,l.length(),o.c_str(),o.length())>0;
383 bool operator >=(
const CustomMemoryStringT(T)& l,
const StdStringT(T)& o)
385 return l.compare(0,l.length(),o.c_str(),o.length())>=0;
388 bool operator >=(
const StdStringT(T)& l,
const CustomMemoryStringT(T)& o)
390 return l.compare(0,l.length(),o.c_str(),o.length())>=0;
394 bool operator ==(
const CustomMemoryStringT(T)& l,
const StdStringT(T)& o)
396 return l.compare(0,l.length(),o.c_str(),o.length())==0;
399 bool operator ==(
const StdStringT(T)& l,
const CustomMemoryStringT(T)& o)
401 return l.compare(0,l.length(),o.c_str(),o.length())==0;
405 bool operator !=(
const CustomMemoryStringT(T)& l,
const StdStringT(T)& o)
407 return l.compare(0,l.length(),o.c_str(),o.length())!=0;
410 bool operator !=(
const StdStringT(T)& l,
const CustomMemoryStringT(T)& o)
412 return l.compare(0,l.length(),o.c_str(),o.length())!=0;
416 CustomMemoryStringT(T) operator +=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
418 return CustomMemoryStringT(T)(l)+=o.c_str();
421 CustomMemoryStringT(T) operator +=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
423 return CustomMemoryStringT(T)(l.c_str())+=o.c_str();
427 CustomMemoryStringT(T) operator +(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
429 return CustomMemoryStringT(T)(l)+=o.c_str();
433 CustomMemoryStringT(T) operator +(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
435 return CustomMemoryStringT(T)(l.c_str())+=o.c_str();
439 CustomMemoryStringT(T) operator +(const T* l,const CustomMemoryStringT(T)& o)
441 return CustomMemoryStringT(T)(l)+=o;
445 #undef CustomMemoryStringT
448 #if OGRE_WCHAR_T_STRINGS
454 #if OGRE_WCHAR_T_STRINGS
455 typedef std::basic_stringstream<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >
_StringStreamBase;
457 typedef std::basic_stringstream<char,std::char_traits<char>,std::allocator<char> >
_StringStreamBase;
468 #if OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR
471 #if (OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 430) || OGRE_COMPILER == OGRE_COMPILER_CLANG && !defined(STLPORT) && __cplusplus < 201103L
475 template <>
struct hash<Ogre::
String>
480 size_t _Val = 2166136261U;
482 size_t _Last = str.size();
483 size_t _Stride = 1 + _Last / 10;
485 for(; _First < _Last; _First += _Stride)
486 _Val = 16777619U * _Val ^ (
size_t)str[_First];
490 #if (OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 430) || OGRE_COMPILER == OGRE_COMPILER_CLANG && !defined(STLPORT) && __cplusplus < 201103L
499 template <
typename T,
typename A = STLAllocator<T, GeneralAllocPolicy> >
502 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
503 typedef typename std::deque<T, A>
type;
504 typedef typename std::deque<T, A>::iterator
iterator;
507 typedef typename std::deque<T>
type;
508 typedef typename std::deque<T>::iterator
iterator;
513 template <
typename T,
typename A = STLAllocator<T, GeneralAllocPolicy> >
516 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
517 typedef typename std::vector<T, A>
type;
518 typedef typename std::vector<T, A>::iterator
iterator;
521 typedef typename std::vector<T>
type;
522 typedef typename std::vector<T>::iterator
iterator;
527 template <
typename T,
typename A = STLAllocator<T, GeneralAllocPolicy> >
530 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
531 typedef typename std::list<T, A>
type;
532 typedef typename std::list<T, A>::iterator
iterator;
535 typedef typename std::list<T>
type;
536 typedef typename std::list<T>::iterator
iterator;
541 template <
typename T,
typename P = std::less<T>,
typename A = STLAllocator<T, GeneralAllocPolicy> >
544 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
545 typedef typename std::set<T, P, A>
type;
546 typedef typename std::set<T, P, A>::iterator
iterator;
549 typedef typename std::set<T, P>
type;
550 typedef typename std::set<T, P>::iterator
iterator;
555 template <
typename K,
typename V,
typename P = std::less<K>,
typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> >
558 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
559 typedef typename std::map<K, V, P, A>
type;
560 typedef typename std::map<K, V, P, A>::iterator
iterator;
563 typedef typename std::map<K, V, P>
type;
564 typedef typename std::map<K, V, P>::iterator
iterator;
565 typedef typename std::map<K, V, P>::const_iterator
const_iterator;
569 template <
typename K,
typename V,
typename P = std::less<K>,
typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> >
572 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
573 typedef typename std::multimap<K, V, P, A>
type;
574 typedef typename std::multimap<K, V, P, A>::iterator
iterator;
577 typedef typename std::multimap<K, V, P>
type;
578 typedef typename std::multimap<K, V, P>::iterator
iterator;
579 typedef typename std::multimap<K, V, P>::const_iterator
const_iterator;
585 #endif // __OgrePrerequisites_H__