CMS 3D CMS Logo

ElementID.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_ElementID_h
2 #define DataFormats_Provenance_ElementID_h
3 
5 
6 #include <iosfwd>
7 
8 namespace edm {
17  class ElementID {
18  public:
19  using key_type = unsigned int;
20 
21  ElementID() = default;
22  explicit ElementID(edm::ProductID id, key_type ind) : index_(ind), id_(id) {}
23 
24  bool isValid() const { return id_.isValid(); }
25  ProductID id() const { return id_; }
26  key_type index() const { return index_; }
27  key_type key() const { return index_; }
28  void reset() {
29  index_ = 0;
30  id_.reset();
31  }
32 
33  void swap(ElementID& other);
34 
35  private:
38  };
39 
40  inline void swap(ElementID& a, ElementID& b) { a.swap(b); }
41 
42  inline bool operator==(ElementID const& lh, ElementID const& rh) {
43  return lh.index() == rh.index() && lh.id() == rh.id();
44  }
45 
46  inline bool operator!=(ElementID const& lh, ElementID const& rh) { return !(lh == rh); }
47 
48  bool operator<(ElementID const& lh, ElementID const& rh);
49 
50  std::ostream& operator<<(std::ostream& os, ElementID const& id);
51 } // namespace edm
52 
53 #endif
edm::ElementID::ElementID
ElementID(edm::ProductID id, key_type ind)
Definition: ElementID.h:22
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::swap
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
mathSSE::lh
bool int lh
Definition: SIMDVec.h:20
edm::ElementID::reset
void reset()
Definition: ElementID.h:28
edm::ElementID::ElementID
ElementID()=default
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
edm::operator!=
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
Definition: debugging_allocator.h:75
edm::ElementID::index
key_type index() const
Definition: ElementID.h:26
edm::operator==
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
Definition: debugging_allocator.h:72
edm::operator<
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:89
ProductID.h
trackingPlots.other
other
Definition: trackingPlots.py:1465
b
double b
Definition: hdecay.h:118
edm::ElementID::id_
ProductID id_
Definition: ElementID.h:37
a
double a
Definition: hdecay.h:119
edm::ElementID
Definition: ElementID.h:17
edm::ElementID::swap
void swap(ElementID &other)
Definition: ElementID.cc:6
createfilelist.int
int
Definition: createfilelist.py:10
edm::ElementID::isValid
bool isValid() const
Definition: ElementID.h:24
edm::ProductID::isValid
bool isValid() const
Definition: ProductID.h:32
edm::ElementID::key
key_type key() const
Definition: ElementID.h:27
edm::ElementID::index_
key_type index_
Definition: ElementID.h:36
edm::ElementID::id
ProductID id() const
Definition: ElementID.h:25
edm::ElementID::key_type
unsigned int key_type
Definition: ElementID.h:19
edm::ProductID::reset
void reset()
Definition: ProductID.h:36
edm::ProductID
Definition: ProductID.h:27