remage
Simulation framework for HPGe-based experiments
Toggle main menu visibility
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 <atomic>
20
21
#include "G4ExceptionHandler.hh"
22
29
class
RMGExceptionHandler :
public
G4ExceptionHandler
{
30
31
public
:
32
33
RMGExceptionHandler() =
default
;
34
~RMGExceptionHandler() =
default
;
35
36
RMGExceptionHandler(
const
RMGExceptionHandler&) =
delete
;
37
RMGExceptionHandler& operator=(
const
RMGExceptionHandler&) =
delete
;
38
43
bool
Notify
(
44
const
char
* originOfException,
45
const
char
* exceptionCode,
46
G4ExceptionSeverity severity,
47
const
char
* description
48
)
override
;
49
51
[[nodiscard]]
bool
HadWarning
()
const
{
return
fHadWarning; }
53
[[nodiscard]]
bool
HadError
()
const
{
return
fHadError; }
54
55
private
:
56
57
// shared for all threads.
58
inline
static
std::atomic<bool> fHadWarning =
false
;
59
inline
static
std::atomic<bool> fHadError =
false
;
60
};
61
62
#endif
63
64
// vim: tabstop=2 shiftwidth=2 expandtab
G4ExceptionHandler
RMGExceptionHandler::HadError
bool HadError() const
Whether at least one error-level (or higher) exception has been raised.
Definition
RMGExceptionHandler.hh:53
RMGExceptionHandler::HadWarning
bool HadWarning() const
Whether at least one warning-level exception has been raised.
Definition
RMGExceptionHandler.hh:51
RMGExceptionHandler::Notify
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
include
RMGExceptionHandler.hh
Generated by
1.17.0