CMS 3D CMS Logo

ELdestination.cc

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------
00002 //
00003 // ELdestination.cc
00004 //
00005 // History:
00006 //
00007 // 7/5/98       mf      Created
00008 // 6/16/99      jvr     Allow suppress/include options on destinations
00009 // 7/2/99       jvr     Added separate/attachTime, Epilogue, and Serial
00010 //                      options
00011 // 6/7/00       web     Consolidate ELdestination/X; add filterModule()
00012 // 8/22/00      web     Fix omitted .getSymbol() call
00013 // 10/4/00      mf      excludeModule()
00014 // 1/15/01      mf      setLineLength()
00015 // 2/13/01      mf      fix written by pc to accomodate NT problem with
00016 //                      static init { $001$ }.  Corresponding fix is in
00017 //                      .h file.
00018 // 3/13/01      mf      statisticsMap()
00019 // 4/05/01      mf      multi-module filtering
00020 // 4/12/01      mf      repair multi-module filtering
00021 // 6/23/03      mf      changeFile(), flush()
00022 // 1/10/06      mf      finish()
00023 // 6/19/08      mf      summaryForJobReport()
00024 //
00025 // ----------------------------------------------------------------------
00026 
00027 
00028 #include <iostream>
00029 
00030 #include "FWCore/MessageService/interface/ELdestination.h"
00031 #include "FWCore/MessageService/interface/ELdestControl.h"
00032 
00033 // Possible Traces:
00034 // #define ELdestinationCONSTRUCTOR_TRACE
00035 
00036 namespace edm {
00037 namespace service {
00038                                          // Fix $001 2/13/01 mf
00039 #ifdef DEFECT_NO_STATIC_CONST_INIT
00040   const int ELdestination::defaultLineLength = 80;
00041 #endif
00042 
00043 ELdestination::ELdestination()
00044 : threshold     ( ELzeroSeverity    )
00045 , traceThreshold( ELhighestSeverity )
00046 , limits        (                   )
00047 , preamble      ( "%MSG"            )
00048 , newline       ( "\n"              )
00049 , indent        ( "      "          )
00050 , lineLength    ( defaultLineLength )
00051 , ignoreMostModules (false)
00052 , respondToThese()
00053 , respondToMostModules (false)
00054 , ignoreThese()
00055 {
00056 
00057   #ifdef ELdestinationCONSTRUCTOR_TRACE
00058     std::cerr << "Constructor for ELdestination\n";
00059   #endif
00060 
00061 }  // ELdestination()
00062 
00063 
00064 ELdestination::~ELdestination()  {
00065 
00066   #ifdef ELdestinationCONSTRUCTOR_TRACE
00067     std::cerr << "Destructor for ELdestination\n";
00068   #endif
00069 
00070 }  // ~ELdestination()
00071 
00072 
00073 // ----------------------------------------------------------------------
00074 // Methods invoked by the ELadministrator:
00075 // ----------------------------------------------------------------------
00076 
00077 bool ELdestination::log( const edm::ErrorObj & msg )  { return false; }
00078 
00079 
00080 // ----------------------------------------------------------------------
00081 // Methods invoked through the ELdestControl handle:
00082 // ----------------------------------------------------------------------
00083 
00084 // Each of these must be overridden by any destination for which they make
00085 // sense.   In this base class, where they are all no-ops, the methods which
00086 // generate data to a destination, stream or stream will warn at that place,
00087 // and all the no-op methods will issue an ELwarning2 at their own destination.
00088 
00089 
00090 static ELstring noSummarizationMsg = "No summarization()";
00091 static ELstring noSummaryMsg = "No summary()";
00092 static ELstring noClearSummaryMsg = "No clearSummary()";
00093 static ELstring hereMsg = "available via this destination";
00094 static ELstring noosMsg = "No ostream";
00095 static ELstring notELoutputMsg = "This destination is not an ELoutput";
00096 
00097 void ELdestination::clearSummary()  {
00098 
00099   edm::ErrorObj msg( ELwarning2, noClearSummaryMsg );
00100   msg << hereMsg;
00101   log( msg );
00102 
00103 }  // clearSummary()
00104 
00105 
00106 void ELdestination::wipe()  { limits.wipe(); }
00107 
00108 
00109 void ELdestination::zero()  { limits.zero(); }
00110 
00111 void ELdestination::respondToModule( ELstring const & moduleName )  {
00112   if (moduleName=="*") {
00113     ignoreMostModules = false;
00114     respondToMostModules = true;
00115     ignoreThese.clear();
00116     respondToThese.clear();
00117   } else {
00118     respondToThese.insert(moduleName);
00119     ignoreThese.erase(moduleName);
00120   }
00121 }
00122 
00123 void ELdestination::ignoreModule( ELstring const & moduleName )  {
00124   if (moduleName=="*") {
00125     respondToMostModules = false;
00126     ignoreMostModules = true;
00127     respondToThese.clear();
00128     ignoreThese.clear();
00129   } else {
00130     ignoreThese.insert(moduleName);
00131     respondToThese.erase(moduleName);
00132   }
00133 }
00134 
00135 void ELdestination::filterModule( ELstring const & moduleName )  {
00136   ignoreModule("*");
00137   respondToModule(moduleName);
00138 }
00139 
00140 void ELdestination::excludeModule( ELstring const & moduleName )  {
00141   respondToModule("*");
00142   ignoreModule(moduleName);
00143 }
00144 
00145 void ELdestination::summary( )  { }
00146 
00147 void ELdestination::summary( ELdestControl & dest, const ELstring & title )  {
00148 
00149   edm::ErrorObj msg( ELwarning2, noSummaryMsg );
00150   msg << noSummaryMsg << " " << hereMsg << dest.getNewline() << title;
00151   dest.log( msg );
00152 
00153 }  // summary()
00154 
00155 
00156 void ELdestination::summary( std::ostream & os, const ELstring & title )  {
00157 
00158   os << "%MSG" << ELwarning2.getSymbol() << " "
00159        << noSummaryMsg << " " << hereMsg << std::endl
00160      << title << std::endl;
00161 
00162 }  // summary()
00163 
00164 
00165 void ELdestination::summary( ELstring & s, const ELstring & title )  {
00166 
00167   s = ELstring("%MSG") + ELwarning2.getSymbol() + " "
00168       + noSummaryMsg + " " + hereMsg + "\n"
00169     + title + "\n";
00170 
00171 }  // summary()
00172 
00173 void ELdestination::summaryForJobReport(std::map<std::string, double> & sm) { }
00174 
00175 void ELdestination::finish() {  }
00176 
00177 void ELdestination::setTableLimit( int n )  { limits.setTableLimit( n ); }
00178 
00179 
00180 void ELdestination::summarization(
00181   const ELstring & title
00182 , const ELstring & sumLines )  {
00183 
00184   edm::ErrorObj  msg( ELwarning2, noSummarizationMsg );
00185   msg << hereMsg << newline << title;
00186   log( msg );
00187 
00188 }
00189 
00190 std::map<ELextendedID , StatsCount> ELdestination::statisticsMap() const {
00191   return std::map<ELextendedID , StatsCount> ();
00192 }
00193 
00194 void ELdestination::changeFile (std::ostream & os) {
00195   edm::ErrorObj  msg( ELwarning2, noosMsg );
00196   msg << notELoutputMsg;
00197   log( msg );
00198 }
00199 
00200 void ELdestination::changeFile (const ELstring & filename) {
00201   edm::ErrorObj  msg( ELwarning2, noosMsg );
00202   msg << notELoutputMsg << newline << "file requested is" << filename;
00203   log( msg );
00204 }
00205 
00206 void ELdestination::flush () {
00207   edm::ErrorObj  msg( ELwarning2, noosMsg );
00208   msg << "cannot flush()";
00209   log( msg );
00210 }
00211 
00212 // ----------------------------------------------------------------------
00213 // Output format options:
00214 // ----------------------------------------------------------------------
00215 
00216 void ELdestination::suppressText()  { ; }                      // $$ jvr
00217 void ELdestination::includeText()   { ; }
00218 
00219 void ELdestination::suppressModule()  { ; }
00220 void ELdestination::includeModule()   { ; }
00221 
00222 void ELdestination::suppressSubroutine()  { ; }
00223 void ELdestination::includeSubroutine()   { ; }
00224 
00225 void ELdestination::suppressTime()  { ; }
00226 void ELdestination::includeTime()   { ; }
00227 
00228 void ELdestination::suppressContext()  { ; }
00229 void ELdestination::includeContext()   { ; }
00230 
00231 void ELdestination::suppressSerial()  { ; }
00232 void ELdestination::includeSerial()   { ; }
00233 
00234 void ELdestination::useFullContext()  { ; }
00235 void ELdestination::useContext()      { ; }
00236 
00237 void ELdestination::separateTime()  { ; }
00238 void ELdestination::attachTime()    { ; }
00239 
00240 void ELdestination::separateEpilogue()  { ; }
00241 void ELdestination::attachEpilogue()    { ; }
00242 
00243 void ELdestination::noTerminationSummary()  { ; }
00244 
00245 ELstring ELdestination::getNewline() const  { return newline; }
00246 
00247 int ELdestination::setLineLength (int len) {
00248   int temp=lineLength;
00249   lineLength = len;
00250   return temp;
00251 }
00252 
00253 int ELdestination::getLineLength () const { return lineLength; }
00254 
00255 
00256 // ----------------------------------------------------------------------
00257 // Protected helper methods:
00258 // ----------------------------------------------------------------------
00259 
00260 bool ELdestination::thisShouldBeIgnored(const ELstring & s) const {
00261   if (respondToMostModules) {
00262     return ( ignoreThese.find(s) != ignoreThese.end() );
00263   } else if (ignoreMostModules) {
00264     return ( respondToThese.find(s) == respondToThese.end() );
00265   } else {
00266   return false;
00267   }
00268 }
00269 
00270 } // end of namespace service  
00271 } // end of namespace edm  

Generated on Tue Jun 9 17:36:18 2009 for CMSSW by  doxygen 1.5.4