|
Gaudi Framework, version v22r2 |
| Home | Generated: Tue May 10 2011 |
This class is used for returning status codes from appropriate routines. More...
#include <GaudiKernel/StatusCode.h>
Public Types | |
| enum | { FAILURE = 0, SUCCESS = 1, RECOVERABLE = 2 } |
Public Member Functions | |
| StatusCode () | |
| Constructor. | |
| StatusCode (unsigned long code, const IssueSeverity &sev) | |
| StatusCode (unsigned long code, bool checked=false) | |
| StatusCode (const StatusCode &rhs) | |
| GAUDI_API | ~StatusCode () |
| Destructor. | |
| bool | isSuccess () const |
| Test for a status code of SUCCESS. | |
| bool | isFailure () const |
| Test for a status code of FAILURE. | |
| bool | isRecoverable () const |
| unsigned long | getCode () const |
| Get the status code by value. | |
| void | setCode (unsigned long value) |
| Set the status code by value. | |
| void | setChecked () const |
| Ignore the checking code;. | |
| void | ignore () const |
| operator unsigned long () const | |
| Cast operator. | |
| GAUDI_API const IssueSeverity & | severity () const |
| Severity. | |
| StatusCode & | operator= (unsigned long value) |
| Assignment operator. | |
| StatusCode & | operator= (const StatusCode &rhs) |
| operator IgnoreError () const | |
Static Public Member Functions | |
| static GAUDI_API void | enableChecking () |
| static GAUDI_API void | disableChecking () |
Protected Types | |
| typedef boost::shared_ptr < IssueSeverity > | SeverityPtr |
Protected Attributes | |
| unsigned long | d_code |
| The status code. | |
| bool | m_checked |
| If the Status code has been checked. | |
| SeverityPtr | m_severity |
| Pointer to a IssueSeverity. | |
Static Protected Attributes | |
| static bool | s_checking |
| Global flag to control if StatusCode need to be checked. | |
Friends | |
| bool | operator< (const StatusCode &a, const StatusCode &b) |
| Comparison operator. | |
| bool | operator> (const StatusCode &a, const StatusCode &b) |
| Comparison operator. | |
This class is used for returning status codes from appropriate routines.
Definition at line 26 of file StatusCode.h.
typedef boost::shared_ptr<IssueSeverity> StatusCode::SeverityPtr [protected] |
Definition at line 136 of file StatusCode.h.
| anonymous enum |
Definition at line 28 of file StatusCode.h.
{
FAILURE = 0,
SUCCESS = 1,
RECOVERABLE = 2
};
| StatusCode::StatusCode | ( | ) | [inline] |
Constructor.
Definition at line 35 of file StatusCode.h.
:
d_code(SUCCESS), m_checked(false), m_severity() {}
| StatusCode::StatusCode | ( | unsigned long | code, |
| const IssueSeverity & | sev | ||
| ) | [inline] |
Definition at line 37 of file StatusCode.h.
:
d_code(code),m_checked(false), m_severity() {
try { // ensure that we do not throw even if the we cannot copy the severity
m_severity = SeverityPtr(new IssueSeverity(sev));
}
catch (...) {}
}
| StatusCode::StatusCode | ( | unsigned long | code, |
| bool | checked = false |
||
| ) | [inline] |
Definition at line 44 of file StatusCode.h.
:
d_code(code),m_checked(checked), m_severity() {}
| StatusCode::StatusCode | ( | const StatusCode & | rhs ) | [inline] |
Definition at line 47 of file StatusCode.h.
:
d_code(rhs.d_code), m_checked(rhs.m_checked),
m_severity(rhs.m_severity)
{ rhs.m_checked = true; }
| StatusCode::~StatusCode | ( | ) |
Destructor.
: (MCl) use backTrace(std::string&, const int, const int) instead
Definition at line 32 of file StatusCode.cpp.
{
if(s_checking) {
if (!m_checked && !GaudiException::s_proc) {
SmartIF<IMessageSvc> msg(Gaudi::svcLocator());
SmartIF<IStatusCodeSvc> scs(Gaudi::svcLocator()->service("StatusCodeSvc"));
const size_t depth = 21;
void* addresses[depth];
std::string lib, fnc;
void* addr = 0;
if (System::backTrace(addresses, depth)) {
if (System::getStackLevel(addresses[2], addr, fnc, lib)) {
if (scs) {
scs->regFnc(fnc,lib);
} else {
if (msg) {
MsgStream log(msg,"StatusCode");
log << MSG::WARNING << "Unchecked in " << fnc << " " << lib << endmsg;
} else {
std::cout << MSG::WARNING << "Unchecked in " << fnc << " " << lib << std::endl;
}
}
}
}
}
}
}
| void StatusCode::disableChecking | ( | ) | [static] |
Definition at line 22 of file StatusCode.cpp.
{
s_checking = false;
}
| void StatusCode::enableChecking | ( | ) | [static] |
Definition at line 18 of file StatusCode.cpp.
{
s_checking = true;
}
| unsigned long StatusCode::getCode | ( | ) | const [inline] |
Get the status code by value.
Definition at line 75 of file StatusCode.h.
| void StatusCode::ignore | ( | ) | const [inline] |
Definition at line 90 of file StatusCode.h.
{ setChecked(); }
| bool StatusCode::isFailure | ( | ) | const [inline] |
Test for a status code of FAILURE.
N.B. This is a specific type of failure where there aren't any more appropriate status codes. To test for any failure use : if ( !StatusCode.isSuccess() ) ...
Definition at line 68 of file StatusCode.h.
{ return !isSuccess(); }
| bool StatusCode::isRecoverable | ( | ) | const [inline] |
Definition at line 69 of file StatusCode.h.
{
m_checked = true;
return (d_code == RECOVERABLE);
}
| bool StatusCode::isSuccess | ( | ) | const [inline] |
| StatusCode::operator IgnoreError | ( | ) | const [inline] |
Definition at line 123 of file StatusCode.h.
{
m_checked = true;
return IgnoreError();
}
| StatusCode::operator unsigned long | ( | ) | const [inline] |
| StatusCode& StatusCode::operator= | ( | const StatusCode & | rhs ) | [inline] |
Definition at line 103 of file StatusCode.h.
{
if (this == &rhs) return *this; // Protection against self-assignment
d_code = rhs.d_code;
m_checked = rhs.m_checked;
rhs.m_checked = true;
m_severity = rhs.m_severity;
return *this;
}
| StatusCode& StatusCode::operator= | ( | unsigned long | value ) | [inline] |
| void StatusCode::setChecked | ( | ) | const [inline] |
| void StatusCode::setCode | ( | unsigned long | value ) | [inline] |
Set the status code by value.
Definition at line 81 of file StatusCode.h.
| const IssueSeverity & StatusCode::severity | ( | ) | const |
Severity.
Definition at line 26 of file StatusCode.cpp.
{
static IssueSeverity dummy;
if (m_severity) return *m_severity;
else return dummy;
}
| bool operator< | ( | const StatusCode & | a, |
| const StatusCode & | b | ||
| ) | [friend] |
| bool operator> | ( | const StatusCode & | a, |
| const StatusCode & | b | ||
| ) | [friend] |
unsigned long StatusCode::d_code [protected] |
bool StatusCode::m_checked [mutable, protected] |
If the Status code has been checked.
Definition at line 135 of file StatusCode.h.
SeverityPtr StatusCode::m_severity [protected] |
Pointer to a IssueSeverity.
Definition at line 137 of file StatusCode.h.
bool StatusCode::s_checking [static, protected] |
Global flag to control if StatusCode need to be checked.
Definition at line 139 of file StatusCode.h.