00001 #ifndef MessageService_ELadministrator_h
00002 #define MessageService_ELadministrator_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #include "FWCore/MessageService/interface/ELdestControl.h"
00053
00054 #include "FWCore/MessageLogger/interface/ELstring.h"
00055 #include "FWCore/MessageLogger/interface/ELlist.h"
00056 #include "FWCore/MessageLogger/interface/ELseverityLevel.h"
00057 #include "FWCore/MessageLogger/interface/ErrorObj.h"
00058
00059 namespace edm {
00060 namespace service {
00061
00062
00063
00064
00065
00066
00067 class ELcontextSupplier;
00068 class ELdestination;
00069 class ELadminDestroyer;
00070 class ErrorLog;
00071 class ELtsErrorLog;
00072 class ELcout;
00073
00074
00075
00076
00077
00078
00079 class ELadministrator {
00080
00081 friend class ELadminDestroyer;
00082 friend class ErrorLog;
00083 friend class ELcout;
00084 friend class ELtsErrorLog;
00085
00086
00087
00088 public:
00089
00090
00091
00092 static ELadministrator * instance();
00093
00094
00095
00096 void setProcess( const ELstring & process );
00097 ELstring swapProcess( const ELstring & process );
00098 void setContextSupplier( const ELcontextSupplier & supplier );
00099 const ELcontextSupplier & getContextSupplier() const;
00100 ELcontextSupplier & swapContextSupplier( ELcontextSupplier & cs );
00101 void setAbortThreshold( const ELseverityLevel & sev );
00102 void setExitThreshold ( const ELseverityLevel & sev );
00103
00104
00105
00106 ELdestControl attach( const ELdestination & sink );
00107 ELdestControl attach( const ELdestination & sink, const ELstring & name );
00108 bool getELdestControl ( const ELstring & name, ELdestControl & theControl );
00109
00110
00111
00112 ELseverityLevel checkSeverity();
00113 int severityCount( const ELseverityLevel & sev ) const;
00114 int severityCount( const ELseverityLevel & from,
00115 const ELseverityLevel & to ) const;
00116 void resetSeverityCount( const ELseverityLevel & sev );
00117 void resetSeverityCount( const ELseverityLevel & from,
00118 const ELseverityLevel & to );
00119 void resetSeverityCount();
00120
00121
00122
00123 void setThresholds( const ELseverityLevel & sev );
00124 void setLimits ( const ELstring & id, int limit );
00125 void setLimits ( const ELseverityLevel & sev, int limit );
00126 void setIntervals ( const ELstring & id, int interval );
00127 void setIntervals ( const ELseverityLevel & sev, int interval );
00128 void setTimespans ( const ELstring & id, int seconds );
00129 void setTimespans ( const ELseverityLevel & sev, int seconds );
00130 void wipe();
00131 void finish();
00132
00133 protected:
00134
00135
00136 const ELstring & process() const;
00137 ELcontextSupplier & context() const;
00138 const ELseverityLevel & abortThreshold() const;
00139 const ELseverityLevel & exitThreshold() const;
00140 std::list<ELdestination *> & sinks();
00141 const ELseverityLevel & highSeverity() const;
00142 int severityCounts( int lev ) const;
00143
00144
00145
00146 void finishMsg();
00147 void clearMsg();
00148
00149 protected:
00150
00151
00152 ELadministrator();
00153 virtual ~ELadministrator();
00154
00155 private:
00156
00157
00158
00159 static ELadministrator * instance_;
00160
00161
00162
00163 ELstring process_;
00164 ELcontextSupplier * context_;
00165 ELseverityLevel abortThreshold_;
00166 ELseverityLevel exitThreshold_;
00167 std::list<ELdestination *> sinks_;
00168 ELseverityLevel highSeverity_;
00169 int severityCounts_[ ELseverityLevel::nLevels ];
00170 edm::ErrorObj msg;
00171 bool msgIsActive;
00172
00173 std::map < ELstring, ELdestination* > attachedDestinations;
00174
00175 };
00176
00177
00178
00179
00180
00181
00182 class ELadminDestroyer {
00183
00184 public:
00185
00186
00187 ELadminDestroyer( ELadministrator * ad = 0 );
00188 ~ELadminDestroyer();
00189
00190
00191
00192 void setELadmin( ELadministrator * ad );
00193
00194 private:
00195
00196
00197 ELadministrator * admin_;
00198
00199 };
00200
00201
00202
00203
00204
00205 }
00206 }
00207
00208
00209 #endif // MessageService_ELadministrator_h