Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:41

0001 #ifndef FWCore_MessageService_ELlimitsTable_h
0002 #define FWCore_MessageService_ELlimitsTable_h
0003 
0004 // ----------------------------------------------------------------------
0005 //
0006 // ELlimitsTable is a class holding two maps:  One listing various
0007 //       limits associated with each id, and one counting occurrences
0008 //       and tracking latest times of each type of extended-id
0009 //       (id + severity + module + subroutine + process).
0010 //       In addition, there is a table by severity of defaults,
0011 //       and a single wildcard default limit.
0012 //
0013 // The fundamental operation is
0014 //
0015 //  bool add( const ELextendedID & )
0016 //
0017 // which checks if the extended id is in the main map.  If it is not, it
0018 // looks for the specified limit (by id, then severity, then wildcard) and
0019 // cretes an entry in the main map for this extended id.  The count is
0020 // incremented, (perhaps zero-ed first if the timespan was exceeded) and
0021 // checked against its limit.  If the limit is not exceeded, OR is exceeded
0022 // by 2**N times the limit, this returns true.
0023 //
0024 // Limits of -1 mean react to this error always.
0025 // Limits of 0 in the auxilliary defaults indicate that the corresponding
0026 // limit was not specified.
0027 //
0028 // 7/6/98 mf    Created file.
0029 // 6/7/00 web   Reflect consolidation of ELdestination/X
0030 // 6/14/00 web  Declare classes before granting friendship.
0031 // 6/15/01 mf   Grant friendship to ELoutput so that faithful copying of
0032 //      ELoutput destinations becomes possible.
0033 // 5/16/06 mf   Added wildcardInterval member, and severityIntervals
0034 //
0035 // ----------------------------------------------------------------------
0036 
0037 #include "FWCore/MessageLogger/interface/ELseverityLevel.h"
0038 #include "FWCore/MessageLogger/interface/ELextendedID.h"
0039 #include "FWCore/MessageLogger/interface/ELmap.h"
0040 
0041 #include <string>
0042 
0043 namespace edm {
0044   namespace service {
0045 
0046     // ----------------------------------------------------------------------
0047     // Prerequisite class:
0048     // ----------------------------------------------------------------------
0049 
0050     class ELdestination;
0051     class ELoutput;
0052 
0053     // ----------------------------------------------------------------------
0054     // ELlimitsTable:
0055     // ----------------------------------------------------------------------
0056 
0057     class ELlimitsTable {
0058       friend class ELdestination;
0059       friend class ELoutput;
0060 
0061     public:
0062       ELlimitsTable();
0063       ~ELlimitsTable();
0064 
0065       // -----  Methods invoked by the destination under impetus from the logger:
0066       //
0067     public:
0068       bool add(const ELextendedID& xid);
0069       void setTableLimit(int n);
0070 
0071       // -----  Control methods invoked by the framework:
0072       //
0073     public:
0074       void wipe();  // Clears everything -- counts and limits established.
0075       void zero();  // Clears only counts.
0076 
0077       void setLimit(const std::string& id, int n);
0078       void setLimit(const messagelogger::ELseverityLevel& sev, int n);
0079       void setInterval(const std::string& id, int interval);
0080       void setInterval(const messagelogger::ELseverityLevel& sev, int interval);
0081       void setTimespan(const std::string& id, int n);
0082       void setTimespan(const messagelogger::ELseverityLevel& sev, int n);
0083 
0084       ELlimitsTable& operator=(const ELlimitsTable& t);
0085 
0086       // -----  Tables and auxilliary private data:
0087       //
0088     protected:
0089       int severityLimits[messagelogger::ELseverityLevel::nLevels];
0090       int severityTimespans[messagelogger::ELseverityLevel::nLevels];
0091       int severityIntervals[messagelogger::ELseverityLevel::nLevels];
0092       int wildcardLimit;
0093       int wildcardInterval;
0094       int wildcardTimespan;
0095 
0096       int tableLimit;
0097       ELmap_limits limits;
0098       ELmap_counts counts;
0099 
0100     };  // ELlimitsTable
0101 
0102     // ----------------------------------------------------------------------
0103 
0104   }  // end of namespace service
0105 }  // end of namespace edm
0106 
0107 #endif  // FWCore_MessageService_ELlimitsTable_h