ATLAS Offline Software
WithRootErrorHandler.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
4  */
13 #include "TError.h"
14 #include <functional>
15 #include <type_traits>
16 
17 
18 #ifndef ROOTUTILS_WITHROOTERRORHANDLER_H
19 #define ROOTUTILS_WITHROOTERRORHANDLER_H
20 
21 namespace RootUtils {
22 
23 
56 {
57 public:
58  // A ROOT error handler has signature
59  // void hand (int level, Bool_t abort, const char* location, const char* msg)
60 
63  using Handler_t = std::function<bool (int, Bool_t, const char*, const char*)>;
64 
65 
77 
78 
85 
86 
87  // Try to prevent misuse.
92 
93  static void* operator new (size_t) = delete;
94  static void* operator new[] (size_t) = delete;
95  static void operator delete (void*) = delete;
96  static void operator delete[] (void*) = delete;
97 
98 
99 private:
101  size_t m_size;
102 };
103 
104 
105 } // namespace RootUtils
106 
107 #endif // not ROOTUTILS_WITHROOTERRORHANDLER_H
RootUtils
Definition: ILogger.h:20
RootUtils::WithRootErrorHandler::WithRootErrorHandler
WithRootErrorHandler(WithRootErrorHandler &&)=delete
RootUtils::WithRootErrorHandler::WithRootErrorHandler
WithRootErrorHandler(const WithRootErrorHandler &)=delete
RootUtils::WithRootErrorHandler::Handler_t
std::function< bool(int, Bool_t, const char *, const char *)> Handler_t
Type of handler to register.
Definition: WithRootErrorHandler.h:63
RootUtils::WithRootErrorHandler::WithRootErrorHandler
WithRootErrorHandler(Handler_t errhand)
Temporarily install a thread-local root error handler.
Definition: WithRootErrorHandler.cxx:65
RootUtils::WithRootErrorHandler::~WithRootErrorHandler
~WithRootErrorHandler()
Destructor.
Definition: WithRootErrorHandler.cxx:98
RootUtils::WithRootErrorHandler
Run a MT piece of code with an alternate root error handler.
Definition: WithRootErrorHandler.h:56
RootUtils::WithRootErrorHandler::operator=
WithRootErrorHandler & operator=(const WithRootErrorHandler &)=delete
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
RootUtils::WithRootErrorHandler::m_size
size_t m_size
For error checking.
Definition: WithRootErrorHandler.h:101