CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/FWCore/MessageService/interface/ELlimitsTable.h

Go to the documentation of this file.
00001 #ifndef FWCore_MessageService_ELlimitsTable_h
00002 #define FWCore_MessageService_ELlimitsTable_h
00003 
00004 
00005 // ----------------------------------------------------------------------
00006 //
00007 // ELlimitsTable is a class holding two maps:  One listing various
00008 //               limits associated with each id, and one counting occurrences
00009 //               and tracking latest times of each type of extended-id
00010 //               (id + severity + module + subroutine + process).
00011 //               In addition, there is a table by severity of defaults,
00012 //               and a single wildcard default limit.
00013 //
00014 // The fundamental operation is
00015 //
00016 //      bool add( const ELextendedID & )
00017 //
00018 // which checks if the extended id is in the main map.  If it is not, it
00019 // looks for the specified limit (by id, then severity, then wildcard) and
00020 // cretes an entry in the main map for this extended id.  The count is
00021 // incremented, (perhaps zero-ed first if the timespan was exceeded) and
00022 // checked against its limit.  If the limit is not exceeded, OR is exceeded
00023 // by 2**N times the limit, this returns true.
00024 //
00025 // Limits of -1 mean react to this error always.
00026 // Limits of 0 in the auxilliary defaults indicate that the corresponding
00027 // limit was not specified.
00028 //
00029 // 7/6/98 mf    Created file.
00030 // 6/7/00 web   Reflect consolidation of ELdestination/X
00031 // 6/14/00 web  Declare classes before granting friendship.
00032 // 6/15/01 mf   Grant friendship to ELoutput so that faithful copying of
00033 //              ELoutput destinations becomes possible.
00034 // 5/16/06 mf   Added wildcardInterval member, and severityIntervals
00035 //
00036 // ----------------------------------------------------------------------
00037 
00038 
00039 #include "FWCore/MessageLogger/interface/ELstring.h"
00040 #include "FWCore/MessageLogger/interface/ELseverityLevel.h"
00041 #include "FWCore/MessageLogger/interface/ELextendedID.h"
00042 #include "FWCore/MessageLogger/interface/ELmap.h"
00043 
00044 namespace edm {       
00045 namespace service {       
00046 
00047 
00048 // ----------------------------------------------------------------------
00049 // Prerequisite class:
00050 // ----------------------------------------------------------------------
00051 
00052 class ELdestination;
00053 class ELoutput;
00054 class ELfwkJobReport;
00055 
00056 
00057 // ----------------------------------------------------------------------
00058 // ELlimitsTable:
00059 // ----------------------------------------------------------------------
00060 
00061 class ELlimitsTable  {
00062 
00063   friend class ELdestination;
00064   friend class ELoutput;
00065   friend class ELfwkJobReport;
00066 
00067 public:
00068 
00069   ELlimitsTable();
00070   ~ELlimitsTable();
00071 
00072 // -----  Methods invoked by the destination under impetus from the logger:
00073 //
00074 public:
00075   bool add( const ELextendedID & xid );
00076   void setTableLimit( int n );
00077 
00078 // -----  Control methods invoked by the framework:
00079 //
00080 public:
00081 
00082   void wipe();  // Clears everything -- counts and limits established.
00083   void zero();  // Clears only counts.
00084 
00085   void setLimit   ( const ELstring        & id,  int n        );
00086   void setLimit   ( const ELseverityLevel & sev, int n        );
00087   void setInterval( const ELstring        & id,  int interval );
00088   void setInterval( const ELseverityLevel & sev, int interval );
00089   void setTimespan( const ELstring        & id,  int n        );
00090   void setTimespan( const ELseverityLevel & sev, int n        );
00091 
00092   ELlimitsTable & operator= (const ELlimitsTable & t);
00093 
00094 // -----  Tables and auxilliary private data:
00095 //
00096 protected:
00097 
00098   int severityLimits   [ELseverityLevel::nLevels];
00099   int severityTimespans[ELseverityLevel::nLevels];
00100   int severityIntervals[ELseverityLevel::nLevels];
00101   int wildcardLimit;
00102   int wildcardInterval;
00103   int wildcardTimespan;
00104 
00105   int tableLimit;
00106   ELmap_limits limits;
00107   ELmap_counts counts;
00108 
00109 };  // ELlimitsTable
00110 
00111 
00112 // ----------------------------------------------------------------------
00113 
00114 
00115 }        // end of namespace service
00116 }        // end of namespace edm
00117 
00118 
00119 #endif // FWCore_MessageService_ELlimitsTable_h