1 #ifndef GAUDIKERNEL_STATUSCODE_H
2 #define GAUDIKERNEL_STATUSCODE_H
6 #include "GaudiKernel/Kernel.h"
7 #include "GaudiKernel/IssueSeverity.h"
9 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
12 #include "boost/shared_ptr.hpp"
44 #if (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L) && ! defined(__GCCXML__)
45 m_severity = std::make_shared<IssueSeverity>(sev);
52 StatusCode(
unsigned long code,
bool checked =
false ):
57 m_severity(rhs.m_severity)
64 m_severity(
std::move(rhs.m_severity) )
65 { rhs.m_checked =
true; }
110 operator unsigned long()
const {
return getCode(); }
121 if (
this == &rhs)
return *
this;
164 class ScopedDisableChecking {
179 #if defined(__GCCXML__)
183 #elif defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
184 typedef std::shared_ptr<IssueSeverity>
SeverityPtr;
186 typedef boost::shared_ptr<IssueSeverity>
SeverityPtr;
198 if ( sc.
isSuccess() ) {
return s <<
"SUCCESS" ; }
199 else if ( sc.
isRecoverable() ) {
return s <<
"RECOVERABLE" ; }
202 { s <<
"(" << sc.
getCode() <<
")" ;}
206 #endif // GAUDIKERNEL_STATUSCODES_H
GAUDI_API const IssueSeverity & severity() const
Severity.
void setCode(unsigned long value)
Set the status code by value.
unsigned long getCode() const
Get the status code by value.
bool isSuccess() const
Test for a status code of SUCCESS.
bool m_checked
If the Status code has been checked.
SeverityPtr m_severity
Pointer to a IssueSeverity.
static bool s_checking
Global flag to control if StatusCode need to be checked.
static GAUDI_API void enableChecking()
static GAUDI_API bool checkingEnabled()
std::ostream & operator<<(std::ostream &s, const StatusCode &sc)
bool isFailure() const
Test for a status code of FAILURE.
friend bool operator<(const StatusCode &a, const StatusCode &b)
Comparison operator.
This class is used for returning status codes from appropriate routines.
The IMessage is the interface implemented by the message service.
unsigned long d_code
The status code.
bool isRecoverable() const
static GAUDI_API void disableChecking()
friend bool operator>(const StatusCode &a, const StatusCode &b)
Comparison operator.
boost::shared_ptr< IssueSeverity > SeverityPtr
void setChecked() const
Ignore the checking code;.
StatusCode & operator=(unsigned long value)
Assignment operator.