ATLAS Offline Software
DbStatus.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: DbStatus.h 726071 2016-02-25 09:23:05Z krasznaa $
6 //====================================================================
7 // Storage Service DbStatus definition file
8 //--------------------------------------------------------------------
9 //
10 // @author M.Frank
11 //====================================================================
12 #ifndef POOL_DBSTATUS_H
13 #define POOL_DBSTATUS_H 1
14 
15 // Framework customization file
16 #include "StorageSvc/DbConfig.h"
17 
18 /*
19  * POOL namespace declaration
20  */
21 namespace pool {
22 
67  class DbStatus {
68  private:
69  unsigned int m_code;
70 
71  public:
72  enum ErrorLevel {
73  Success = 1,
74  Info = (1u<<30),
75  Warning = (1u<<31),
76  Error = (1u<<31) + (1u<<30)
77  };
81  DbStatus(const DbStatus&) = default;
82  DbStatus& operator=(const DbStatus&) = default;
84  DbStatus(unsigned int code) : m_code(code) { }
86  DbStatus(ErrorLevel lvl, unsigned int fac, unsigned int code);
88  ~DbStatus() = default;
90  operator unsigned int() const { return m_code; }
92  DbStatus& operator=(unsigned int value) { m_code = value; return *this;}
94  unsigned int severity() const { return m_code>>30; }
96  unsigned int facility() const { return (m_code&0x0FFF0000)>>16; }
98  unsigned int code() const { return m_code&0x0000FFFF; }
100  unsigned int reserved() const { return (m_code&0x3FFFFFFF)>>28; }
102  unsigned int value() const { return m_code; }
104  bool isSuccess() const { return (m_code>>30)==0 && (m_code&1); }
106  bool isInfo() const { return (m_code>>30)==1; }
108  bool isWarning() const { return (m_code>>30)==2; }
110  bool isError() const { return (m_code>>30)==3; }
112  static unsigned int success() { return Success; }
114  static unsigned int info() { return Info; }
116  static unsigned int warning() { return Warning; }
118  static unsigned int error() { return Error; }
119 
121  friend bool operator< ( const DbStatus& a, const DbStatus& b );
123  friend bool operator> ( const DbStatus& a, const DbStatus& b );
124  };
125 
126 
127  inline DbStatus::DbStatus(DbStatus::ErrorLevel lvl, unsigned int fac, unsigned int cod)
128  { m_code = (lvl&Error)+((fac&0x0FFF)<<16)+(cod&0xFFFF); }
129  inline bool operator< ( const DbStatus& a, const DbStatus& b )
130  { return a.m_code < b.m_code; }
131  inline bool operator> ( const DbStatus& a, const DbStatus& b )
132  { return a.m_code < b.m_code; }
133 }
134 
135 #endif // POOL_DBSTATUS_H
pool::DbStatus::facility
unsigned int facility() const
Access facility code.
Definition: DbStatus.h:96
pool::DbStatus::info
static unsigned int info()
Access bit mask field for Informational messages.
Definition: DbStatus.h:114
pool::DbStatus
Definition: DbStatus.h:67
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
pool::DbStatus::ErrorLevel
ErrorLevel
Definition: DbStatus.h:72
pool::DbStatus::Info
@ Info
Definition: DbStatus.h:74
pool
pool namespace
Definition: libname.h:15
pool::DbStatus::operator=
DbStatus & operator=(const DbStatus &)=default
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
pool::operator>
bool operator>(const DbStatus &a, const DbStatus &b)
Definition: DbStatus.h:131
pool::DbStatus::isInfo
bool isInfo() const
Check if the return code indicated an informational message.
Definition: DbStatus.h:106
pool::DbStatus::code
unsigned int code() const
Access error code value.
Definition: DbStatus.h:98
pool::DbStatus::isWarning
bool isWarning() const
Check if the return code indicated a warning.
Definition: DbStatus.h:108
pool::DbStatus::~DbStatus
~DbStatus()=default
Default destructor. Non virtual for performance reasons. Do NOT inherit.
pool::operator<
bool operator<(const DbStatus &a, const DbStatus &b)
Definition: DbStatus.h:129
pool::DbStatus::isError
bool isError() const
Check if the return code indicated an error.
Definition: DbStatus.h:110
pool::DbStatus::error
static unsigned int error()
Access bit mask field for Error messages.
Definition: DbStatus.h:118
pool::DbStatus::isSuccess
bool isSuccess() const
Check if the return code indicated success.
Definition: DbStatus.h:104
pool::DbStatus::operator>
friend bool operator>(const DbStatus &a, const DbStatus &b)
Comparison operator greater.
Definition: DbStatus.h:131
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
DbConfig.h
pool::DbStatus::severity
unsigned int severity() const
Access severity code.
Definition: DbStatus.h:94
pool::DbStatus::warning
static unsigned int warning()
Access bit mask field for Warning messages.
Definition: DbStatus.h:116
pool::DbStatus::reserved
unsigned int reserved() const
Access the reserved bits.
Definition: DbStatus.h:100
pool::DbStatus::operator<
friend bool operator<(const DbStatus &a, const DbStatus &b)
Comparison operator lesser.
Definition: DbStatus.h:129
a
TList * a
Definition: liststreamerinfos.cxx:10
pool::DbStatus::m_code
unsigned int m_code
Definition: DbStatus.h:69
pool::DbStatus::value
unsigned int value() const
Acces fully encoded value.
Definition: DbStatus.h:102
pool::DbStatus::DbStatus
DbStatus(unsigned int code)
Standard constructor with initialization from long value.
Definition: DbStatus.h:84
pool::DbStatus::DbStatus
DbStatus(const DbStatus &)=default
Default copy constructor.
pool::DbStatus::operator=
DbStatus & operator=(unsigned int value)
Assignment operator.
Definition: DbStatus.h:92
pool::DbStatus::DbStatus
DbStatus()
Standard Constructor. Defaults to Error.
Definition: DbStatus.h:79
pool::DbStatus::Error
@ Error
Definition: DbStatus.h:76
pool::DbStatus::Success
@ Success
Definition: DbStatus.h:73
pool::DbStatus::Warning
@ Warning
Definition: DbStatus.h:75
pool::DbStatus::success
static unsigned int success()
Access bit mask field for Success messages.
Definition: DbStatus.h:112