BWAPI
AiLogger.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include <stdio.h>
00004 #include <time.h>
00005 #include <string>
00006 #include <map>
00007 
00008 using namespace std;
00009 
00010 class AiLogger
00011 {
00012         FILE* _logFile;
00013 
00014         bool _disabled;
00015 
00016 public:
00017         AiLogger(const char* filename, bool disabled = false);
00018         virtual ~AiLogger(void);
00019 
00020         void Log(const char* text);
00021 };
00022 
00023 struct Timer
00024 {
00025         clock_t startTime;
00026         clock_t checkTime;
00027         clock_t timespan;
00028         clock_t longestTimespan;
00029 
00030         Timer() : longestTimespan(0) {}
00031 
00032         void start();
00033         void check();
00034 };
00035 
00036 typedef map<string, Timer*> TimerMap;
00037 
00038 class TimerCollector
00039 {
00040         AiLogger* _logger;
00041         TimerMap _timers;
00042 
00043 public:
00044         TimerCollector(AiLogger* logger);
00045         ~TimerCollector();
00046 
00047         Timer* StartTimer(string timerId);
00048         Timer* CheckTimer(string timerId);
00049 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines