ATLAS Offline Software
Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 // StatusCode.h
5 // TopoCore
6 // Created by Joerg Stelzer on 11/10/12.
7 
8 #ifndef __TopoCore__StatusCode__
9 #define __TopoCore__StatusCode__
10 
11 #include <iostream>
12 
13 namespace TCS {
14 
15  class StatusCode {
16  public:
17  enum code_t { FAILURE=0, RECOVERABLE=1, SUCCESS=2 };
18 
21  {}
22 
23  public:
25  m_status(code)
26  {}
27 
28  code_t getCode() const { return m_status; }
29 
30  bool isSuccess() const {
31  return m_status == SUCCESS;
32  }
33 
34  bool isRecoverable() const {
35  return m_status == RECOVERABLE;
36  }
37 
38  bool isFailure() {
39  return m_status == FAILURE;
40  }
41 
43  return (sc.getCode()>m_status)?StatusCode(sc.getCode()):StatusCode(m_status); // max of this and sc (any SUCCESS is SUCCESS)
44  }
45 
47  return (sc.getCode()<m_status)?StatusCode(sc.getCode()):StatusCode(m_status); // min of this and sc (any FAILURE is FAILURE)
48  }
49 
50  private:
52  };
53 
54 } // end of namespace TCS
55 
56 inline
57 std::ostream& operator<< ( std::ostream& o, const TCS::StatusCode& sc ) {
58  if ( TCS::StatusCode::SUCCESS == sc.getCode() ) {
59  return o << "SUCCESS" ;
60  } else if ( sc.isRecoverable() ) {
61  return o << "RECOVERABLE";
62  }
63  o << "FAILURE" ;
64  if ( TCS::StatusCode::FAILURE != sc.getCode() ) {
65  o << "(" << sc.getCode() << ")" ;
66  }
67  return o;
68 }
69 
70 
71 
72 #endif /* defined(__TopoCore__StatusCode__) */
TCS::StatusCode::SUCCESS
@ SUCCESS
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::StatusCode::FAILURE
@ FAILURE
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::StatusCode::isSuccess
bool isSuccess() const
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:30
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TCS::StatusCode::m_status
code_t m_status
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:51
operator<<
std::ostream & operator<<(std::ostream &o, const TCS::StatusCode &sc)
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:57
TCS::StatusCode::getCode
code_t getCode() const
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:28
TCS::StatusCode::operator|=
StatusCode operator|=(const StatusCode &sc)
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:42
TCS::StatusCode::StatusCode
StatusCode(code_t code)
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:24
TCS::StatusCode::StatusCode
StatusCode()
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:19
TCS::StatusCode::isRecoverable
bool isRecoverable() const
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:34
TCS::StatusCode::isFailure
bool isFailure()
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:38
pmontree.code
code
Definition: pmontree.py:443
TCS::StatusCode::operator&=
StatusCode operator&=(const StatusCode &sc)
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:46
TCS::StatusCode::code_t
code_t
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS::StatusCode::RECOVERABLE
@ RECOVERABLE
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:17
TCS
Definition: Global/GlobalSimulation/src/IO/Decision.h:18
TCS::StatusCode
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/StatusCode.h:15