The Gaudi Framework
master (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
StatusCode.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#define GAUDIKERNEL_STATUSCODE_CPP 1
12
13
#include <
GaudiKernel/Bootstrap.h
>
14
#include <
GaudiKernel/GaudiException.h
>
15
#include <
GaudiKernel/IMessageSvc.h
>
16
#include <
GaudiKernel/ISvcLocator.h
>
17
#include <
GaudiKernel/MsgStream.h
>
18
#include <
GaudiKernel/StatusCode.h
>
19
#include <
GaudiKernel/System.h
>
20
#include <exception>
21
22
constexpr
const
StatusCode::ErrorCode
StatusCode::SUCCESS
;
23
constexpr
const
StatusCode::ErrorCode
StatusCode::FAILURE
;
24
constexpr
const
StatusCode::ErrorCode
StatusCode::RECOVERABLE
;
25
26
namespace
{
28
struct
DefaultCategory :
public
StatusCode::Category
{
29
30
const
char
* name()
const override
{
return
"Gaudi"
; }
31
32
std::string message(
StatusCode::code_t
code )
const override
{
33
switch
(
static_cast<
StatusCode::ErrorCode
>
( code ) ) {
34
case
StatusCode::ErrorCode::SUCCESS
:
35
return
"SUCCESS"
;
36
case
StatusCode::ErrorCode::FAILURE
:
37
return
"FAILURE"
;
38
case
StatusCode::ErrorCode::RECOVERABLE
:
39
return
"RECOVERABLE"
;
40
default
:
41
return
"UNKNOWN("
+ std::to_string( code ) +
")"
;
42
}
43
}
44
};
45
}
// namespace
46
47
STATUSCODE_ENUM_IMPL
(
StatusCode::ErrorCode
, DefaultCategory )
48
49
void
StatusCode
::
i_doThrow
(
std
::string_view
message
,
std
::string_view tag )
const
{
50
throw
GaudiException
{ std::string{
message
}, std::string{ tag }, *
this
};
51
}
Bootstrap.h
GaudiException.h
IMessageSvc.h
ISvcLocator.h
MsgStream.h
StatusCode.h
STATUSCODE_ENUM_IMPL
#define STATUSCODE_ENUM_IMPL(...)
Assign a category to the StatusCode enum declared with STATUSCODE_ENUM_DECL( ENUM ).
Definition
StatusCode.h:283
System.h
GaudiException
Define general base for Gaudi exception.
Definition
GaudiException.h:29
StatusCode::StatusCode
StatusCode()=default
Default constructor.
StatusCode::ErrorCode
ErrorCode
Definition
StatusCode.h:68
StatusCode::ErrorCode::FAILURE
@ FAILURE
Definition
StatusCode.h:68
StatusCode::ErrorCode::RECOVERABLE
@ RECOVERABLE
Definition
StatusCode.h:68
StatusCode::ErrorCode::SUCCESS
@ SUCCESS
Definition
StatusCode.h:68
StatusCode::code_t
unsigned long code_t
type of StatusCode value
Definition
StatusCode.h:66
StatusCode::message
std::string message() const
Description (or name) of StatusCode value.
Definition
StatusCode.h:212
StatusCode::RECOVERABLE
constexpr static const auto RECOVERABLE
Definition
StatusCode.h:101
StatusCode::i_doThrow
void i_doThrow(std::string_view message, std::string_view tag) const
Helper function to avoid circular dependency between GaudiException.h and StatusCode....
Definition
StatusCode.cpp:49
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition
StatusCode.h:100
std
STL namespace.
StatusCode::Category
The category assigned to a StatusCode.
Definition
StatusCode.h:77
GaudiKernel
src
Lib
StatusCode.cpp
Generated on
for The Gaudi Framework by
1.17.0