The Gaudi Framework  master (37c0b60a)
StatusCode.h File Reference
#include <boost/preprocessor/facilities/overload.hpp>
#include <functional>
#include <ostream>
#include <type_traits>
#include <utility>
#include <GaudiKernel/Kernel.h>
Include dependency graph for StatusCode.h:

Go to the source code of this file.

Classes

struct  is_StatusCode_enum< T >
 
class  StatusCode
 
class  StatusCode::Category
 

Macros

#define STATUSCODE_ENUM_DECL(ENUM)
 Declare an enum to be used as StatusCode value. More...
 
#define STATUSCODE_ENUM_IMPL(...)   BOOST_PP_OVERLOAD( STATUSCODE_ENUM_IMPL_, __VA_ARGS__ )( __VA_ARGS__ )
 Assign a category to the StatusCode enum declared with STATUSCODE_ENUM_DECL( ENUM ) More...
 
#define STATUSCODE_ENUM_IMPL_1(ENUM)   const StatusCode::Category& is_StatusCode_enum<ENUM>::instance = StatusCode::default_category();
 
#define STATUSCODE_ENUM_IMPL_2(ENUM, CATEGORY)   const StatusCode::Category& is_StatusCode_enum<ENUM>::instance = CATEGORY{};
 

Functions

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

Macro Definition Documentation

◆ STATUSCODE_ENUM_DECL

#define STATUSCODE_ENUM_DECL (   ENUM)
Value:
template <> \
static const StatusCode::Category& instance; \
};

Declare an enum to be used as StatusCode value.

Parameters
ENUMenum class

Definition at line 287 of file StatusCode.h.

◆ STATUSCODE_ENUM_IMPL

#define STATUSCODE_ENUM_IMPL (   ...)    BOOST_PP_OVERLOAD( STATUSCODE_ENUM_IMPL_, __VA_ARGS__ )( __VA_ARGS__ )

Assign a category to the StatusCode enum declared with STATUSCODE_ENUM_DECL( ENUM )

Parameters
ENUMenum class
CATEGORY(optional) category, otherwise use default StatusCode category

Definition at line 296 of file StatusCode.h.

◆ STATUSCODE_ENUM_IMPL_1

#define STATUSCODE_ENUM_IMPL_1 (   ENUM)    const StatusCode::Category& is_StatusCode_enum<ENUM>::instance = StatusCode::default_category();

Definition at line 298 of file StatusCode.h.

◆ STATUSCODE_ENUM_IMPL_2

#define STATUSCODE_ENUM_IMPL_2 (   ENUM,
  CATEGORY 
)    const StatusCode::Category& is_StatusCode_enum<ENUM>::instance = CATEGORY{};

Definition at line 301 of file StatusCode.h.

Function Documentation

◆ operator==()

bool operator== ( const StatusCode lhs,
const StatusCode rhs 
)
inline
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 325 of file StatusCode.h.

325  {
326  return ( lhs.m_code == rhs.m_code ) &&
327  ( lhs.m_code == static_cast<StatusCode::code_t>( StatusCode::ErrorCode::SUCCESS ) ||
329  ( lhs.m_cat == rhs.m_cat ) );
330 }
StatusCode::ErrorCode::SUCCESS
@ SUCCESS
std::true_type
StatusCode::m_code
code_t m_code
The status code value.
Definition: StatusCode.h:260
StatusCode::code_t
unsigned long code_t
type of StatusCode value
Definition: StatusCode.h:67
StatusCode::Category
Definition: StatusCode.h:78
StatusCode::m_cat
const Category * m_cat
The status code category.
Definition: StatusCode.h:259
StatusCode::ErrorCode::FAILURE
@ FAILURE
is_StatusCode_enum
Definition: StatusCode.h:23