The Gaudi Framework  v30r3 (a5ef0a68)
StatusCode.h File Reference
#include "boost/preprocessor/facilities/overload.hpp"
#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
 This class is used for returning status codes from appropriate routines. More...
 
class  StatusCode::Category
 The category assigned to a StatusCode. More...
 
class  StatusCode::ScopedDisableChecking
 Simple RAII class to ignore unchecked StatusCode instances in a scope. More...
 

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)
 
StatusCode operator& (StatusCode lhs, const StatusCode &rhs)
 Ternary AND operator. More...
 
StatusCode operator| (StatusCode lhs, const StatusCode &rhs)
 Ternary OR operator. More...
 
bool & operator&= (bool &lhs, const StatusCode &sc)
 Boolean AND assignment operator. More...
 
bool & operator|= (bool &lhs, const StatusCode &sc)
 Boolean OR assignment operator. More...
 

Macro Definition Documentation

#define STATUSCODE_ENUM_DECL (   ENUM)
Value:
template <> \
static const StatusCode::Category& instance; \
};
The category assigned to a StatusCode.
Definition: StatusCode.h:65

Declare an enum to be used as StatusCode value.

Parameters
ENUMenum class

Definition at line 258 of file StatusCode.h.

#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 267 of file StatusCode.h.

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

Definition at line 269 of file StatusCode.h.

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

Definition at line 272 of file StatusCode.h.

Function Documentation

StatusCode operator& ( StatusCode  lhs,
const StatusCode rhs 
)
inline

Ternary AND operator.

Definition at line 342 of file StatusCode.h.

342 { return lhs &= rhs; }
bool& operator&= ( bool &  lhs,
const StatusCode sc 
)
inline

Boolean AND assignment operator.

Definition at line 348 of file StatusCode.h.

348 { return lhs &= sc.isSuccess(); }
bool isSuccess() const
Definition: StatusCode.h:287
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 307 of file StatusCode.h.

308 {
309  lhs.m_checked = true;
310  rhs.m_checked = true;
311  return ( lhs.m_code == rhs.m_code ) &&
312  ( lhs.m_code == static_cast<StatusCode::code_t>( StatusCode::ErrorCode::SUCCESS ) ||
313  lhs.m_code == static_cast<StatusCode::code_t>( StatusCode::ErrorCode::FAILURE ) ||
314  ( lhs.m_cat == rhs.m_cat ) );
315 }
code_t m_code
The status code value.
Definition: StatusCode.h:244
bool m_checked
If the StatusCode has been checked.
Definition: StatusCode.h:245
const Category * m_cat
The status code category.
Definition: StatusCode.h:243
unsigned long code_t
type of StatusCode value
Definition: StatusCode.h:54
StatusCode operator| ( StatusCode  lhs,
const StatusCode rhs 
)
inline

Ternary OR operator.

Definition at line 345 of file StatusCode.h.

345 { return lhs |= rhs; }
bool& operator|= ( bool &  lhs,
const StatusCode sc 
)
inline

Boolean OR assignment operator.

Definition at line 351 of file StatusCode.h.

351 { return lhs |= sc.isSuccess(); }
bool isSuccess() const
Definition: StatusCode.h:287