| The Gaudi Framework v32r1 (f65d50dc)

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