PandaRoot
ErrCode.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 // ******************************************************
14 // DecayTreeFitter Package
15 // We thank the original author Wouter Hulsbergen
16 // (BaBar, LHCb) for providing the sources.
17 // http://arxiv.org/abs/physics/0503191v1 (2005)
18 // Adaptation & Development for PANDA: Ralf Kliemt (2015)
19 // ******************************************************
20 #ifndef DECAYTREEFITTER_ERRORCODE_H
21 #define DECAYTREEFITTER_ERRORCODE_H 1
22 
23 #include <iostream>
24 #include "Rtypes.h"
25 
26 namespace DecayTreeFitter {
27 
28 class ErrCode {
29  public:
31 
32  ErrCode() : _flag(success) {}
33 
34  ErrCode(Status aflag) : _flag(aflag) {}
35 
36  virtual ~ErrCode(){};
37 
38  const ErrCode &operator|=(const ErrCode &rhs)
39  {
40  _flag |= rhs._flag;
41  return *this;
42  }
43 
44  bool operator==(const ErrCode &rhs) const { return _flag == rhs._flag; }
45 
46  bool operator==(const ErrCode::Status &rhs) const { return *this == ErrCode(rhs); }
47 
48  void reset() { _flag = success; }
49  bool failure() const { return _flag != success; }
50  unsigned int flag() const { return _flag; }
51  void Print(std::ostream &os);
52 
53  private:
54  unsigned int _flag;
55  ClassDef(ErrCode, 1)
56 };
57 
58 // std::ostream& operator<<(std::ostream& os, ErrCode& code) ;
59 
60 } // namespace DecayTreeFitter
61 
62 #endif
void Print(std::ostream &os)
unsigned int flag() const
Definition: ErrCode.h:50
const ErrCode & operator|=(const ErrCode &rhs)
Definition: ErrCode.h:38
bool operator==(const ErrCode &rhs) const
Definition: ErrCode.h:44
ErrCode(Status aflag)
Definition: ErrCode.h:34
bool failure() const
Definition: ErrCode.h:49
bool operator==(const ErrCode::Status &rhs) const
Definition: ErrCode.h:46