PandaRoot
ErrCode.h
Go to the documentation of this file.
1 // ******************************************************
2 // DecayTreeFitter Package
3 // We thank the original author Wouter Hulsbergen
4 // (BaBar, LHCb) for providing the sources.
5 // http://arxiv.org/abs/physics/0503191v1 (2005)
6 // Adaptation & Development for PANDA: Ralf Kliemt (2015)
7 // ******************************************************
8 #ifndef DECAYTREEFITTER_ERRORCODE_H
9 #define DECAYTREEFITTER_ERRORCODE_H 1
10 
11 #include <iostream>
12 #include "Rtypes.h"
13 
14 namespace DecayTreeFitter {
15 
16 class ErrCode {
17  public:
19 
20  ErrCode() : _flag(success) {}
21 
22  ErrCode(Status aflag) : _flag(aflag) {}
23 
24  virtual ~ErrCode(){};
25 
26  const ErrCode &operator|=(const ErrCode &rhs)
27  {
28  _flag |= rhs._flag;
29  return *this;
30  }
31 
32  bool operator==(const ErrCode &rhs) const { return _flag == rhs._flag; }
33 
34  bool operator==(const ErrCode::Status &rhs) const { return *this == ErrCode(rhs); }
35 
36  void reset() { _flag = success; }
37  bool failure() const { return _flag != success; }
38  unsigned int flag() const { return _flag; }
39  void Print(std::ostream &os);
40 
41  private:
42  unsigned int _flag;
43  ClassDef(ErrCode, 1)
44 };
45 
46 // std::ostream& operator<<(std::ostream& os, ErrCode& code) ;
47 
48 } // namespace DecayTreeFitter
49 
50 #endif
void Print(std::ostream &os)
unsigned int flag() const
Definition: ErrCode.h:38
const ErrCode & operator|=(const ErrCode &rhs)
Definition: ErrCode.h:26
bool operator==(const ErrCode &rhs) const
Definition: ErrCode.h:32
ErrCode(Status aflag)
Definition: ErrCode.h:22
bool failure() const
Definition: ErrCode.h:37
bool operator==(const ErrCode::Status &rhs) const
Definition: ErrCode.h:34