| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

RetCodeGuard.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_RETCODEGUARD_H
2 #define GAUDIHIVE_RETCODEGUARD_H
3
4 #include "GaudiKernel/IProperty.h"
5 #include "GaudiKernel/AppReturnCode.h"
6
9 class RetCodeGuard {
10 public:
11 inline RetCodeGuard(const SmartIF<IProperty> &appmgr, int retcode):
12 m_appmgr(appmgr), m_retcode(retcode) {}
13 inline void ignore() {
14 m_retcode = Gaudi::ReturnCode::Success;
15 }
16 inline ~RetCodeGuard() {
17 if (UNLIKELY(Gaudi::ReturnCode::Success != m_retcode)) {
18 Gaudi::setAppReturnCode(m_appmgr, m_retcode);
19 }
20 }
21 private:
22 SmartIF<IProperty> m_appmgr;
23 int m_retcode;
24 };
25
26 #endif
SmartIF< IProperty >
RetCodeGuard
Helper class to set the application return code in case of early exit (e.g.
Definition: RetCodeGuard.h:9
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
RetCodeGuard::~RetCodeGuard
~RetCodeGuard()
Definition: RetCodeGuard.h:16
gaudirun.retcode
retcode
Definition: gaudirun.py:478
RetCodeGuard::m_retcode
int m_retcode
Definition: RetCodeGuard.h:23
RetCodeGuard::m_appmgr
SmartIF< IProperty > m_appmgr
Definition: RetCodeGuard.h:22
Gaudi::setAppReturnCode
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:51
AppReturnCode.h
IProperty.h
RetCodeGuard::RetCodeGuard
RetCodeGuard(const SmartIF< IProperty > &appmgr, int retcode)
Definition: RetCodeGuard.h:11
RetCodeGuard::ignore
void ignore()
Definition: RetCodeGuard.h:13
Gaudi::ReturnCode::Success
constexpr int Success
Definition: AppReturnCode.h:18