| The Gaudi Framework v32r1 (f65d50dc)

Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
StatusCode Class Referencefinal

This class is used for returning status codes from appropriate routines. More...

`#include <GaudiKernel/StatusCode.h>`

Collaboration diagram for StatusCode:
[legend]

## Classes
class | Category
| The category assigned to a StatusCode. More...
class | ScopedDisableChecking
| Simple RAII class to ignore unchecked StatusCode instances in a scope. More...

## Public Types
enum | ErrorCode : code_t { ErrorCode::FAILURE = 0, ErrorCode::SUCCESS = 1, ErrorCode::RECOVERABLE = 2 }
typedef unsigned long | code_t
| type of StatusCode value More...

## Public Member Functions
| StatusCode ()=default
| Default constructor. More...
template<typename T , typename = std::enable_if_t<is_StatusCode_enum<T>::value>>
| StatusCode (T sc, bool checked=false) noexcept
| Constructor from enum type (allowing implicit conversion) More...
| StatusCode (code_t code, const StatusCode::Category &cat=default_category(), bool checked=false) noexcept
| Constructor from code_t in the default category (explicit conversion only) More...
| StatusCode (code_t code, bool checked) noexcept
| Constructor from code_t and category (explicit conversion only) More...
| StatusCode (const StatusCode &rhs) noexcept
| Copy constructor. More...
| StatusCode (StatusCode &&rhs) noexcept
| Move constructor. More...
| ~StatusCode ()
| Destructor. More...
StatusCode & | operator= (const StatusCode &rhs) noexcept
bool | isSuccess () const
bool | isFailure () const
bool | isRecoverable () const
| operator bool () const
| Shorthand for isSuccess() More...
code_t | getCode () const
| Retrieve value ("checks" the StatusCode) More...
const StatusCode & | setChecked (bool checked=true) const
| Check/uncheck StatusCode. More...
StatusCode & | setChecked (bool checked=true)
const StatusCode & | ignore () const
| Ignore/check StatusCode. More...
StatusCode & | ignore ()
bool | checked () const
| Has the StatusCode been checked? More...
const StatusCode::Category & | getCategory () const
| Retrieve category (does not "check" the StatusCode) More...
std::string | message () const
| Description (or name) of StatusCode value. More...
StatusCode & | operator&= (const StatusCode &rhs)
| Ternary logic operator with RECOVERABLE being the "third" state. More...
StatusCode & | operator|= (const StatusCode &rhs)
| Ternary logic operator with RECOVERABLE being the "third" state. More...

## Static Public Member Functions
static const Category & | default_category () noexcept
| Default Gaudi StatusCode category. More...
static GAUDI_API void | enableChecking ()
static GAUDI_API void | disableChecking ()
static GAUDI_API bool | checkingEnabled ()

## Static Public Attributes
constexpr static const auto | SUCCESS = ErrorCode::SUCCESS
constexpr static const auto | FAILURE = ErrorCode::FAILURE
constexpr static const auto | RECOVERABLE = ErrorCode::RECOVERABLE

## Private Member Functions
ErrorCode | default_value () const
| Project onto the default StatusCode values. More...
void | check ()
| Do StatusCode check. More...

## Private Attributes
const Category * | m_cat {&default_category()}
| The status code category. More...
code_t | m_code {static_cast<code_t>( ErrorCode::SUCCESS )}
| The status code value. More...
bool | m_checked {false}
| If the StatusCode has been checked. More...

## Static Private Attributes
static bool | s_checking
| Global flag to control if StatusCode need to be checked. More...

## Friends
std::ostream & | operator<< (std::ostream &s, const StatusCode &sc)
bool | operator== (const StatusCode &lhs, const StatusCode &rhs)
| Check if StatusCode value and category are the same. More...
bool | operator!= (const StatusCode &lhs, const StatusCode &rhs)
bool | operator< (const StatusCode &lhs, const StatusCode &rhs)
| Comparison (values are grouped by category first) More...

## Detailed Description

This class is used for returning status codes from appropriate routines.

A StatusCode is comprised of an (integer) value and a category (similar to std::error_code). By default StatusCodes are created within a default StatusCode::Category, which defines the isSuccess(), isFailure() and isRecoverable() behaviour depending on the value of the StatusCode. This behaviour can be modified by defining a custom StatusCode::Category and overriding the respective methods.

To define a new StatusCode::Category, do the following:

- Define an enum class with the values of the StatusCode
- Register the enum with `STATUSCODE_ENUM_DECL( MyEnum )`
- Derive your category from StatusCode::Category and implement/override the relevant methods
- Register the new category with `STATUSCODE_ENUM_IMPL( MyEnum, MyCategory )` in a .cpp file

Combining StatusCodes
  - The bitwise logic operators (&, |, &=, |=) can be used to combine StatusCodes and follows three-valued (ternary) logic with RECOVERABLE being the third state. No short-circuiting is applied:
    StatusCode sc = sc1 & sc2;
    sc |= sc3;
  - The boolean logic operators (&&, ||) perform regular two-valued logic only considering success/failure. The usual short-circuiting applies:
    bool b = sc1 && sc2;

Note
  The StatusCode values 0 and 1 are considered FAILURE/SUCCESS for all categories, i.e.
  - operator==() and operator!=() ignore the category for these two values
  - isSuccess() and isFailure() cannot be overridden for these two values

Remarks
  See https://akrzemi1.wordpress.com/2017/07/12/your-own-error-code for details on the underlying design

Definition at line 50 of file StatusCode.h.

## Member Typedef Documentation

## ◆ code_t

typedef unsigned long StatusCode::code_t

type of StatusCode value

Definition at line 52 of file StatusCode.h.

## Member Enumeration Documentation

## ◆ ErrorCode

enum StatusCode::ErrorCode : code_t
| strong

Enumerator
FAILURE |
SUCCESS |
RECOVERABLE |

Definition at line 54 of file StatusCode.h.

54 : code_t { FAILURE = 0, SUCCESS = 1, RECOVERABLE = 2 };
StatusCode::RECOVERABLE
constexpr static const auto RECOVERABLE
Definition: StatusCode.h:87
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
StatusCode::code_t
unsigned long code_t
type of StatusCode value
Definition: StatusCode.h:52

## Constructor & Destructor Documentation

## ◆ StatusCode() [1/6]

StatusCode::StatusCode | ( |  | ) |
| default

Default constructor.

## ◆ StatusCode() [2/6]

template<typename T , typename = std::enable_if_t<is_StatusCode_enum<T>::value>>

StatusCode::StatusCode | ( | T | sc,
|  | bool | checked = `false`
| ) |  |
| inline noexcept

Constructor from enum type (allowing implicit conversion)

Definition at line 94 of file StatusCode.h.

94 {
95 *this = StatusCode( static_cast<StatusCode::code_t>( sc ), is_StatusCode_enum<T>::instance );
96 m_checked = checked;
97 }
StatusCode::checked
bool checked() const
Has the StatusCode been checked?
Definition: StatusCode.h:163
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
is_StatusCode_enum
Definition: StatusCode.h:12
StatusCode::StatusCode
StatusCode()=default
Default constructor.

## ◆ StatusCode() [3/6]

StatusCode::StatusCode | ( | code_t | code,
|  | const StatusCode::Category & | cat = `default_category()`,
|  | bool | checked = `false`
| ) |  |
| inline explicit noexcept

Constructor from code_t in the default category (explicit conversion only)

Definition at line 100 of file StatusCode.h.

102 : m_cat( &cat ), m_code( code ), m_checked( checked ) {}
StatusCode::checked
bool checked() const
Has the StatusCode been checked?
Definition: StatusCode.h:163
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
StatusCode::m_cat
const Category * m_cat
The status code category.
Definition: StatusCode.h:224

## ◆ StatusCode() [4/6]

StatusCode::StatusCode | ( | code_t | code,
|  | bool | checked
| ) |  |
| inline explicit noexcept

Constructor from code_t and category (explicit conversion only)

Definition at line 105 of file StatusCode.h.

105 : StatusCode( code, default_category(), checked ) {}
StatusCode::checked
bool checked() const
Has the StatusCode been checked?
Definition: StatusCode.h:163
StatusCode::default_category
static const Category & default_category() noexcept
Default Gaudi StatusCode category.
Definition: StatusCode.h:263
StatusCode::StatusCode
StatusCode()=default
Default constructor.

## ◆ StatusCode() [5/6]

StatusCode::StatusCode | ( | const StatusCode & | rhs | ) |
| inline noexcept

Copy constructor.

Definition at line 108 of file StatusCode.h.

108 : m_cat( rhs.m_cat ), m_code( rhs.m_code ), m_checked( rhs.m_checked ) {
109 rhs.m_checked = true;
110 }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
StatusCode::m_cat
const Category * m_cat
The status code category.
Definition: StatusCode.h:224

## ◆ StatusCode() [6/6]

StatusCode::StatusCode | ( | StatusCode && | rhs | ) |
| inline noexcept

Move constructor.

Definition at line 113 of file StatusCode.h.

113 : m_cat( rhs.m_cat ), m_code( rhs.m_code ), m_checked( rhs.m_checked ) {
114 rhs.m_checked = true;
115 }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
StatusCode::m_cat
const Category * m_cat
The status code category.
Definition: StatusCode.h:224

## ◆ ~StatusCode()

StatusCode::~StatusCode | ( |  | ) |
| inline

Destructor.

Definition at line 118 of file StatusCode.h.

118 {
119 if ( UNLIKELY( s_checking ) ) check();
120 }
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:96
StatusCode::check
void check()
Do StatusCode check.
Definition: StatusCode.cpp:48
StatusCode::s_checking
static bool s_checking
Global flag to control if StatusCode need to be checked.
Definition: StatusCode.h:227

## Member Function Documentation

## ◆ check()

void StatusCode::check | ( |  | ) |
| private

Do StatusCode check.

Fix-Me:
  : (MCl) use backTrace(std::string&, const int, const int) instead

Definition at line 48 of file StatusCode.cpp.

48 {
49
50 if ( !m_checked && !GaudiException::s_proc && !std::uncaught_exceptions() ) {
51
52 auto msg = Gaudi::svcLocator()->as<IMessageSvc>();
53 auto scs = Gaudi::svcLocator()->service<IStatusCodeSvc>( "StatusCodeSvc" );
54
55 const size_t depth = 21;
56 void* addresses[depth];
57
58 std::string lib, fnc;
59 void* addr = nullptr;
61 if ( System::backTrace( addresses, depth ) ) {
62
63 for ( size_t idx : {2, 3} ) {
64 // When running address sanitizer builds with -fno-omit-frame-pointer
65 // StatusCode::check() might appear as the function name, so skip.
66 if ( System::getStackLevel( addresses[idx], addr, fnc, lib ) && fnc != "StatusCode::~StatusCode()" &&
67 fnc != "StatusCode::check()" ) {
68 if ( scs ) {
69 scs->regFnc( fnc, lib );
70 } else {
71 MsgStream log( msg, "StatusCode" );
72 log << MSG::WARNING << "Unchecked in " << fnc << " (" << lib << ")" << endmsg;
73 }
74 break;
75 }
76 }
77 }
78 }
79 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
System::getStackLevel
GAUDI_API bool getStackLevel(void *addresses, void *&addr, std::string &fnc, std::string &lib)
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
GaudiException::s_proc
static bool s_proc
"previous" element in the linked list
Definition: GaudiException.h:108
AvalancheSchedulerErrorTest.scs
scs
Definition: AvalancheSchedulerErrorTest.py:31
ISvcLocator::as
SmartIF< IFace > as()
Definition: ISvcLocator.h:103
System::backTrace
GAUDI_API int backTrace(void **addresses, const int depth)
std::string
STL class.
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:76
Gaudi::svcLocator
GAUDI_API ISvcLocator * svcLocator()
IMessageSvc
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:37
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:8
MSG::WARNING
Definition: IMessageSvc.h:15
IStatusCodeSvc
Definition: IStatusCodeSvc.h:7
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
Gaudi.Configuration.log
log
Definition: Configuration.py:13

## ◆ checked()

bool StatusCode::checked | ( |  | ) | const
| inline

Has the StatusCode been checked?

Definition at line 163 of file StatusCode.h.

163 { return m_checked; }
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226

## ◆ checkingEnabled()

bool StatusCode::checkingEnabled | ( |  | ) |
| static

Definition at line 46 of file StatusCode.cpp.

46 { return s_checking; }
StatusCode::s_checking
static bool s_checking
Global flag to control if StatusCode need to be checked.
Definition: StatusCode.h:227

## ◆ default_category()

const StatusCode::Category & StatusCode::default_category | ( |  | ) |
| inline static noexcept

Default Gaudi StatusCode category.

Definition at line 263 of file StatusCode.h.

263 {
264 return is_StatusCode_enum<StatusCode::ErrorCode>::instance;
265 }
is_StatusCode_enum
Definition: StatusCode.h:12

## ◆ default_value()

StatusCode::ErrorCode StatusCode::default_value | ( |  | ) | const
| inline private

Project onto the default StatusCode values.

Definition at line 277 of file StatusCode.h.

277 {
278 bool save_checked = m_checked; // Preserve checked status
279 auto r = isSuccess() ? ErrorCode::SUCCESS : ( isRecoverable() ? ErrorCode::RECOVERABLE : ErrorCode::FAILURE );
280 m_checked = save_checked;
281 return r;
282 }
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
StatusCode::ErrorCode::SUCCESS
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
StatusCode::ErrorCode::FAILURE
StatusCode::ErrorCode::RECOVERABLE
StatusCode::isRecoverable
bool isRecoverable() const
Definition: StatusCode.h:272

## ◆ disableChecking()

void StatusCode::disableChecking | ( |  | ) |
| static

Definition at line 44 of file StatusCode.cpp.

44 { s_checking = false; }
StatusCode::s_checking
static bool s_checking
Global flag to control if StatusCode need to be checked.
Definition: StatusCode.h:227

## ◆ enableChecking()

void StatusCode::enableChecking | ( |  | ) |
| static

Definition at line 42 of file StatusCode.cpp.

42 { s_checking = true; }
StatusCode::s_checking
static bool s_checking
Global flag to control if StatusCode need to be checked.
Definition: StatusCode.h:227

## ◆ getCategory()

const StatusCode::Category& StatusCode::getCategory | ( |  | ) | const
| inline

Retrieve category (does not "check" the StatusCode)

Definition at line 166 of file StatusCode.h.

166 { return *m_cat; }
StatusCode::m_cat
const Category * m_cat
The status code category.
Definition: StatusCode.h:224

## ◆ getCode()

code_t StatusCode::getCode | ( |  | ) | const
| inline

Retrieve value ("checks" the StatusCode)

Definition at line 137 of file StatusCode.h.

137 {
138 m_checked = true;
139 return m_code;
140 }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226

## ◆ ignore() [1/2]

const StatusCode& StatusCode::ignore | ( |  | ) | const
| inline

Ignore/check StatusCode.

Definition at line 153 of file StatusCode.h.

153 {
154 setChecked( true );
155 return *this;
156 }
StatusCode::setChecked
const StatusCode & setChecked(bool checked=true) const
Check/uncheck StatusCode.
Definition: StatusCode.h:143

## ◆ ignore() [2/2]

StatusCode& StatusCode::ignore | ( |  | ) |
| inline

Definition at line 157 of file StatusCode.h.

157 {
158 setChecked( true );
159 return *this;
160 }
StatusCode::setChecked
const StatusCode & setChecked(bool checked=true) const
Check/uncheck StatusCode.
Definition: StatusCode.h:143

## ◆ isFailure()

bool StatusCode::isFailure | ( |  | ) | const
| inline

Definition at line 130 of file StatusCode.h.

130 { return !isSuccess(); }
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267

## ◆ isRecoverable()

bool StatusCode::isRecoverable | ( |  | ) | const
| inline

Definition at line 272 of file StatusCode.h.

272 {
273 m_checked = true;
274 return m_cat->isRecoverable( m_code );
275 }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
StatusCode::Category::isRecoverable
virtual bool isRecoverable(code_t code) const
Is code considered recoverable ?
Definition: StatusCode.h:78
StatusCode::m_cat
const Category * m_cat
The status code category.
Definition: StatusCode.h:224

## ◆ isSuccess()

bool StatusCode::isSuccess | ( |  | ) | const
| inline

Definition at line 267 of file StatusCode.h.

267 {
268 m_checked = true;
269 return ( m_code == static_cast<code_t>( ErrorCode::SUCCESS ) || m_cat->isSuccess( m_code ) );
270 }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
StatusCode::ErrorCode::SUCCESS
StatusCode::Category::isSuccess
virtual bool isSuccess(code_t code) const
Is code considered success ?
Definition: StatusCode.h:75
StatusCode::m_cat
const Category * m_cat
The status code category.
Definition: StatusCode.h:224

## ◆ message()

std::string StatusCode::message | ( |  | ) | const
| inline

Description (or name) of StatusCode value.

Definition at line 169 of file StatusCode.h.

169 { return getCategory().message( m_code ); }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::getCategory
const StatusCode::Category & getCategory() const
Retrieve category (does not "check" the StatusCode)
Definition: StatusCode.h:166
StatusCode::Category::message
virtual std::string message(code_t code) const
Description for code within this category.
Definition: StatusCode.h:71

## ◆ operator bool()

StatusCode::operator bool | ( |  | ) | const
| inline explicit

Shorthand for isSuccess()

Definition at line 134 of file StatusCode.h.

134 { return isSuccess(); }
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267

## ◆ operator&=()

StatusCode & StatusCode::operator&= | ( | const StatusCode & | rhs | ) |
| inline

Ternary logic operator with RECOVERABLE being the "third" state.

Definition at line 293 of file StatusCode.h.

293 {
294 // Ternary AND lookup matrix
295 static constexpr StatusCode::code_t AND[3][3] = {{0, 0, 0}, {0, 1, 2}, {0, 2, 2}};
296
297 StatusCode::code_t l = static_cast<StatusCode::code_t>( default_value() );
298 StatusCode::code_t r = static_cast<StatusCode::code_t>( rhs.default_value() );
299 m_code = AND[l][r];
300 rhs.m_checked = true;
301 return *this;
302 }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
gaudirun.l
dictionary l
Definition: gaudirun.py:521
StatusCode::default_value
ErrorCode default_value() const
Project onto the default StatusCode values.
Definition: StatusCode.h:277
StatusCode::code_t
unsigned long code_t
type of StatusCode value
Definition: StatusCode.h:52

## ◆ operator=()

StatusCode& StatusCode::operator= | ( | const StatusCode & | rhs | ) |
| inline noexcept

Definition at line 122 of file StatusCode.h.

122 {
123 m_cat = rhs.m_cat;
124 m_code = rhs.m_code;
125 m_checked = std::exchange( rhs.m_checked, true );
126 return *this;
127 }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
StatusCode::m_cat
const Category * m_cat
The status code category.
Definition: StatusCode.h:224

## ◆ operator|=()

StatusCode & StatusCode::operator|= | ( | const StatusCode & | rhs | ) |
| inline

Ternary logic operator with RECOVERABLE being the "third" state.

Definition at line 304 of file StatusCode.h.

304 {
305 // Ternary OR lookup matrix
306 static constexpr StatusCode::code_t OR[3][3] = {{0, 1, 2}, {1, 1, 1}, {2, 1, 2}};
307
308 StatusCode::code_t l = static_cast<StatusCode::code_t>( default_value() );
309 StatusCode::code_t r = static_cast<StatusCode::code_t>( rhs.default_value() );
310 m_code = OR[l][r];
311 rhs.m_checked = true;
312 return *this;
313 }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
gaudirun.l
dictionary l
Definition: gaudirun.py:521
StatusCode::default_value
ErrorCode default_value() const
Project onto the default StatusCode values.
Definition: StatusCode.h:277
StatusCode::code_t
unsigned long code_t
type of StatusCode value
Definition: StatusCode.h:52

## ◆ setChecked() [1/2]

const StatusCode& StatusCode::setChecked | ( | bool | checked = `true` | ) | const
| inline

Check/uncheck StatusCode.

Definition at line 143 of file StatusCode.h.

143 {
144 m_checked = checked;
145 return *this;
146 }
StatusCode::checked
bool checked() const
Has the StatusCode been checked?
Definition: StatusCode.h:163
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226

## ◆ setChecked() [2/2]

StatusCode& StatusCode::setChecked | ( | bool | checked = `true` | ) |
| inline

Definition at line 147 of file StatusCode.h.

147 {
148 m_checked = checked;
149 return *this;
150 }
StatusCode::checked
bool checked() const
Has the StatusCode been checked?
Definition: StatusCode.h:163
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226

## Friends And Related Function Documentation

## ◆ operator!=

bool operator!= | ( | const StatusCode & | lhs,
|  | const StatusCode & | rhs
| ) |  |
| friend

Definition at line 180 of file StatusCode.h.

180 { return !( lhs == rhs ); }

## ◆ operator<

bool operator< | ( | const StatusCode & | lhs,
|  | const StatusCode & | rhs
| ) |  |
| friend

Comparison (values are grouped by category first)

Definition at line 183 of file StatusCode.h.

183 {
184 lhs.m_checked = true;
185 rhs.m_checked = true;
186 return ( lhs.m_cat < rhs.m_cat || ( lhs.m_cat == rhs.m_cat && lhs.m_code < rhs.m_code ) );
187 }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
StatusCode::m_cat
const Category * m_cat
The status code category.
Definition: StatusCode.h:224

## ◆ operator<<

std::ostream& operator<< | ( | std::ostream & | s,
|  | const StatusCode & | sc
| ) |  |
| friend

Definition at line 171 of file StatusCode.h.

171 {
172 s << sc.message();
173 return s;
174 }
StatusCode::message
std::string message() const
Description (or name) of StatusCode value.
Definition: StatusCode.h:169
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ operator==

bool operator== | ( | const StatusCode & | lhs,
|  | const StatusCode & | rhs
| ) |  |
| friend

Check if StatusCode value and category are the same.

Note
  For code values `0(FAILURE)` and `1(SUCCESS)` the category is ignored
  e.g. `sc==StatusCode::SUCCESS` is equivalent to `sc.isSuccess()` for all categories

Definition at line 284 of file StatusCode.h.

284 {
285 lhs.m_checked = true;
286 rhs.m_checked = true;
287 return ( lhs.m_code == rhs.m_code ) &&
288 ( lhs.m_code == static_cast<StatusCode::code_t>( StatusCode::ErrorCode::SUCCESS ) ||
289 lhs.m_code == static_cast<StatusCode::code_t>( StatusCode::ErrorCode::FAILURE ) ||
290 ( lhs.m_cat == rhs.m_cat ) );
291 }
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:225
StatusCode::m_checked
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:226
StatusCode::ErrorCode::SUCCESS
StatusCode::ErrorCode::FAILURE
StatusCode::m_cat
const Category * m_cat
The status code category.
Definition: StatusCode.h:224

## Member Data Documentation

## ◆ FAILURE

constexpr const StatusCode::ErrorCode StatusCode::FAILURE = ErrorCode::FAILURE
| static

Definition at line 86 of file StatusCode.h.

## ◆ m_cat

const Category* StatusCode::m_cat {&default_category()}
| private

The status code category.

Definition at line 224 of file StatusCode.h.

## ◆ m_checked

bool StatusCode::m_checked {false}
| mutable private

If the StatusCode has been checked.

Definition at line 226 of file StatusCode.h.

## ◆ m_code

code_t StatusCode::m_code {static_cast<code_t>( ErrorCode::SUCCESS )}
| private

The status code value.

Definition at line 225 of file StatusCode.h.

## ◆ RECOVERABLE

constexpr const StatusCode::ErrorCode StatusCode::RECOVERABLE = ErrorCode::RECOVERABLE
| static

Definition at line 87 of file StatusCode.h.

## ◆ s_checking

bool StatusCode::s_checking
| static private

Global flag to control if StatusCode need to be checked.

Definition at line 227 of file StatusCode.h.

## ◆ SUCCESS

constexpr const StatusCode::ErrorCode StatusCode::SUCCESS = ErrorCode::SUCCESS
| static

Definition at line 85 of file StatusCode.h.

The documentation for this class was generated from the following files:

- GaudiKernel/GaudiKernel/StatusCode.h
- GaudiKernel/src/Lib/StatusCode.cpp