CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 EDProduct 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  oldID_(0) {}
32  explicit
35  processIndex_(processIndex), productIndex_(productIndex), oldID_(0) {}
36  bool isValid() const {return productIndex_ != 0;}
39  ProductIndex id() const {return productIndex_;} // backward compatibility
41 
42  unsigned int oldID() const {return oldID_;}
43  unsigned int & oldID() {return oldID_;}
44  void swap(ProductID& other);
45 
46  private:
49  unsigned int oldID_;
50  };
51 
52  inline
53  void swap(ProductID& a, ProductID& b) {
54  a.swap(b);
55  }
56 
57  inline
58  bool operator==(ProductID const& lh, ProductID const& rh) {
59  return lh.processIndex() == rh.processIndex() && lh.productIndex() == rh.productIndex();
60  }
61  inline
62  bool operator!=(ProductID const& lh, ProductID const& rh) {
63  return !(lh == rh);
64  }
65 
66  bool operator<(ProductID const& lh, ProductID const& rh);
67 
68  std::ostream&
69  operator<<(std::ostream& os, ProductID const& id);
70 }
71 #endif
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:77
unsigned int oldID_
Definition: ProductID.h:49
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
ProductID(ProcessIndex processIndex, ProductIndex productIndex)
Definition: ProductID.h:34
ProcessIndex productIndex() const
Definition: ProductID.h:38
bool int lh
Definition: SSEVec.h:37
void swap(ProductID &other)
Definition: ProductID.cc:17
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
unsigned int & oldID()
Definition: ProductID.h:43
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
ProductIndex productIndex_
Definition: ProductID.h:48
ProcessIndex processIndex_
Definition: ProductID.h:47
unsigned short ProcessIndex
Definition: ProductID.h:25
void reset()
Definition: ProductID.h:40
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
unsigned short ProductIndex
Definition: ProductID.h:26
ProductIndex id() const
Definition: ProductID.h:39
bool isValid() const
Definition: ProductID.h:36
ProcessIndex processIndex() const
Definition: ProductID.h:37
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
ProductID(ProductIndex productIndex)
Definition: ProductID.h:33
unsigned int oldID() const
Definition: ProductID.h:42