ATLAS Offline Software
Loading...
Searching...
No Matches
CorrectionCode.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef PATINTERFACES_CORRECTIONCODE_H
6#define PATINTERFACES_CORRECTIONCODE_H
7
9
10namespace CP {
11
32
33 public:
35 enum ErrorCode {
36 Error = 0,
38 Ok = 2
39 };
40
42 CorrectionCode( ErrorCode code = Ok ) noexcept : m_code( code ) { }
43
45 ErrorCode code() const noexcept {return m_code;}
46
48 operator ErrorCode() const noexcept { return code(); }
49
52 bool operator < ( const CorrectionCode& rhs ) const noexcept {
53 return m_code < rhs.m_code;
54 }
55
57 void ignore() const noexcept { }
58
63 void setChecked() const noexcept { }
64 static void enableFailure() noexcept {}
65 static void disableFailure() noexcept {}
66
67 private:
69
70 }; // class CorrectionCode
71
72} // namespace CP
73
74namespace asg
75{
78 template<typename T> struct CheckHelper;
79
80 template<> struct CheckHelper<CP::CorrectionCode>
81 {
83 static inline bool isSuccess (const CP::CorrectionCode& sc) {
84 return sc == CP::CorrectionCode::Ok; }
85
89
93
97 };
98}
99
100#endif // not PATINTERFACES_CORRECTIONCODE_H
bool operator<(const DataVector< T > &a, const DataVector< T > &b)
Vector ordering relation.
static Double_t sc
Return value from object correction CP tools.
ErrorCode
Possible values for the correction code.
@ Error
Some error happened during the object correction.
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
void setChecked() const noexcept
Older functions for backward compatibility with the pre-nondiscard version of this class in which we ...
static void disableFailure() noexcept
ErrorCode code() const noexcept
The code stored internally.
ErrorCode m_code
The stored correction code.
CorrectionCode(ErrorCode code=Ok) noexcept
Constructor with a correction code.
static void enableFailure() noexcept
void ignore() const noexcept
Ignore the correction code.
Return value from object correction CP tools.
CorrectionCode(ErrorCode code=Ok) noexcept
Constructor with a correction code.
Select isolated Photons, Electrons and Muons.
Macro wrapping the [[nodiscard]] attribute.
#define ATLAS_NODISCARD
Definition nodiscard.h:18
static bool isSuccess(const CP::CorrectionCode &sc)
whether the status code reports a success
static CP::CorrectionCode successCode()
produce a status code to report success
static bool isOutOfValidityRange(const CP::CorrectionCode &sc)
whether the status code reports out of validity
static CP::CorrectionCode failureCode()
produce a status code to report failure
this is an internal traits class for status codes used by the ANA_CHECK* macros