CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/FWCore/MessageService/interface/MessageLoggerDefaults.h

Go to the documentation of this file.
00001 #ifndef MessageLogger_MessageLoggerDefaults_h
00002 #define MessageLogger_MessageLoggerDefaults_h
00003 
00004 // -*- C++ -*-
00005 //
00006 // Package:     MessageLogger
00007 // Class  :     MessageLoggerDefaults
00008 //
00024 //
00025 // Original Author:  M. Fischler 
00026 //         Created:  Tues Jun 14 10:38:19 CST 2007
00027 // $Id: MessageLoggerDefaults.h,v 1.3 2008/07/10 16:15:13 fischler Exp $
00028 //
00029 
00030 // Framework include files
00031 
00032 #include "FWCore/Utilities/interface/JobMode.h"
00033 
00034 // system include files
00035 
00036 #include <string>
00037 #include <vector>
00038 #include <map>
00039 #include <cassert>
00040 
00041 // Change log
00042 //
00043 // 6/15/07 mf   Original version
00044 //
00045 // -------------------------------------------------------
00046 
00047 // user include files
00048 
00049 // ----------------
00050 // Maintenance Tips
00051 // ----------------
00052 //
00053 // When default values change for one job mode of operation or another,
00054 // implement that change in the appropriate member function implemented
00055 // in HardwiredDefaults.cc.  For example, hardwireGridJobMode().
00056 // 
00057 // When a new default is needed, add the item to the struct, and then place
00058 // the default value into the appropriate sections of the various member
00059 // functions in HardwiredDefaults.cc. 
00060 // It may be necessary to supply values of that default for each of the modes,
00061 // even though the ErrorLogger default is suitable for all the modes but one.
00062 //
00063 // When the new default is of a type not already being accessed, also add
00064 // the accessor method in this header, and implement it in
00065 // MessageLoggerDefaults.cc following the pattern shown for existing items
00066 
00067 namespace edm {
00068 namespace service {
00069 
00070 struct MessageLoggerDefaults {
00071 public:
00072   static const int NO_VALUE_SET = -45654;
00073 
00074   struct Category {
00075     std::string threshold;
00076     int limit;
00077     int reportEvery;
00078     int timespan;
00079     Category() : 
00080       threshold("")
00081     , limit(NO_VALUE_SET)  
00082     , reportEvery(NO_VALUE_SET)  
00083     , timespan(NO_VALUE_SET) {}
00084   };
00085   
00086   struct Destination {
00087     std::string threshold;
00088     std::map<std::string,Category> category; 
00089     std::map<std::string,Category> sev; 
00090     std::string output;
00091   };
00092   
00093   // publicly available collections and structures
00094 
00095   std::vector<std::string> categories;
00096   std::vector<std::string> destinations;
00097   std::vector<std::string> fwkJobReports;
00098   std::vector<std::string> statistics;
00099   std::map<std::string,Destination> destination;
00100       
00101   // access to values set
00102   
00103   std::string threshold (std::string const & dest);
00104   std::string output    (std::string const & dest);
00105 
00106   int limit      (std::string const & dest, std::string const & cat);
00107   int reportEvery(std::string const & dest, std::string const & cat);
00108   int timespan   (std::string const & dest, std::string const & cat);
00109     
00110   int sev_limit      (std::string const & dest, std::string const & sev);
00111   int sev_reportEvery(std::string const & dest, std::string const & sev);
00112   int sev_timespan   (std::string const & dest, std::string const & sev);
00113     
00114   // Modes with hardwired defaults
00115   
00116   void hardwireGridJobMode();
00117   void hardwireReleaseValidationJobMode();
00118   void hardwireAnalysisJobMode();
00119   void hardwireNilJobMode();
00120 
00121   static edm::JobMode mode(std::string const & jm);
00122    
00123   // ctor
00124 
00125   explicit MessageLoggerDefaults (edm::JobMode mode = GridJobMode) {
00126     // mode-independent defaults
00127     
00128     // mode-dependent defaults
00129     switch (mode) {
00130       // GridJobMode:   Intended for automated batch-like processing, in which 
00131       //                the output stream for cerr is routed to an apropro
00132       //                file.  LogInfo messages are enabled, and at least 
00133       //                one such message is delivered from the framework per
00134       //                event, so this mode is not suitable for many-Hz light
00135       //                event processing. 
00136       case GridJobMode: 
00137         hardwireGridJobMode();
00138         break;       
00139       case ReleaseValidationJobMode:
00140         hardwireReleaseValidationJobMode();
00141         break;       
00142       case AnalysisJobMode:
00143         hardwireAnalysisJobMode();
00144         break;       
00145       case NilJobMode:
00146         hardwireNilJobMode();
00147         break;       
00148       default:
00149         // this should never happen!  No user error can get here.
00150         bool    Invalid_JobMode_in_ctor_of_MessageLoggerDefaults = false;
00151         assert (Invalid_JobMode_in_ctor_of_MessageLoggerDefaults);
00152     } // end of switch on mode
00153   }
00154 
00155 };
00156 
00157 
00158 
00159 } // end of namespace service
00160 } // end of namespace edm
00161 
00162 
00163 #endif // MessageLogger_MessageLoggerDefaults_h