![]() |
The Gaudi Framework
v30r3 (a5ef0a68)
|
This class is used for returning status codes from appropriate routines. More...
#include <GaudiKernel/StatusCode.h>

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 = typename std::enable_if<is_StatusCode_enum<T>::value>::type> | |
| 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... | |
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:
STATUSCODE_ENUM_DECL( MyEnum )STATUSCODE_ENUM_IMPL( MyEnum, MyCategory ) in a .cpp fileDefinition at line 51 of file StatusCode.h.
| typedef unsigned long StatusCode::code_t |
type of StatusCode value
Definition at line 54 of file StatusCode.h.
|
strong |
|
default |
Default constructor.
|
inlinenoexcept |
Constructor from enum type (allowing implicit conversion)
Definition at line 96 of file StatusCode.h.
|
inlineexplicitnoexcept |
Constructor from code_t in the default category (explicit conversion only)
Definition at line 103 of file StatusCode.h.
|
inlineexplicitnoexcept |
Constructor from code_t and category (explicit conversion only)
Definition at line 110 of file StatusCode.h.
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Destructor.
Definition at line 125 of file StatusCode.h.
|
private |
Do StatusCode check.
Definition at line 46 of file StatusCode.cpp.
|
inline |
|
static |
Definition at line 44 of file StatusCode.cpp.
|
inlinestaticnoexcept |
Default Gaudi StatusCode category.
Definition at line 282 of file StatusCode.h.
|
inlineprivate |
Project onto the default StatusCode values.
Definition at line 299 of file StatusCode.h.
|
static |
Definition at line 42 of file StatusCode.cpp.
|
static |
Definition at line 40 of file StatusCode.cpp.
|
inline |
|
inline |
|
inline |
Ignore/check StatusCode.
Definition at line 165 of file StatusCode.h.
|
inline |
Definition at line 170 of file StatusCode.h.
|
inline |
Definition at line 139 of file StatusCode.h.
|
inline |
Definition at line 293 of file StatusCode.h.
|
inline |
Definition at line 287 of file StatusCode.h.
|
inline |
Description (or name) of StatusCode value.
Definition at line 183 of file StatusCode.h.
|
inlineexplicit |
|
inline |
Ternary logic operator with RECOVERABLE being the "third" state.
Definition at line 317 of file StatusCode.h.
|
inlinenoexcept |
Definition at line 130 of file StatusCode.h.
|
inline |
Ternary logic operator with RECOVERABLE being the "third" state.
Definition at line 329 of file StatusCode.h.
|
inline |
Check/uncheck StatusCode.
Definition at line 153 of file StatusCode.h.
|
inline |
Definition at line 158 of file StatusCode.h.
|
friend |
Definition at line 195 of file StatusCode.h.
|
friend |
|
friend |
Definition at line 185 of file StatusCode.h.
|
friend |
Check if StatusCode value and category are the same.
0(FAILURE) and 1(SUCCESS) the category is ignored sc==StatusCode::SUCCESS is equivalent to sc.isSuccess() for all categories Definition at line 307 of file StatusCode.h.
|
static |
Definition at line 88 of file StatusCode.h.
|
private |
The status code category.
Definition at line 243 of file StatusCode.h.
|
mutableprivate |
If the StatusCode has been checked.
Definition at line 245 of file StatusCode.h.
|
private |
The status code value.
Definition at line 244 of file StatusCode.h.
|
static |
Definition at line 89 of file StatusCode.h.
|
staticprivate |
Global flag to control if StatusCode need to be checked.
Definition at line 246 of file StatusCode.h.
|
static |
Definition at line 87 of file StatusCode.h.