CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/FWCore/MessageLogger/interface/ELmap.h

Go to the documentation of this file.
00001 #ifndef MessageLogger_ELmap_h
00002 #define MessageLogger_ELmap_h
00003 
00004 
00005 // ----------------------------------------------------------------------
00006 //
00007 // ELmap.h      Provides a map class with the semantics of std::map.
00008 //              Customizers may substitute for this class to provide either
00009 //              a map with a different allocator, or whatever else.
00010 //
00011 //      We typedef an individual type for each of these maps since
00012 //      the syntax
00013 //              typedef map ELmap;
00014 //              ELlist<ELextededID, Counts, ELextendedID::less> table;
00015 //      may or may not be valid C++, and if valid probably won't work
00016 //      everywhere.
00017 //
00018 //      The key types are common enough types (strings and extended id's);
00019 //      the data types are peculiar to each type of map.  We have made the
00020 //      design choice of grouping all maps in this one file, so that if
00021 //      a customizer needs to do something else with maps, all the slop is
00022 //      in one place.
00023 //
00024 //      The drawback is that all the classes that depend on these maps must
00025 //      include ELmap.h, which pulls in not only the maps and structs they
00026 //      need but those anybody else needs.  Fortunately, only two classes
00027 //      use maps at all:  ELlimitsTable and the ELstatistics destination.
00028 //      So this drawback is very slight.
00029 //
00030 // The elements of map semantics which ErrorLogger code rely upon are
00031 // listed in ELmap.semantics.
00032 //
00033 // ----------------------------------------------------------------------
00034 
00035 
00036 #include <map>
00037 
00038 #include "FWCore/MessageLogger/interface/ELstring.h"
00039 #include "FWCore/MessageLogger/interface/ELextendedID.h"
00040 
00041 
00042 namespace edm {       
00043 
00044 
00045 // ----------------------------------------------------------------------
00046 
00047 
00048 class LimitAndTimespan  {
00049 
00050 public:
00051 
00052   int limit;
00053   int timespan;
00054   int interval;
00055 
00056   LimitAndTimespan( int lim = -1, int ts = -1, int ivl = -1 );
00057 
00058 };  // LimitAndTimespan
00059 
00060 
00061 class CountAndLimit  {
00062 
00063 public:
00064 
00065   int    n;
00066   int    aggregateN;
00067   time_t lastTime;
00068   int    limit;
00069   int    timespan;
00070   int    interval;
00071   int    skipped;
00072 
00073   CountAndLimit( int lim = -1, int ts = -1, int ivl = -1 );
00074   bool add();
00075 
00076 };  // CountAndLimit
00077 
00078 
00079 class StatsCount  {
00080 
00081 public:
00082 
00083   int      n;
00084   int      aggregateN;
00085   bool     ignoredFlag;
00086   ELstring context1;
00087   ELstring context2;
00088   ELstring contextLast;
00089 
00090   StatsCount();
00091   void add( const ELstring & context, bool reactedTo );
00092 
00093 };  // StatsCount
00094 
00095 
00096 // ----------------------------------------------------------------------
00097 
00098 
00099 typedef std::map< ELstring     , LimitAndTimespan > ELmap_limits;
00100 
00101 typedef std::map< ELextendedID , CountAndLimit    > ELmap_counts;
00102 
00103 typedef std::map< ELextendedID , StatsCount       > ELmap_stats;
00104 
00105 // See ELseverityLevel.cc for another map:  ELmap_sevTran
00106 
00107 // ----------------------------------------------------------------------
00108 
00109 
00110 }        // end of namespace edm
00111 
00112 
00113 #endif // MessageLogger_ELmap_h