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  explicit ProductID(ProductIndex prodIndex) : processIndex_(0), productIndex_(prodIndex) {}
31  ProductID(ProcessIndex procIndex, ProductIndex prodIndex) : processIndex_(procIndex), productIndex_(prodIndex) {}
32  bool isValid() const { return productIndex_ != 0; }
35  ProductIndex id() const { return productIndex_; } // backward compatibility
36  void reset() { processIndex_ = productIndex_ = 0; }
37 
38  void swap(ProductID& other);
39 
40  private:
43  };
44 
45  inline void swap(ProductID& a, ProductID& b) { a.swap(b); }
46 
47  inline bool operator==(ProductID const& lh, ProductID const& rh) {
48  return lh.processIndex() == rh.processIndex() && lh.productIndex() == rh.productIndex();
49  }
50  inline bool operator!=(ProductID const& lh, ProductID const& rh) { return !(lh == rh); }
51 
52  bool operator<(ProductID const& lh, ProductID const& rh);
53 
54  std::ostream& operator<<(std::ostream& os, ProductID const& id);
55 } // namespace edm
56 #endif
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:89
constexpr bool operator==(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
bool isValid() const
Definition: ProductID.h:32
bool int lh
Definition: SIMDVec.h:20
void swap(ProductID &other)
Definition: ProductID.cc:16
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
ProductID(ProductIndex prodIndex)
Definition: ProductID.h:30
ProductIndex productIndex_
Definition: ProductID.h:42
constexpr bool operator!=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
ProcessIndex processIndex_
Definition: ProductID.h:41
ProcessIndex processIndex() const
Definition: ProductID.h:33
ProductIndex id() const
Definition: ProductID.h:35
unsigned short ProcessIndex
Definition: ProductID.h:25
void reset()
Definition: ProductID.h:36
ProductID(ProcessIndex procIndex, ProductIndex prodIndex)
Definition: ProductID.h:31
double b
Definition: hdecay.h:118
HLT enums.
double a
Definition: hdecay.h:119
ProcessIndex productIndex() const
Definition: ProductID.h:34
unsigned short ProductIndex
Definition: ProductID.h:26
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger table.