00001
00002 #ifndef UTIL_LCWARNING_H
00003 #define UTIL_LCWARNING_H 1
00004
00005 #include<map>
00006 #include<string>
00007 #include<iostream>
00008
00009 namespace UTIL {
00010
00020 class LCWarning {
00021 public:
00022
00023 static LCWarning& getInstance();
00024
00031 void registerWarning( const std::string& id, const std::string& txt, int max=10 ) ;
00032
00034 void printWarning( const std::string& id ) ;
00035
00036 private:
00037
00038 LCWarning( std::ostream& outstream=std::cerr );
00039 ~LCWarning();
00040 LCWarning( const LCWarning& ) ;
00041 LCWarning & operator=(const LCWarning &);
00042 static LCWarning& instance ;
00043
00044
00045 struct _warning_cfg_struct{
00046 std::string txt{};
00047 int max{0};
00048 int counter{0};
00049 };
00050
00051 std::map< std::string, _warning_cfg_struct > _warning_cfg{} ;
00052 std::map< std::string, _warning_cfg_struct >::iterator _warning_cfg_it{} ;
00053 std::ostream& _outstream ;
00054
00055 };
00056
00057 }
00058 #endif