|
Gaudi Framework, version v23r2 |
| Home | Generated: Thu Jun 28 2012 |
00001 00006 #ifndef APPRETURNCODE_H_ 00007 #define APPRETURNCODE_H_ 00008 00009 #include "GaudiKernel/IProperty.h" 00010 #include "GaudiKernel/Property.h" 00011 00012 namespace Gaudi { 00014 namespace ReturnCode { 00015 00016 const int Success = 0x00; 00017 00018 const int GenericFailure = 0x01; 00019 00023 const int FailInput = 0x02; //< Error opening file 00024 const int AlgorithmFailure = 0x03; //< 00025 const int ScheduledStop = 0x04; //< Loop terminated because of user request 00026 const int IncidentFailure = 0x05; //< Fatal error in Incident handling 00027 const int UnhandledException = 0x06; //< 00031 const int FinalizationFailure = 0x0b; 00033 const int SignalOffset = 0x80; //< Offset for signal-related return codes 00034 00035 } 00036 00049 inline StatusCode setAppReturnCode(SmartIF<IProperty> &appmgr, int value, bool force = false) { 00050 if (appmgr) { 00051 IntegerProperty returnCode("ReturnCode", 0); 00052 if (appmgr->getProperty(&returnCode).isSuccess()) { 00053 if (returnCode.value() == 0 || force) { 00054 returnCode.setValue(value); 00055 return appmgr->setProperty(returnCode); 00056 } 00057 // Consider is a success if we do already have an error code. 00058 return StatusCode::SUCCESS; 00059 } 00060 } 00061 return StatusCode::FAILURE; 00062 } 00063 00069 inline int getAppReturnCode(const SmartIF<IProperty> &appmgr) { 00070 if (appmgr) { 00071 IntegerProperty returnCode("ReturnCode", 0); 00072 if (appmgr->getProperty(&returnCode).isSuccess()) 00073 return returnCode.value(); 00074 } 00075 return 0; 00076 } 00077 } 00078 #endif /* APPRETURNCODE_H_ */