FairRoot/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 
17  class ErrCode
18  {
19  public:
20  enum Status {success=0,
28 
30 
31  ErrCode(Status aflag) : _flag(aflag) {}
32 
33  virtual ~ErrCode(){};
34 
35  const ErrCode& operator|=(const ErrCode& rhs) {
36  _flag |= rhs._flag ; return *this ; }
37 
38  bool operator==(const ErrCode& rhs) const {
39  return _flag == rhs._flag ; }
40 
41  bool operator==(const ErrCode::Status& rhs) const {
42  return *this == ErrCode(rhs) ; }
43 
44  void reset() { _flag = success ; }
45  bool failure() const { return _flag!=success ; }
46  unsigned int flag() const { return _flag ; }
47  void Print(std::ostream& os);
48 
49  private:
50  unsigned int _flag ;
51  ClassDef ( ErrCode,1 )
52  } ;
53 
54  //std::ostream& operator<<(std::ostream& os, ErrCode& code) ;
55 
56 }
57 
58 #endif
bool failure() const
Definition: ErrCode.h:45
const ErrCode & operator|=(const ErrCode &rhs)
Definition: ErrCode.h:35
unsigned int flag() const
Definition: ErrCode.h:46
void Print(std::ostream &os)
Definition: ErrCode.cxx:34
unsigned int _flag
Definition: ErrCode.h:50
bool operator==(const ErrCode &rhs) const
Definition: ErrCode.h:38
bool operator==(const ErrCode::Status &rhs) const
Definition: ErrCode.h:41
ErrCode(Status aflag)
Definition: ErrCode.h:31