logCtrl.h
Go to the documentation of this file.00001 #ifndef LOG_CTRL_H
00002 #define LOG_CTRL_H
00003
00013 #include <SDL.h>
00014 #include <fstream>
00015 #include <string>
00016
00017
00024 class LogCtrl {
00025 SDL_mutex* mutex;
00026 const char *logfile;
00027 bool moduleTagTerminated;
00028 std::string now_stream;
00029 int now_line;
00030 std::string line;
00031 void terminateModuleTag(void);
00032 const char* readLine(void);
00033 void readModuleTag(const char* line);
00034 bool checkModuleEnd(const char* line);
00035 void throwMissmathException(void);
00036 std::ifstream* fin;
00037
00038 public:
00039 FILE* fd;
00046 const char* getLineBuffer(void);
00047
00054 LogCtrl(const char *fname, bool write);
00055 ~LogCtrl(void);
00056
00060 void lock(void);
00061
00065 void unlock(void);
00066
00070 void flush(void);
00071
00079 void writeTag(const char *module, const char* command, unsigned long ticks);
00080
00084 void writeTagEnd(void);
00085
00092 unsigned long readTag(const char *module, const char* command);
00093 };
00094
00095 #endif
00096