Belle II Software  release-08-01-10
Enum.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #ifndef _Belle2_Enum_hh
9 #define _Belle2_Enum_hh
10 
11 #include <string>
12 
13 namespace Belle2 {
19  class Enum {
20 
21  public:
22  const static Enum UNKNOWN;
23 
24  public:
25  ~Enum() {}
26 
27  protected:
28  Enum(int id, const std::string& label)
29  : m_id(id), m_label(label) {}
30  Enum() : m_id(UNKNOWN.m_id),
31  m_label(UNKNOWN.m_label) {}
32 
33  public:
34  int getId() const { return m_id; }
35  const char* getLabel() const { return m_label.c_str(); }
36  const std::string& getLabelString() const { return m_label; }
37 
38  public:
39  bool operator==(const Enum& e) const;
40  bool operator!=(const Enum& e) const;
41  bool operator==(const std::string& label) const;
42  bool operator!=(const std::string& label) const;
43 
44  private:
45  int m_id;
46  std::string m_label;
47 
48  };
49 
50  inline bool Enum::operator==(const Enum& e) const
51  {
52  return (m_id == e.m_id);
53  }
54  inline bool Enum::operator!=(const Enum& e) const
55  {
56  return (m_id != e.m_id);
57  }
58 
59  inline bool Enum::operator==(const std::string& label) const
60  {
61  return m_label == label;
62  }
63  inline bool Enum::operator!=(const std::string& label) const
64  {
65  return m_label != label;
66  }
67 
69 }
70 
71 #endif
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:48
bool operator!=(const DecayNode &node1, const DecayNode &node2)
Not equal: See operator==.
Definition: DecayNode.cc:65
Abstract base class for different kinds of events.