yapf.hpp

00001 /* $Id: yapf.hpp 11968 2008-01-23 22:34:04Z smatz $ */
00002 
00003 #ifndef  YAPF_HPP
00004 #define  YAPF_HPP
00005 
00006 
00007 
00008 #include "track_dir.hpp"
00009 
00010 #include "../vehicle_base.h"
00011 #include "../depot.h"
00012 #include "../road_map.h"
00013 #include "../tunnel_map.h"
00014 #include "../bridge_map.h"
00015 #include "../tunnelbridge_map.h"
00016 #include "../bridge.h"
00017 #include "../station.h"
00018 #include "../station_map.h"
00019 #include "../tile_cmd.h"
00020 #include "../landscape.h"
00021 #include "yapf.h"
00022 #include "../pathfind.h"
00023 #include "../waypoint.h"
00024 #include "../debug.h"
00025 #include "../settings_type.h"
00026 #include "../tunnelbridge.h"
00027 
00028 extern uint64 _rdtsc();
00029 
00030 #include <limits.h>
00031 #include <new>
00032 
00033 #if defined(_WIN32) || defined(_WIN64)
00034 #  include <windows.h>
00035 #else
00036 #  include <time.h>
00037 #endif
00038 
00039 struct CPerformanceTimer
00040 {
00041   int64    m_start;
00042   int64    m_acc;
00043 
00044   CPerformanceTimer() : m_start(0), m_acc(0) {}
00045 
00046   FORCEINLINE void Start() {m_start = QueryTime();}
00047   FORCEINLINE void Stop() {m_acc += QueryTime() - m_start;}
00048   FORCEINLINE int Get(int64 coef) {return (int)(m_acc * coef / QueryFrequency());}
00049 
00050   FORCEINLINE int64 QueryTime() {return _rdtsc();}
00051   FORCEINLINE int64 QueryFrequency() {return ((int64)2200 * 1000000);}
00052 };
00053 
00054 struct CPerfStartReal
00055 {
00056   CPerformanceTimer* m_pperf;
00057 
00058   FORCEINLINE CPerfStartReal(CPerformanceTimer& perf) : m_pperf(&perf) {if (m_pperf != NULL) m_pperf->Start();}
00059   FORCEINLINE ~CPerfStartReal() {Stop();}
00060   FORCEINLINE void Stop() {if (m_pperf != NULL) {m_pperf->Stop(); m_pperf = NULL;}}
00061 };
00062 
00063 struct CPerfStartFake
00064 {
00065   FORCEINLINE CPerfStartFake(CPerformanceTimer& perf) {}
00066   FORCEINLINE ~CPerfStartFake() {}
00067   FORCEINLINE void Stop() {}
00068 };
00069 
00070 typedef CPerfStartFake CPerfStart;
00071 
00072 
00073 //#undef FORCEINLINE
00074 //#define FORCEINLINE inline
00075 
00076 #include "../misc/crc32.hpp"
00077 #include "../misc/blob.hpp"
00078 #include "../misc/str.hpp"
00079 #include "../misc/fixedsizearray.hpp"
00080 #include "../misc/array.hpp"
00081 #include "../misc/hashtable.hpp"
00082 #include "../misc/binaryheap.hpp"
00083 #include "../misc/dbg_helpers.h"
00084 #include "nodelist.hpp"
00085 #include "follow_track.hpp"
00086 #include "yapf_base.hpp"
00087 #include "yapf_node.hpp"
00088 #include "yapf_common.hpp"
00089 #include "yapf_costbase.hpp"
00090 #include "yapf_costcache.hpp"
00091 
00092 
00093 #endif /* YAPF_HPP */

Generated on Mon Sep 22 20:34:20 2008 for openttd by  doxygen 1.5.6