00001 /****************************************************************************** 00002 ** Copyright (c) 1992-2010 VT MAK 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 00008 00009 #ifndef lgrFileFormatProvider_H_ 00010 #define lgrFileFormatProvider_H_ 00011 00012 #include "lgrCore.h" 00013 #include <map> 00014 00015 namespace MAKLogger 00016 { 00017 class DtLoggerFile; 00018 class DtLgrFileFormatter; 00019 00023 class DT_DLL_LGRCORE DtLgrFileFormatProvider 00024 { 00025 public: 00027 typedef DtLgrFileFormatter* (*FormatCreator)(DtLoggerFile* file); 00028 00030 static DtLgrFileFormatProvider& globalInstance(); 00031 00032 protected: 00034 DtLgrFileFormatProvider(); 00035 00036 public: 00038 ~DtLgrFileFormatProvider(); 00039 00041 int latestVersion() const; 00042 00045 DtLgrFileFormatter* createFormatter(DtLoggerFile*) const; 00046 00048 void registerFormat(int fileVersion, FormatCreator function); 00049 00051 void setLatestFileFormat(int fileVersion); 00052 00053 protected: 00055 static DtLgrFileFormatProvider theGlobalInstance; 00056 00058 typedef std::map<int,FormatCreator> FormatterCreatorMap; 00059 00061 FormatterCreatorMap myCreatorMap; 00062 00064 int myLatestFileFormat; 00065 00066 }; 00067 } 00068 00069 #endif