The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
AppReturnCode.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
16#pragma once
17
18#include <Gaudi/Property.h>
20
21namespace Gaudi {
23 namespace ReturnCode {
24
25 constexpr int Success = 0x00;
26
27 constexpr int GenericFailure = 0x01;
28
32 constexpr int FailInput = 0x02; //< Error opening file
33 constexpr int AlgorithmFailure = 0x03; //<
34 constexpr int ScheduledStop = 0x04; //< Loop terminated because of user request
35 constexpr int IncidentFailure = 0x05; //< Fatal error in Incident handling
36 constexpr int UnhandledException = 0x06; //<
37 constexpr int CorruptedInput = 0x10; //< Input file showed a corruption
41 constexpr int FinalizationFailure = 0x0b;
43 constexpr int SignalOffset = 0x80; //< Offset for signal-related return codes
44 } // namespace ReturnCode
45
58 inline StatusCode setAppReturnCode( SmartIF<IProperty>& appmgr, int value, bool force = false ) {
59 if ( appmgr ) {
60 Gaudi::Property<int> returnCode( "ReturnCode", 0 );
61 if ( appmgr->getProperty( &returnCode ).isSuccess() ) {
62 if ( returnCode.value() == 0 || force ) {
63 returnCode.setValue( value );
64 return appmgr->setProperty( returnCode );
65 }
66 // Consider is a success if we do already have an error code.
68 }
69 }
71 }
72
78 inline int getAppReturnCode( const SmartIF<IProperty>& appmgr ) {
79 if ( appmgr ) {
80 Gaudi::Property<int> returnCode( "ReturnCode", 0 );
81 if ( appmgr->getProperty( &returnCode ).isSuccess() ) return returnCode.value();
82 }
83 return 0;
84 }
85} // namespace Gaudi
Implementation of property with value of concrete type.
Definition Property.h:35
const ValueType & value() const
Definition Property.h:246
bool setValue(const ValueType &v)
Definition Property.h:248
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100
constexpr int ScheduledStop
constexpr int FailInput
constexpr int AlgorithmFailure
constexpr int CorruptedInput
constexpr int UnhandledException
constexpr int IncidentFailure
ApplicationMgr return code definitions.
constexpr int FinalizationFailure
Error codes for operation failures.
constexpr int GenericFailure
constexpr int SignalOffset
constexpr int Success
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
int getAppReturnCode(const SmartIF< IProperty > &appmgr)
Get the application (current) return code.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.