File indexing completed on 2025-03-07 01:53:23
0001 #ifndef FWCore_AbstractServices_interface_RootHandlers_h
0002 #define FWCore_AbstractServices_interface_RootHandlers_h
0003
0004 #include "FWCore/Utilities/interface/propagate_const.h"
0005 namespace edm {
0006 class EventProcessor;
0007 class RootHandlers {
0008 public:
0009 enum class SeverityLevel { kInfo, kWarning, kError, kSysError, kFatal };
0010
0011 private:
0012 struct WarningSentry {
0013 WarningSentry(RootHandlers* iHandler, SeverityLevel level) : m_handler(iHandler) {
0014 m_handler->ignoreWarnings_(level);
0015 };
0016 ~WarningSentry() { m_handler->enableWarnings_(); }
0017 edm::propagate_const<RootHandlers*> m_handler;
0018 };
0019 friend struct edm::RootHandlers::WarningSentry;
0020 friend class edm::EventProcessor;
0021
0022 public:
0023 RootHandlers() = default;
0024 RootHandlers(RootHandlers const&) = delete;
0025 RootHandlers& operator=(RootHandlers const&) = delete;
0026 RootHandlers(RootHandlers&&) = delete;
0027 RootHandlers& operator=(RootHandlers&&) = delete;
0028 virtual ~RootHandlers() = default;
0029
0030 template <typename F>
0031 void ignoreWarningsWhileDoing(F iFunc, SeverityLevel level = SeverityLevel::kWarning) {
0032 WarningSentry sentry(this, level);
0033 iFunc();
0034 }
0035
0036 private:
0037 virtual void willBeUsingThreads() = 0;
0038
0039 virtual void enableWarnings_() = 0;
0040 virtual void ignoreWarnings_(SeverityLevel level) = 0;
0041 };
0042 }
0043
0044 #endif