remage
Simulation framework for HPGe-based experiments
 
Loading...
Searching...
No Matches
RMGExceptionHandler.hh
1// Copyright (C) 2024 Manuel Huber <https://orcid.org/0009-0000-5212-2999>
2//
3// This program is free software: you can redistribute it and/or modify it under
4// the terms of the GNU Lesser General Public License as published by the Free
5// Software Foundation, either version 3 of the License, or (at your option) any
6// later version.
7//
8// This program is distributed in the hope that it will be useful, but WITHOUT
9// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11// details.
12//
13// You should have received a copy of the GNU Lesser General Public License
14// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16#ifndef _RMG_EXCEPTION_HANDLER_HH_
17#define _RMG_EXCEPTION_HANDLER_HH_
18
19#include "G4ExceptionHandler.hh"
20
27class RMGExceptionHandler : public G4ExceptionHandler {
28
29 public:
30
31 RMGExceptionHandler() = default;
32 ~RMGExceptionHandler() = default;
33
34 RMGExceptionHandler(const RMGExceptionHandler&) = delete;
35 RMGExceptionHandler& operator=(const RMGExceptionHandler&) = delete;
36
41 bool Notify(
42 const char* originOfException,
43 const char* exceptionCode,
44 G4ExceptionSeverity severity,
45 const char* description
46 ) override;
47
49 [[nodiscard]] bool HadWarning() const { return fHadWarning; }
51 [[nodiscard]] bool HadError() const { return fHadError; }
52
53 private:
54
55 bool fHadWarning = false;
56 bool fHadError = false;
57};
58
59#endif
60
61// vim: tabstop=2 shiftwidth=2 expandtab
bool HadError() const
Whether at least one error-level (or higher) exception has been raised.
Definition RMGExceptionHandler.hh:51
bool HadWarning() const
Whether at least one warning-level exception has been raised.
Definition RMGExceptionHandler.hh:49
bool Notify(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description) override
Record the severity and delegate the exception to G4ExceptionHandler.
Definition RMGExceptionHandler.cc:20