Belle II Software light-2406-ragdoll
ErrCode.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * External Contributor: Wouter Hulsbergen *
5 * *
6 * See git log for contributors and copyright holders. *
7 * This file is licensed under LGPL-3.0, see LICENSE.md. *
8 **************************************************************************/
9#pragma once
10
11namespace TreeFitter {
12
14 class ErrCode {
15 public:
17 enum Status {success = 0,
18 pocafailure = 1,
19 baddistance = 2,
20 inversionerror = 4,
21 badsetup = 8,
22 divergingconstraint = 16,
23 slowdivergingfit = 32,
24 fastdivergingfit = 64,
25 filtererror = 128,
26 photondimerror = 256,
27 klongdimerror = 512
28 } ;
29
31 ErrCode() : m_flag(success) {}
32
34 explicit ErrCode(Status flag) : m_flag(flag) {}
35
37 const ErrCode& operator|=(const ErrCode& rhs)
38 {
39 m_flag |= rhs.m_flag ; return *this ;
40 }
41
43 bool operator==(const ErrCode& rhs) const
44 {
45 return m_flag == rhs.m_flag ;
46 }
47
49 bool operator==(const ErrCode::Status& rhs) const
50 {
51 return *this == ErrCode(rhs) ;
52 }
53
55 void reset() { m_flag = success ; }
56
58 bool failure() const { return m_flag != success ; }
59
61 unsigned int flag() const { return m_flag ; }
62 private:
63
65 unsigned int m_flag ;
66
67 } ;
68}
abstract errorocode be aware that the default is success
Definition: ErrCode.h:14
const ErrCode & operator|=(const ErrCode &rhs)
operator
Definition: ErrCode.h:37
bool operator==(const ErrCode::Status &rhs) const
operator
Definition: ErrCode.h:49
unsigned int flag() const
get errorcode
Definition: ErrCode.h:61
bool failure() const
returns true if errorcode is error
Definition: ErrCode.h:58
Status
some enums to store errors
Definition: ErrCode.h:17
bool operator==(const ErrCode &rhs) const
operator
Definition: ErrCode.h:43
ErrCode()
default constructor
Definition: ErrCode.h:31
ErrCode(Status flag)
constructor
Definition: ErrCode.h:34
void reset()
reset the errorcode to default (success!)
Definition: ErrCode.h:55
unsigned int m_flag
storing the errorcode
Definition: ErrCode.h:65