|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
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; //< 00029 const int SignalOffset = 0x80; //< Offset for signal-related return codes 00030 00031 } 00032 00045 inline StatusCode setAppReturnCode(SmartIF<IProperty> &appmgr, int value, bool force = false) { 00046 if (appmgr) { 00047 IntegerProperty returnCode("ReturnCode", 0); 00048 if (appmgr->getProperty(&returnCode).isSuccess()) { 00049 if (returnCode.value() == 0 || force) { 00050 returnCode.setValue(value); 00051 return appmgr->setProperty(returnCode); 00052 } 00053 // Consider is a success if we do already have an error code. 00054 return StatusCode::SUCCESS; 00055 } 00056 } 00057 return StatusCode::FAILURE; 00058 } 00059 00065 inline int getAppReturnCode(const SmartIF<IProperty> &appmgr) { 00066 if (appmgr) { 00067 IntegerProperty returnCode("ReturnCode", 0); 00068 if (appmgr->getProperty(&returnCode).isSuccess()) 00069 return returnCode.value(); 00070 } 00071 return 0; 00072 } 00073 } 00074 #endif /* APPRETURNCODE_H_ */