Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:43

0001 #ifndef MessageLogger_ELmap_h
0002 #define MessageLogger_ELmap_h
0003 
0004 // ----------------------------------------------------------------------
0005 //
0006 // ELmap.h      Provides a map class with the semantics of std::map.
0007 //              Customizers may substitute for this class to provide either
0008 //              a map with a different allocator, or whatever else.
0009 //
0010 //  We typedef an individual type for each of these maps since
0011 //  the syntax
0012 //      typedef map ELmap;
0013 //      ELlist<ELextededID, Counts, ELextendedID::less> table;
0014 //  may or may not be valid C++, and if valid probably won't work
0015 //  everywhere.
0016 //
0017 //  The key types are common enough types (strings and extended id's);
0018 //  the data types are peculiar to each type of map.  We have made the
0019 //  design choice of grouping all maps in this one file, so that if
0020 //  a customizer needs to do something else with maps, all the slop is
0021 //  in one place.
0022 //
0023 //  The drawback is that all the classes that depend on these maps must
0024 //  include ELmap.h, which pulls in not only the maps and structs they
0025 //  need but those anybody else needs.  Fortunately, only two classes
0026 //  use maps at all:  ELlimitsTable and the ELstatistics destination.
0027 //  So this drawback is very slight.
0028 //
0029 // The elements of map semantics which ErrorLogger code rely upon are
0030 // listed in ELmap.semantics.
0031 //
0032 // ----------------------------------------------------------------------
0033 
0034 #include <map>
0035 #include <string>
0036 
0037 #include "FWCore/MessageLogger/interface/ELextendedID.h"
0038 
0039 namespace edm {
0040 
0041   // ----------------------------------------------------------------------
0042 
0043   class LimitAndTimespan {
0044   public:
0045     int limit;
0046     int timespan;
0047     int interval;
0048 
0049     LimitAndTimespan(int lim = -1, int ts = -1, int ivl = -1);
0050 
0051   };  // LimitAndTimespan
0052 
0053   class CountAndLimit {
0054   public:
0055     int n;
0056     int aggregateN;
0057     time_t lastTime;
0058     int limit;
0059     int timespan;
0060     int interval;
0061     int skipped;
0062 
0063     CountAndLimit(int lim = -1, int ts = -1, int ivl = -1);
0064     bool add();
0065 
0066   };  // CountAndLimit
0067 
0068   class StatsCount {
0069   public:
0070     int n;
0071     int aggregateN;
0072     bool ignoredFlag;
0073     std::string context1;
0074     std::string context2;
0075     std::string contextLast;
0076 
0077     StatsCount();
0078     void add(std::string_view context, bool reactedTo);
0079 
0080   };  // StatsCount
0081 
0082   // ----------------------------------------------------------------------
0083 
0084   typedef std::map<std::string, LimitAndTimespan> ELmap_limits;
0085 
0086   typedef std::map<ELextendedID, CountAndLimit> ELmap_counts;
0087 
0088   typedef std::map<ELextendedID, StatsCount> ELmap_stats;
0089 
0090   // See ELseverityLevel.cc for another map:  ELmap_sevTran
0091 
0092   // ----------------------------------------------------------------------
0093 
0094 }  // end of namespace edm
0095 
0096 #endif  // MessageLogger_ELmap_h