| The Gaudi Framework v32r1 (f65d50dc)

AppReturnCode.h
Go to the documentation of this file.
1
6 #ifndef APPRETURNCODE_H_
7 #define APPRETURNCODE_H_
8
9 #include "GaudiKernel/IProperty.h"
10 #include "GaudiKernel/Property.h"
11
12 namespace Gaudi {
14 namespace ReturnCode {
15
16 constexpr int Success = 0x00;
17
18 constexpr int GenericFailure = 0x01;
19
23 constexpr int FailInput = 0x02; //< Error opening file
24 constexpr int AlgorithmFailure = 0x03; //<
25 constexpr int ScheduledStop = 0x04; //< Loop terminated because of user request
26 constexpr int IncidentFailure = 0x05; //< Fatal error in Incident handling
27 constexpr int UnhandledException = 0x06; //<
28 constexpr int CorruptedInput = 0x10; //< Input file showed a corruption
32 constexpr int FinalizationFailure = 0x0b;
34 constexpr int SignalOffset = 0x80; //< Offset for signal-related return codes
35 } // namespace ReturnCode
36
49 inline StatusCode setAppReturnCode( SmartIF<IProperty>& appmgr, int value, bool force = false ) {
50 if ( appmgr ) {
51 Gaudi::Property<int> returnCode( "ReturnCode", 0 );
52 if ( appmgr->getProperty( &returnCode ).isSuccess() ) {
53 if ( returnCode.value() == 0 || force ) {
54 returnCode.setValue( value );
55 return appmgr->setProperty( returnCode );
56 }
57 // Consider is a success if we do already have an error code.
58 return StatusCode::SUCCESS;
59 }
60 }
61 return StatusCode::FAILURE;
62 }
63
69 inline int getAppReturnCode( const SmartIF<IProperty>& appmgr ) {
70 if ( appmgr ) {
71 Gaudi::Property<int> returnCode( "ReturnCode", 0 );
72 if ( appmgr->getProperty( &returnCode ).isSuccess() ) return returnCode.value();
73 }
74 return 0;
75 }
76 } // namespace Gaudi
77 #endif /* APPRETURNCODE_H_ */
Gaudi::getAppReturnCode
int getAppReturnCode(const SmartIF< IProperty > &appmgr)
Get the application (current) return code.
Definition: AppReturnCode.h:69
Gaudi::ReturnCode::FinalizationFailure
constexpr int FinalizationFailure
Error codes for operation failures.
Definition: AppReturnCode.h:32
SmartIF< IProperty >
Gaudi::Property::setValue
bool setValue(const ValueType &v)
Definition: Property.h:528
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
Gaudi::ReturnCode::GenericFailure
constexpr int GenericFailure
Definition: AppReturnCode.h:18
Gaudi::ReturnCode::ScheduledStop
constexpr int ScheduledStop
Definition: AppReturnCode.h:25
Gaudi::ReturnCode::CorruptedInput
constexpr int CorruptedInput
Definition: AppReturnCode.h:28
Gaudi::ReturnCode::UnhandledException
constexpr int UnhandledException
Definition: AppReturnCode.h:27
IProperty::setProperty
virtual StatusCode setProperty(const Gaudi::Details::PropertyBase &p)=0
Set the property by property.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Gaudi::Property::value
const ValueType & value() const
Backward compatibility (.
Definition: Property.h:526
Gaudi::ReturnCode::FailInput
constexpr int FailInput
Definition: AppReturnCode.h:23
IProperty::getProperty
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
Gaudi::setAppReturnCode
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:49
Gaudi::ReturnCode::IncidentFailure
constexpr int IncidentFailure
Definition: AppReturnCode.h:26
IProperty.h
Property.h
Gaudi::ReturnCode::AlgorithmFailure
constexpr int AlgorithmFailure
Definition: AppReturnCode.h:24
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
Gaudi::ReturnCode::SignalOffset
constexpr int SignalOffset
Definition: AppReturnCode.h:34
Gaudi::ReturnCode::Success
constexpr int Success
Definition: AppReturnCode.h:16
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1