1 /*! 2 \class StMessageCounter 3 \author G. Van Buren, BNL 4 5 This class manages message limiting in STAR. It is a singleton. 6 Limits can be placed on message types (i.e. "I" for info messages) 7 or on strings in messages (i.e. "dst_track empty") 8 9 */ 10 11 #ifndef ClassStMessageCounter 12 #define ClassStMessageCounter 13 14 #include "StMessTypeList.h" 15 #include <Stsstream.h> 16 #include <Stiostream.h> 17 18 typedef StVector(char*) messCharVec; 19 typedef StVector(char*)::iterator messCharVecIter; 20 21 22 class StMessageCounter : public ostrstream { 23 private: 24 static StMessageCounter* mInstance; 25 StMessTypeList* messTypeList; 26 const char* limitMessage; 27 int yesLimits; 28 int noLimits; 29 messCharVecIter curString; 30 31 protected: 32 StMessageCounter(); 33 StMessageCounter(const StMessageCounter&); 34 intVector limitTList; // List of type limits 35 intVector limitTCountList; // List of type counts 36 messCharVec limitList; // List of strings to limit 37 intVector limitNList; // List of string limits 38 intVector limitNCountList; // List of string counts 39 messCharVec limitWList; // List of waiting types 40 intVector limitWNList; // List of waiting type limits 41 42 public: 43 ~StMessageCounter(); 44 static StMessageCounter* Instance(); 45 void SetLimit(const char* str, int n=0); 46 int GetLimit(const char* str); 47 void ListLimits(); 48 void AddType(const char* type); 49 int CheckLimit(char* mess, const char* type); 50 void NoLimits() {noLimits = 1;} 51 }; 52 53 #endif 54 55 // $Id: StMessageCounter.h,v 1.14 2016/06/14 06:26:34 genevb Exp $ 56 // $Log: StMessageCounter.h,v $ 57 // Revision 1.14 2016/06/14 06:26:34 genevb 58 // better initializations (Coverity) 59 // 60 // Revision 1.13 2003/09/25 21:19:22 genevb 61 // Some new cout-like functions and friend functions, some doxygen-ization 62 // 63 // Revision 1.12 2003/09/02 17:59:20 perev 64 // gcc 3.2 updates + WarnOff 65 // 66 // Revision 1.11 2000/06/07 00:05:36 genevb 67 // Added FixOn(), enforcing no limits on a specific message type/string 68 // 69 // Revision 1.10 2000/03/30 16:12:55 genevb 70 // Add NoLimits() capability to turn off message limiting. 71 // 72 // Revision 1.9 2000/01/05 19:53:46 genevb 73 // Fixed CC5 warnings, and several other small improvements under the hood 74 // 75 // Revision 1.8 1999/07/17 00:23:24 genevb 76 // Fixed bug when option fields are empty in FORTRAN, and let type limits be set before types are even added 77 // 78 // Revision 1.7 1999/06/30 17:24:50 genevb 79 // Better limit management, remove Bool_t 80 // 81 // Revision 1.6 1999/06/29 17:37:31 genevb 82 // Lots of fixes... 83 // 84 // Revision 1.5 1999/06/28 02:40:56 genevb 85 // Additional backward compatibilit with MSG (msg_enable, msg_enabled, msg_disable 86 // 87 // Revision 1.4 1999/06/26 00:24:53 genevb 88 // Fixed const type mismatches 89 // 90 // Revision 1.3 1999/06/25 22:57:57 genevb 91 // Fixed a small bug in MSG compatibiliti 92 // 93 // Revision 1.2 1999/06/24 16:30:42 genevb 94 // Fixed some memory leaks 95 // 96 // Revision 1.1 1999/06/23 15:17:50 genevb 97 // Introduction of StMessageManager 98 // 99