# OgrePrerequisites.h

Go to the documentation of this file.

    00001 /*-------------------------------------------------------------------------
    00002 This source file is a part of OGRE
    00003 (Object-oriented Graphics Rendering Engine)
    00004
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright (c) 2000-2009 Torus Knot Software Ltd
    00008 Permission is hereby granted, free of charge, to any person obtaining a copy
    00009 of this software and associated documentation files (the "Software"), to deal
    00010 in the Software without restriction, including without limitation the rights
    00011 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00012 copies of the Software, and to permit persons to whom the Software is
    00013 furnished to do so, subject to the following conditions:
    00014
    00015 The above copyright notice and this permission notice shall be included in
    00016 all copies or substantial portions of the Software.
    00017
    00018 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00019 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00020 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    00021 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00022 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    00023 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    00024 THE SOFTWARE
    00025 -------------------------------------------------------------------------*/
    00026 #ifndef __OgrePrerequisites_H__
    00027 #define __OgrePrerequisites_H__
    00028
    00029 // Platform-specific stuff
    00030 #include "OgrePlatform.h"
    00031
    00032 // Needed for OGRE_WCHAR_T_STRINGS below
    00033 #include <string>
    00034
    00035
    00036 // configure memory tracking
    00037 #if OGRE_DEBUG_MODE
    00038 #   if OGRE_MEMORY_TRACKER_DEBUG_MODE
    00039 #       define OGRE_MEMORY_TRACKER 1
    00040 #   else
    00041 #       define OGRE_MEMORY_TRACKER 0
    00042 #   endif
    00043 #else
    00044 #   if OGRE_MEMORY_TRACKER_RELEASE_MODE
    00045 #       define OGRE_MEMORY_TRACKER 1
    00046 #   else
    00047 #       define OGRE_MEMORY_TRACKER 0
    00048 #   endif
    00049 #endif
    00050
    00051
    00052
    00053
    00054 namespace Ogre {
    00055     // Define ogre version
    00056     #define OGRE_VERSION_MAJOR 1
    00057     #define OGRE_VERSION_MINOR 7
    00058     #define OGRE_VERSION_PATCH 2
    00059     #define OGRE_VERSION_SUFFIX ""
    00060     #define OGRE_VERSION_NAME "Cthugha"
    00061
    00062     #define OGRE_VERSION    ((OGRE_VERSION_MAJOR << 16) | (OGRE_VERSION_MINOR << 8) | OGRE_VERSION_PATCH)
    00063
    00064     // define the real number values to be used
    00065     // default to use 'float' unless precompiler option set
    00066     #if OGRE_DOUBLE_PRECISION == 1
    00067
    00070         typedef double Real;
    00071     #else
    00072
    00075         typedef float Real;
    00076     #endif
    00077
    00078     #if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310 && !defined(STLPORT)
    00079     #   if OGRE_COMP_VER >= 430
    00080     #       define HashMap ::std::tr1::unordered_map
    00081     #       define HashSet ::std::tr1::unordered_set
    00082     #    else
    00083     #       define HashMap ::__gnu_cxx::hash_map
    00084     #       define HashSet ::__gnu_cxx::hash_set
    00085     #    endif
    00086     #else
    00087     #   if OGRE_COMPILER == OGRE_COMPILER_MSVC
    00088     #       if OGRE_COMP_VER >= 1600 // VC++ 10.0
    00089     #           define HashMap ::std::tr1::unordered_map
    00090     #           define HashSet ::std::tr1::unordered_set
    00091     #       elif OGRE_COMP_VER > 1300 && !defined(_STLP_MSVC)
    00092     #           define HashMap ::stdext::hash_map
    00093     #           define HashSet ::stdext::hash_set
    00094     #       else
    00095     #           define HashMap ::std::hash_map
    00096     #           define HashSet ::std::hash_set
    00097     #       endif
    00098     #   else
    00099     #       define HashMap ::std::hash_map
    00100     #       define HashSet ::std::hash_set
    00101     #   endif
    00102     #endif
    00103
    00106     typedef unsigned char uchar;
    00107     typedef unsigned short ushort;
    00108     typedef unsigned int uint;
    00109     typedef unsigned long ulong;
    00110
    00111
    00112     // Useful threading defines
    00113 #include "Threading/OgreThreadDefines.h"
    00114
    00115 // Pre-declare classes
    00116 // Allows use of pointers in header files without including individual .h
    00117 // so decreases dependencies between files
    00118     class Angle;
    00119     class Animation;
    00120     class AnimationState;
    00121     class AnimationStateSet;
    00122     class AnimationTrack;
    00123     class Archive;
    00124     class ArchiveFactory;
    00125     class ArchiveManager;
    00126     class AutoParamDataSource;
    00127     class AxisAlignedBox;
    00128     class AxisAlignedBoxSceneQuery;
    00129     class Billboard;
    00130     class BillboardChain;
    00131     class BillboardSet;
    00132     class Bone;
    00133     class Camera;
    00134     class Codec;
    00135     class ColourValue;
    00136     class ConfigDialog;
    00137     template <typename T> class Controller;
    00138     template <typename T> class ControllerFunction;
    00139     class ControllerManager;
    00140     template <typename T> class ControllerValue;
    00141     class DefaultWorkQueue;
    00142     class Degree;
    00143     class DynLib;
    00144     class DynLibManager;
    00145     class EdgeData;
    00146     class EdgeListBuilder;
    00147     class Entity;
    00148     class ErrorDialog;
    00149     class ExternalTextureSourceManager;
    00150     class Factory;
    00151     class Font;
    00152     class FontPtr;
    00153     class FontManager;
    00154     struct FrameEvent;
    00155     class FrameListener;
    00156     class Frustum;
    00157     class GpuProgram;
    00158     class GpuProgramPtr;
    00159     class GpuProgramManager;
    00160     class GpuProgramUsage;
    00161     class HardwareIndexBuffer;
    00162     class HardwareOcclusionQuery;
    00163     class HardwareVertexBuffer;
    00164     class HardwarePixelBuffer;
    00165     class HardwarePixelBufferSharedPtr;
    00166     class HighLevelGpuProgram;
    00167     class HighLevelGpuProgramPtr;
    00168     class HighLevelGpuProgramManager;
    00169     class HighLevelGpuProgramFactory;
    00170     class IndexData;
    00171     class IntersectionSceneQuery;
    00172     class IntersectionSceneQueryListener;
    00173     class Image;
    00174     class KeyFrame;
    00175     class Light;
    00176     class Log;
    00177     class LogManager;
    00178     class ManualResourceLoader;
    00179     class ManualObject;
    00180     class Material;
    00181     class MaterialPtr;
    00182     class MaterialManager;
    00183     class Math;
    00184     class Matrix3;
    00185     class Matrix4;
    00186     class MemoryManager;
    00187     class Mesh;
    00188     class MeshPtr;
    00189     class MeshSerializer;
    00190     class MeshSerializerImpl;
    00191     class MeshManager;
    00192     class MovableObject;
    00193     class MovablePlane;
    00194     class Node;
    00195     class NodeAnimationTrack;
    00196     class NodeKeyFrame;
    00197     class NumericAnimationTrack;
    00198     class NumericKeyFrame;
    00199     class Overlay;
    00200     class OverlayContainer;
    00201     class OverlayElement;
    00202     class OverlayElementFactory;
    00203     class OverlayManager;
    00204     class Particle;
    00205     class ParticleAffector;
    00206     class ParticleAffectorFactory;
    00207     class ParticleEmitter;
    00208     class ParticleEmitterFactory;
    00209     class ParticleSystem;
    00210     class ParticleSystemManager;
    00211     class ParticleSystemRenderer;
    00212     class ParticleSystemRendererFactory;
    00213     class ParticleVisualData;
    00214     class Pass;
    00215     class PatchMesh;
    00216     class PixelBox;
    00217     class Plane;
    00218     class PlaneBoundedVolume;
    00219     class Plugin;
    00220     class Pose;
    00221     class ProgressiveMesh;
    00222     class Profile;
    00223     class Profiler;
    00224     class Quaternion;
    00225     class Radian;
    00226     class Ray;
    00227     class RaySceneQuery;
    00228     class RaySceneQueryListener;
    00229     class Renderable;
    00230     class RenderPriorityGroup;
    00231     class RenderQueue;
    00232     class RenderQueueGroup;
    00233     class RenderQueueInvocation;
    00234     class RenderQueueInvocationSequence;
    00235     class RenderQueueListener;
    00236     class RenderObjectListener;
    00237     class RenderSystem;
    00238     class RenderSystemCapabilities;
    00239     class RenderSystemCapabilitiesManager;
    00240     class RenderSystemCapabilitiesSerializer;
    00241     class RenderTarget;
    00242     class RenderTargetListener;
    00243     class RenderTexture;
    00244     class MultiRenderTarget;
    00245     class RenderWindow;
    00246     class RenderOperation;
    00247     class Resource;
    00248     class ResourceBackgroundQueue;
    00249     class ResourceGroupManager;
    00250     class ResourceManager;
    00251     class RibbonTrail;
    00252     class Root;
    00253     class SceneManager;
    00254     class SceneManagerEnumerator;
    00255     class SceneNode;
    00256     class SceneQuery;
    00257     class SceneQueryListener;
    00258     class ScriptCompiler;
    00259     class ScriptCompilerManager;
    00260     class ScriptLoader;
    00261     class Serializer;
    00262     class ShadowCaster;
    00263     class ShadowRenderable;
    00264     class ShadowTextureManager;
    00265     class SimpleRenderable;
    00266     class SimpleSpline;
    00267     class Skeleton;
    00268     class SkeletonPtr;
    00269     class SkeletonInstance;
    00270     class SkeletonManager;
    00271     class Sphere;
    00272     class SphereSceneQuery;
    00273     class StaticGeometry;
    00274     class StreamSerialiser;
    00275     class StringConverter;
    00276     class StringInterface;
    00277     class SubEntity;
    00278     class SubMesh;
    00279     class TagPoint;
    00280     class Technique;
    00281     class TempBlendedBufferInfo;
    00282     class ExternalTextureSource;
    00283     class TextureUnitState;
    00284     class Texture;
    00285     class TexturePtr;
    00286     class TextureManager;
    00287     class TransformKeyFrame;
    00288     class Timer;
    00289     class UserObjectBindings;
    00290     class Vector2;
    00291     class Vector3;
    00292     class Vector4;
    00293     class Viewport;
    00294     class VertexAnimationTrack;
    00295     class VertexBufferBinding;
    00296     class VertexData;
    00297     class VertexDeclaration;
    00298     class VertexMorphKeyFrame;
    00299     class WireBoundingBox;
    00300     class WorkQueue;
    00301     class Compositor;
    00302     class CompositorManager;
    00303     class CompositorChain;
    00304     class CompositorInstance;
    00305     class CompositorLogic;
    00306     class CompositionTechnique;
    00307     class CompositionPass;
    00308     class CompositionTargetPass;
    00309     class CustomCompositionPass;
    00310 }
    00311
    00312 /* Include all the standard header *after* all the configuration
    00313 settings have been made.
    00314 */
    00315 #include "OgreStdHeaders.h"
    00316 #include "OgreMemoryAllocatorConfig.h"
    00317
    00318
    00319 namespace Ogre
    00320 {
    00321 #if OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR
    00322     #if OGRE_WCHAR_T_STRINGS
    00323         typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, STLAllocator<wchar_t,GeneralAllocPolicy > >   _StringBase;
    00324     #else
    00325         typedef std::basic_string<char, std::char_traits<char>, STLAllocator<char,GeneralAllocPolicy > >    _StringBase;
    00326     #endif
    00327
    00328     #if OGRE_WCHAR_T_STRINGS
    00329         typedef std::basic_stringstream<wchar_t,std::char_traits<wchar_t>,STLAllocator<wchar_t,GeneralAllocPolicy >> _StringStreamBase;
    00330     #else
    00331         typedef std::basic_stringstream<char,std::char_traits<char>,STLAllocator<char,GeneralAllocPolicy > > _StringStreamBase;
    00332     #endif
    00333
    00334     #define StdStringT(T) std::basic_string<T, std::char_traits<T>, std::allocator<T> >
    00335     #define CustomMemoryStringT(T) std::basic_string<T, std::char_traits<T>, STLAllocator<T,GeneralAllocPolicy> >
    00336
    00337     template<typename T>
    00338     bool operator <(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00339     {
    00340         return l.compare(0,l.length(),o.c_str(),o.length())<0;
    00341     }
    00342     template<typename T>
    00343     bool operator <(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00344     {
    00345         return l.compare(0,l.length(),o.c_str(),o.length())<0;
    00346     }
    00347     template<typename T>
    00348     bool operator <=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00349     {
    00350         return l.compare(0,l.length(),o.c_str(),o.length())<=0;
    00351     }
    00352     template<typename T>
    00353     bool operator <=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00354     {
    00355         return l.compare(0,l.length(),o.c_str(),o.length())<=0;
    00356     }
    00357     template<typename T>
    00358     bool operator >(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00359     {
    00360         return l.compare(0,l.length(),o.c_str(),o.length())>0;
    00361     }
    00362     template<typename T>
    00363     bool operator >(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00364     {
    00365         return l.compare(0,l.length(),o.c_str(),o.length())>0;
    00366     }
    00367     template<typename T>
    00368     bool operator >=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00369     {
    00370         return l.compare(0,l.length(),o.c_str(),o.length())>=0;
    00371     }
    00372     template<typename T>
    00373     bool operator >=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00374     {
    00375         return l.compare(0,l.length(),o.c_str(),o.length())>=0;
    00376     }
    00377
    00378     template<typename T>
    00379     bool operator ==(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00380     {
    00381         return l.compare(0,l.length(),o.c_str(),o.length())==0;
    00382     }
    00383     template<typename T>
    00384     bool operator ==(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00385     {
    00386         return l.compare(0,l.length(),o.c_str(),o.length())==0;
    00387     }
    00388
    00389     template<typename T>
    00390     bool operator !=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00391     {
    00392         return l.compare(0,l.length(),o.c_str(),o.length())!=0;
    00393     }
    00394     template<typename T>
    00395     bool operator !=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00396     {
    00397         return l.compare(0,l.length(),o.c_str(),o.length())!=0;
    00398     }
    00399
    00400     template<typename T>
    00401     CustomMemoryStringT(T) operator +=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00402     {
    00403         return CustomMemoryStringT(T)(l)+=o.c_str();
    00404     }
    00405     template<typename T>
    00406     CustomMemoryStringT(T) operator +=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00407     {
    00408         return CustomMemoryStringT(T)(l.c_str())+=o.c_str();
    00409     }
    00410
    00411     template<typename T>
    00412     CustomMemoryStringT(T) operator +(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00413     {
    00414         return CustomMemoryStringT(T)(l)+=o.c_str();
    00415     }
    00416
    00417     template<typename T>
    00418     CustomMemoryStringT(T) operator +(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00419     {
    00420         return CustomMemoryStringT(T)(l.c_str())+=o.c_str();
    00421     }
    00422
    00423     template<typename T>
    00424     CustomMemoryStringT(T) operator +(const T* l,const CustomMemoryStringT(T)& o)
    00425     {
    00426         return CustomMemoryStringT(T)(l)+=o;
    00427     }
    00428
    00429     #undef StdStringT
    00430     #undef CustomMemoryStringT
    00431
    00432 #else
    00433     #if OGRE_WCHAR_T_STRINGS
    00434         typedef std::wstring _StringBase;
    00435     #else
    00436         typedef std::string _StringBase;
    00437     #endif
    00438
    00439     #if OGRE_WCHAR_T_STRINGS
    00440         typedef std::basic_stringstream<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > _StringStreamBase;
    00441     #else
    00442         typedef std::basic_stringstream<char,std::char_traits<char>,std::allocator<char> > _StringStreamBase;
    00443     #endif
    00444
    00445 #endif
    00446
    00447     typedef _StringBase String;
    00448     typedef _StringStreamBase StringStream;
    00449     typedef StringStream stringstream;
    00450
    00451 }
    00452
    00453 //for stl containter
    00454 namespace Ogre
    00455 {
    00456     template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> >
    00457     struct deque
    00458     {
    00459 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00460        typedef typename std::deque<T, A> type;
    00461 #else
    00462         typedef typename std::deque<T> type;
    00463 #endif
    00464     };
    00465
    00466     template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> >
    00467     struct vector
    00468     {
    00469 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00470         typedef typename std::vector<T, A> type;
    00471 #else
    00472         typedef typename std::vector<T> type;
    00473 #endif
    00474     };
    00475
    00476     template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> >
    00477     struct list
    00478     {
    00479 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00480        typedef typename std::list<T, A> type;
    00481 #else
    00482         typedef typename std::list<T> type;
    00483 #endif
    00484     };
    00485
    00486     template <typename T, typename P = std::less<T>, typename A = STLAllocator<T, GeneralAllocPolicy> >
    00487     struct set
    00488     {
    00489 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00490        typedef typename std::set<T, P, A> type;
    00491 #else
    00492         typedef typename std::set<T, P> type;
    00493 #endif
    00494     };
    00495
    00496     template <typename K, typename V, typename P = std::less<K>, typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> >
    00497     struct map
    00498     {
    00499 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00500        typedef typename std::map<K, V, P, A> type;
    00501 #else
    00502         typedef typename std::map<K, V, P> type;
    00503 #endif
    00504     };
    00505
    00506     template <typename K, typename V, typename P = std::less<K>, typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> >
    00507     struct multimap
    00508     {
    00509 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00510         typedef typename std::multimap<K, V, P, A> type;
    00511 #else
    00512         typedef typename std::multimap<K, V, P> type;
    00513 #endif
    00514     };
    00515
    00516 } // Ogre
    00517
    00518 #endif // __OgrePrerequisites_H__
    00519
    00520

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Nov 3 2010 19:24:52