CMS 3D CMS Logo

ProductID.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_ProductID_h
2 #define DataFormats_Provenance_ProductID_h
3 
4 /*----------------------------------------------------------------------
5 
6 ProductID: A unique identifier for each WrapperBase within a process.
7 Used only in Ref, Ptr, and similar classes.
8 
9 The high order 16 bits is the process index, identifying the process
10 in which the product was created. Exception: An index of 0 means that
11 the product was created prior to the new format (i.e. prior to CMSSW_3_0_0.
12 
13 The low order 16 bits is the product index, identifying the product that
14 in which the product was created. An index of zero means no product.
15 
16 
17 The
18 
19 ----------------------------------------------------------------------*/
20 
21 #include <iosfwd>
22 
23 namespace edm {
24 
25  typedef unsigned short ProcessIndex;
26  typedef unsigned short ProductIndex;
27  class ProductID {
28  public:
30  productIndex_(0) {}
31  explicit
32  ProductID(ProductIndex prodIndex) : processIndex_(0), productIndex_(prodIndex) {}
33  ProductID(ProcessIndex procIndex, ProductIndex prodIndex) :
34  processIndex_(procIndex), productIndex_(prodIndex) {}
35  bool isValid() const {return productIndex_ != 0;}
36  ProcessIndex processIndex() const {return processIndex_;}
37  ProcessIndex productIndex() const {return productIndex_;}
38  ProductIndex id() const {return productIndex_;} // backward compatibility
40 
41  void swap(ProductID& other);
42 
43  private:
44  ProcessIndex processIndex_;
45  ProductIndex productIndex_;
46  };
47 
48  inline
49  void swap(ProductID& a, ProductID& b) {
50  a.swap(b);
51  }
52 
53  inline
54  bool operator==(ProductID const& lh, ProductID const& rh) {
55  return lh.processIndex() == rh.processIndex() && lh.productIndex() == rh.productIndex();
56  }
57  inline
58  bool operator!=(ProductID const& lh, ProductID const& rh) {
59  return !(lh == rh);
60  }
61 
62  bool operator<(ProductID const& lh, ProductID const& rh);
63 
64  std::ostream&
65  operator<<(std::ostream& os, ProductID const& id);
66 }
67 #endif
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:92
ProcessIndex productIndex() const
Definition: ProductID.h:37
bool int lh
Definition: SIMDVec.h:21
void swap(ProductID &other)
Definition: ProductID.cc:17
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
ProductID(ProductIndex prodIndex)
Definition: ProductID.h:32
ProductIndex productIndex_
Definition: ProductID.h:45
ProcessIndex processIndex_
Definition: ProductID.h:44
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
unsigned short ProcessIndex
Definition: ProductID.h:25
void reset()
Definition: ProductID.h:39
ProductID(ProcessIndex procIndex, ProductIndex prodIndex)
Definition: ProductID.h:33
double b
Definition: hdecay.h:120
HLT enums.
double a
Definition: hdecay.h:121
unsigned short ProductIndex
Definition: ProductID.h:26
ProductIndex id() const
Definition: ProductID.h:38
bool isValid() const
Definition: ProductID.h:35
ProcessIndex processIndex() const
Definition: ProductID.h:36
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.