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  const int Success = 0x00;
17 
18  const int GenericFailure = 0x01;
19 
23  const int FailInput = 0x02; //< Error opening file
24  const int AlgorithmFailure = 0x03; //<
25  const int ScheduledStop = 0x04; //< Loop terminated because of user request
26  const int IncidentFailure = 0x05; //< Fatal error in Incident handling
27  const int UnhandledException = 0x06; //<
28  const int CorruptedInput = 0x10; //< Input file showed a corruption
32  const int FinalizationFailure = 0x0b;
34  const int SignalOffset = 0x80; //< Offset for signal-related return codes
35 
36  }
37 
50  inline StatusCode setAppReturnCode(SmartIF<IProperty> &appmgr, int value, bool force = false) {
51  if (appmgr) {
52  IntegerProperty returnCode("ReturnCode", 0);
53  if (appmgr->getProperty(&returnCode).isSuccess()) {
54  if (returnCode.value() == 0 || force) {
55  returnCode.setValue(value);
56  return appmgr->setProperty(returnCode);
57  }
58  // Consider is a success if we do already have an error code.
59  return StatusCode::SUCCESS;
60  }
61  }
62  return StatusCode::FAILURE;
63  }
64 
70  inline int getAppReturnCode(const SmartIF<IProperty> &appmgr) {
71  if (appmgr) {
72  IntegerProperty returnCode("ReturnCode", 0);
73  if (appmgr->getProperty(&returnCode).isSuccess())
74  return returnCode.value();
75  }
76  return 0;
77  }
78 }
79 #endif /* APPRETURNCODE_H_ */
int getAppReturnCode(const SmartIF< IProperty > &appmgr)
Get the application (current) return code.
Definition: AppReturnCode.h:70
virtual StatusCode getProperty(Property *p) const =0
Get the property by property.
const int GenericFailure
Definition: AppReturnCode.h:18
const int SignalOffset
Definition: AppReturnCode.h:34
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
const int IncidentFailure
Definition: AppReturnCode.h:26
const int UnhandledException
Definition: AppReturnCode.h:27
const int FinalizationFailure
Error codes for operation failures.
Definition: AppReturnCode.h:32
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode setProperty(const Property &p)=0
Set the property by property.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:50
const TYPE & value() const
explicit conversion
Definition: Property.h:355
const int CorruptedInput
Definition: AppReturnCode.h:28
virtual bool setValue(const TYPE &value)
implementation of PropertyWithValue::setValue
Definition: Property.h:420
const int ScheduledStop
Definition: AppReturnCode.h:25
const int FailInput
Definition: AppReturnCode.h:23
const int AlgorithmFailure
Definition: AppReturnCode.h:24
Helper functions to set/get the application return code.
Definition: __init__.py:1