00001 00011 #ifndef ClassStMessageCounter 00012 #define ClassStMessageCounter 00013 00014 #include "StMessTypeList.h" 00015 #include <Stsstream.h> 00016 #include <Stiostream.h> 00017 00018 typedef StVector(char*) messCharVec; 00019 typedef StVector(char*)::iterator messCharVecIter; 00020 00021 00022 class StMessageCounter : public ostrstream { 00023 private: 00024 static StMessageCounter* mInstance; 00025 StMessTypeList* messTypeList; 00026 const char* limitMessage; 00027 int yesLimits; 00028 int noLimits; 00029 messCharVecIter curString; 00030 size_t index; 00031 00032 protected: 00033 StMessageCounter(); 00034 StMessageCounter(const StMessageCounter&); 00035 intVector limitTList; // List of type limits 00036 intVector limitTCountList; // List of type counts 00037 messCharVec limitList; // List of strings to limit 00038 intVector limitNList; // List of string limits 00039 intVector limitNCountList; // List of string counts 00040 messCharVec limitWList; // List of waiting types 00041 intVector limitWNList; // List of waiting type limits 00042 00043 public: 00044 ~StMessageCounter(); 00045 static StMessageCounter* Instance(); 00046 void SetLimit(const char* str, int n=0); 00047 int GetLimit(const char* str); 00048 void ListLimits(); 00049 void AddType(const char* type); 00050 int CheckLimit(char* mess, const char* type); 00051 void NoLimits() {noLimits = 1;} 00052 }; 00053 00054 #endif 00055 00056 // $Id: StMessageCounter.h,v 1.13 2003/09/25 21:19:22 genevb Exp $ 00057 // $Log: StMessageCounter.h,v $ 00058 // Revision 1.13 2003/09/25 21:19:22 genevb 00059 // Some new cout-like functions and friend functions, some doxygen-ization 00060 // 00061 // Revision 1.12 2003/09/02 17:59:20 perev 00062 // gcc 3.2 updates + WarnOff 00063 // 00064 // Revision 1.11 2000/06/07 00:05:36 genevb 00065 // Added FixOn(), enforcing no limits on a specific message type/string 00066 // 00067 // Revision 1.10 2000/03/30 16:12:55 genevb 00068 // Add NoLimits() capability to turn off message limiting. 00069 // 00070 // Revision 1.9 2000/01/05 19:53:46 genevb 00071 // Fixed CC5 warnings, and several other small improvements under the hood 00072 // 00073 // Revision 1.8 1999/07/17 00:23:24 genevb 00074 // Fixed bug when option fields are empty in FORTRAN, and let type limits be set before types are even added 00075 // 00076 // Revision 1.7 1999/06/30 17:24:50 genevb 00077 // Better limit management, remove Bool_t 00078 // 00079 // Revision 1.6 1999/06/29 17:37:31 genevb 00080 // Lots of fixes... 00081 // 00082 // Revision 1.5 1999/06/28 02:40:56 genevb 00083 // Additional backward compatibilit with MSG (msg_enable, msg_enabled, msg_disable 00084 // 00085 // Revision 1.4 1999/06/26 00:24:53 genevb 00086 // Fixed const type mismatches 00087 // 00088 // Revision 1.3 1999/06/25 22:57:57 genevb 00089 // Fixed a small bug in MSG compatibiliti 00090 // 00091 // Revision 1.2 1999/06/24 16:30:42 genevb 00092 // Fixed some memory leaks 00093 // 00094 // Revision 1.1 1999/06/23 15:17:50 genevb 00095 // Introduction of StMessageManager 00096 //
1.5.9