Belle II Software  release-06-01-15
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(const Enum& e) :
31  m_id(e.m_id), m_label(e.m_label) {}
32  Enum() : m_id(UNKNOWN.m_id),
33  m_label(UNKNOWN.m_label) {}
34 
35  public:
36  int getId() const { return m_id; }
37  const char* getLabel() const { return m_label.c_str(); }
38  const std::string& getLabelString() const { return m_label; }
39 
40  public:
41  bool operator==(const Enum& e) const;
42  bool operator!=(const Enum& e) const;
43  const Enum& operator=(const Enum& e);
44  bool operator==(const std::string& label) const;
45  bool operator!=(const std::string& label) const;
46 
47  private:
48  int m_id;
49  std::string m_label;
50 
51  };
52 
53  inline bool Enum::operator==(const Enum& e) const
54  {
55  return (m_id == e.m_id);
56  }
57  inline bool Enum::operator!=(const Enum& e) const
58  {
59  return (m_id != e.m_id);
60  }
61  inline const Enum& Enum::operator=(const Enum& e)
62  {
63  m_id = e.m_id;
64  m_label = e.m_label;
65  return *this;
66  }
67  inline bool Enum::operator==(const std::string& label) const
68  {
69  return m_label == label;
70  }
71  inline bool Enum::operator!=(const std::string& label) const
72  {
73  return m_label != label;
74  }
75 
77 }
78 
79 #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.