ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
pool::DbStatus Class Reference

#include <StorageSvc/DbStatus.h>

Collaboration diagram for pool::DbStatus:

Public Types

enum  ErrorLevel { Success = 1, Info = (1u<<30), Warning = (1u<<31), Error = (1u<<31) + (1u<<30) }
 

Public Member Functions

 DbStatus ()
 Standard Constructor. Defaults to Error. More...
 
 DbStatus (const DbStatus &)=default
 Default copy constructor. More...
 
DbStatusoperator= (const DbStatus &)=default
 
 DbStatus (unsigned int code)
 Standard constructor with initialization from long value. More...
 
 DbStatus (ErrorLevel lvl, unsigned int fac, unsigned int code)
 Constructor with initialization from Error level, facility and code. More...
 
 ~DbStatus ()=default
 Default destructor. Non virtual for performance reasons. Do NOT inherit. More...
 
 operator unsigned int () const
 Cast operator. More...
 
DbStatusoperator= (unsigned int value)
 Assignment operator. More...
 
unsigned int severity () const
 Access severity code. More...
 
unsigned int facility () const
 Access facility code. More...
 
unsigned int code () const
 Access error code value. More...
 
unsigned int reserved () const
 Access the reserved bits. More...
 
unsigned int value () const
 Acces fully encoded value. More...
 
bool isSuccess () const
 Check if the return code indicated success. More...
 
bool isInfo () const
 Check if the return code indicated an informational message. More...
 
bool isWarning () const
 Check if the return code indicated a warning. More...
 
bool isError () const
 Check if the return code indicated an error. More...
 

Static Public Member Functions

static unsigned int success ()
 Access bit mask field for Success messages. More...
 
static unsigned int info ()
 Access bit mask field for Informational messages. More...
 
static unsigned int warning ()
 Access bit mask field for Warning messages. More...
 
static unsigned int error ()
 Access bit mask field for Error messages. More...
 

Private Attributes

unsigned int m_code
 

Friends

bool operator< (const DbStatus &a, const DbStatus &b)
 Comparison operator lesser. More...
 
bool operator> (const DbStatus &a, const DbStatus &b)
 Comparison operator greater. More...
 

Detailed Description

This class is highly inspired by the error code distribution system as it is used in DEC/VMS or MS/WNT.

Values are 32 bit values layed out as follows:

3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +—+-+-+--------------------—+----------------------------—+ |Sev|C|R| Facility | Code | +—+-+-+--------------------—+----------------------------—+

where

Sev - is the severity code

    00 - Success
    01 - Informational
    10 - Warning
    11 - Error

C - is a customer bit  (currently not used)
R - is a reserved bit

Facility - is the facility code

Code - is the facility's DbStatus code

Additionally Success message codes must have the low bit set. e.g. 0xC0000001 is Success 0xD0000000 is Informational 0xE0000000 is Warning 0xF0000000 is Error

however, 0xF0000001, 0xE000001, 0xD0000001 or 0xC0000001 are not allowed.

Author
Markus Frank
Version
1.0
Date
15/07/2002

Definition at line 67 of file DbStatus.h.

Member Enumeration Documentation

◆ ErrorLevel

Enumerator
Success 
Info 
Warning 
Error 

Definition at line 72 of file DbStatus.h.

72  {
73  Success = 1,
74  Info = (1u<<30),
75  Warning = (1u<<31),
76  Error = (1u<<31) + (1u<<30)
77  };

Constructor & Destructor Documentation

◆ DbStatus() [1/4]

pool::DbStatus::DbStatus ( )
inline

Standard Constructor. Defaults to Error.

Definition at line 79 of file DbStatus.h.

79 : m_code(Error) { }

◆ DbStatus() [2/4]

pool::DbStatus::DbStatus ( const DbStatus )
default

Default copy constructor.

◆ DbStatus() [3/4]

pool::DbStatus::DbStatus ( unsigned int  code)
inline

Standard constructor with initialization from long value.

Definition at line 84 of file DbStatus.h.

84 : m_code(code) { }

◆ DbStatus() [4/4]

pool::DbStatus::DbStatus ( DbStatus::ErrorLevel  lvl,
unsigned int  fac,
unsigned int  code 
)
inline

Constructor with initialization from Error level, facility and code.

Definition at line 127 of file DbStatus.h.

128  { m_code = (lvl&Error)+((fac&0x0FFF)<<16)+(cod&0xFFFF); }

◆ ~DbStatus()

pool::DbStatus::~DbStatus ( )
default

Default destructor. Non virtual for performance reasons. Do NOT inherit.

Member Function Documentation

◆ code()

unsigned int pool::DbStatus::code ( ) const
inline

Access error code value.

Definition at line 98 of file DbStatus.h.

98 { return m_code&0x0000FFFF; }

◆ error()

static unsigned int pool::DbStatus::error ( )
inlinestatic

Access bit mask field for Error messages.

Definition at line 118 of file DbStatus.h.

118 { return Error; }

◆ facility()

unsigned int pool::DbStatus::facility ( ) const
inline

Access facility code.

Definition at line 96 of file DbStatus.h.

96 { return (m_code&0x0FFF0000)>>16; }

◆ info()

static unsigned int pool::DbStatus::info ( )
inlinestatic

Access bit mask field for Informational messages.

Definition at line 114 of file DbStatus.h.

114 { return Info; }

◆ isError()

bool pool::DbStatus::isError ( ) const
inline

Check if the return code indicated an error.

Definition at line 110 of file DbStatus.h.

110 { return (m_code>>30)==3; }

◆ isInfo()

bool pool::DbStatus::isInfo ( ) const
inline

Check if the return code indicated an informational message.

Definition at line 106 of file DbStatus.h.

106 { return (m_code>>30)==1; }

◆ isSuccess()

bool pool::DbStatus::isSuccess ( ) const
inline

Check if the return code indicated success.

Definition at line 104 of file DbStatus.h.

104 { return (m_code>>30)==0 && (m_code&1); }

◆ isWarning()

bool pool::DbStatus::isWarning ( ) const
inline

Check if the return code indicated a warning.

Definition at line 108 of file DbStatus.h.

108 { return (m_code>>30)==2; }

◆ operator unsigned int()

pool::DbStatus::operator unsigned int ( ) const
inline

Cast operator.

Definition at line 90 of file DbStatus.h.

90 { return m_code; }

◆ operator=() [1/2]

DbStatus& pool::DbStatus::operator= ( const DbStatus )
default

◆ operator=() [2/2]

DbStatus& pool::DbStatus::operator= ( unsigned int  value)
inline

Assignment operator.

Definition at line 92 of file DbStatus.h.

92 { m_code = value; return *this;}

◆ reserved()

unsigned int pool::DbStatus::reserved ( ) const
inline

Access the reserved bits.

Definition at line 100 of file DbStatus.h.

100 { return (m_code&0x3FFFFFFF)>>28; }

◆ severity()

unsigned int pool::DbStatus::severity ( ) const
inline

Access severity code.

Definition at line 94 of file DbStatus.h.

94 { return m_code>>30; }

◆ success()

static unsigned int pool::DbStatus::success ( )
inlinestatic

Access bit mask field for Success messages.

Definition at line 112 of file DbStatus.h.

112 { return Success; }

◆ value()

unsigned int pool::DbStatus::value ( ) const
inline

Acces fully encoded value.

Definition at line 102 of file DbStatus.h.

102 { return m_code; }

◆ warning()

static unsigned int pool::DbStatus::warning ( )
inlinestatic

Access bit mask field for Warning messages.

Definition at line 116 of file DbStatus.h.

116 { return Warning; }

Friends And Related Function Documentation

◆ operator<

bool operator< ( const DbStatus a,
const DbStatus b 
)
friend

Comparison operator lesser.

Definition at line 129 of file DbStatus.h.

130  { return a.m_code < b.m_code; }

◆ operator>

bool operator> ( const DbStatus a,
const DbStatus b 
)
friend

Comparison operator greater.

Definition at line 131 of file DbStatus.h.

132  { return a.m_code < b.m_code; }

Member Data Documentation

◆ m_code

unsigned int pool::DbStatus::m_code
private

Definition at line 69 of file DbStatus.h.


The documentation for this class was generated from the following file:
pool::DbStatus::Info
@ Info
Definition: DbStatus.h:74
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
pool::DbStatus::code
unsigned int code() const
Access error code value.
Definition: DbStatus.h:98
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
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::Error
@ Error
Definition: DbStatus.h:76
pool::DbStatus::Success
@ Success
Definition: DbStatus.h:73
pool::DbStatus::Warning
@ Warning
Definition: DbStatus.h:75