EICd
EIC data model
Index.h
Go to the documentation of this file.
1 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2 
3 #ifndef EICD_Index_H
4 #define EICD_Index_H
5 
6 #include <ostream>
7 
8 namespace eic {
9 
10 
11 class Index {
12 public:
13  std::int32_t value{};
14  std::int32_t source{};
15 
16  Index() : source{0}, value{-1} {}
17  Index(int32_t id, int32_t src) : value{id}, source{src} {}
18  Index(Index rhs, int32_t new_src) : Index(rhs.value, new_src) {}
19  bool empty() const {return value < 0;}
20  bool valid() const {return value >= 0 && source != 0;}
21  bool equals(const eic::Index& rhs) const {return rhs.source == source && rhs.value == value;}
22  bool operator==(const eic::Index& rhs) const {return equals(rhs);}
23  bool operator!=(const eic::Index& rhs) const {return !equals(rhs);}
24  explicit operator bool() const {return valid();}
25 
26 };
27 
28 inline std::ostream& operator<<(std::ostream& o, const eic::Index& value) {
29  o << value.value << " ";
30  o << value.source << " ";
31 
32  return o;
33 }
34 
35 } // namespace eic
36 
37 
38 
39 #endif
eic::operator<<
std::ostream & operator<<(std::ostream &o, const ConstBasicParticle &value)
Definition: BasicParticle.cc:102
eic::Index
Definition: Index.h:11
eic
Definition: BasicParticle.cc:13
eic::Index::valid
bool valid() const
Definition: Index.h:20
eic::Index::source
std::int32_t source
Definition: Index.h:14
eic::Index::Index
Index()
Definition: Index.h:16
eic::Index::value
std::int32_t value
Definition: Index.h:13
eic::Index::Index
Index(Index rhs, int32_t new_src)
Definition: Index.h:18
eic::Index::equals
bool equals(const eic::Index &rhs) const
Definition: Index.h:21
eic::Index::empty
bool empty() const
Definition: Index.h:19
eic::Index::Index
Index(int32_t id, int32_t src)
Definition: Index.h:17
eic::Index::operator==
bool operator==(const eic::Index &rhs) const
Definition: Index.h:22
eic::Index::operator!=
bool operator!=(const eic::Index &rhs) const
Definition: Index.h:23