Belle II Software  release-05-02-19
Enum.h
1 #ifndef _Belle2_Enum_hh
2 #define _Belle2_Enum_hh
3 
4 #include <string>
5 
6 namespace Belle2 {
12  class Enum {
13 
14  public:
15  const static Enum UNKNOWN;
16 
17  public:
18  ~Enum() {}
19 
20  protected:
21  Enum(int id, const std::string& label)
22  : m_id(id), m_label(label) {}
23  Enum(const Enum& e) :
24  m_id(e.m_id), m_label(e.m_label) {}
25  Enum() : m_id(UNKNOWN.m_id),
26  m_label(UNKNOWN.m_label) {}
27 
28  public:
29  int getId() const { return m_id; }
30  const char* getLabel() const { return m_label.c_str(); }
31  const std::string& getLabelString() const { return m_label; }
32 
33  public:
34  bool operator==(const Enum& e) const;
35  bool operator!=(const Enum& e) const;
36  const Enum& operator=(const Enum& e);
37  bool operator==(const std::string& label) const;
38  bool operator!=(const std::string& label) const;
39 
40  private:
41  int m_id;
42  std::string m_label;
43 
44  };
45 
46  inline bool Enum::operator==(const Enum& e) const
47  {
48  return (m_id == e.m_id);
49  }
50  inline bool Enum::operator!=(const Enum& e) const
51  {
52  return (m_id != e.m_id);
53  }
54  inline const Enum& Enum::operator=(const Enum& e)
55  {
56  m_id = e.m_id;
57  m_label = e.m_label;
58  return *this;
59  }
60  inline bool Enum::operator==(const std::string& label) const
61  {
62  return m_label == label;
63  }
64  inline bool Enum::operator!=(const std::string& label) const
65  {
66  return m_label != label;
67  }
68 
70 }
71 
72 #endif
prepareAsicCrosstalkSimDB.e
e
aux.
Definition: prepareAsicCrosstalkSimDB.py:53
Belle2::operator==
bool operator==(const DecayNode &node1, const DecayNode &node2)
Compare two Decay Nodes: They are equal if All daughter decay nodes are equal or one of the daughter ...
Definition: DecayNode.cc:50
Belle2::operator!=
bool operator!=(const DecayNode &node1, const DecayNode &node2)
Not equal: See operator==.
Definition: DecayNode.cc:67
Belle2::Enum
Definition: Enum.h:12
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19