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
edm::ProductID::processIndex_
ProcessIndex processIndex_
Definition: ProductID.h:41
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::swap
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
edm::ProductID::ProductID
ProductID(ProcessIndex procIndex, ProductIndex prodIndex)
Definition: ProductID.h:31
edm::ProcessIndex
unsigned short ProcessIndex
Definition: ProductID.h:25
mathSSE::lh
bool int lh
Definition: SIMDVec.h:20
edm::ProductID::processIndex
ProcessIndex processIndex() const
Definition: ProductID.h:33
edm::ProductIndex
unsigned short ProductIndex
Definition: ProductID.h:26
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::ProductID::productIndex_
ProductIndex productIndex_
Definition: ProductID.h:42
edm::ProductID::productIndex
ProcessIndex productIndex() const
Definition: ProductID.h:34
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
trackingPlots.other
other
Definition: trackingPlots.py:1465
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
edm::ProductID::swap
void swap(ProductID &other)
Definition: ProductID.cc:16
edm::ProductID::isValid
bool isValid() const
Definition: ProductID.h:32
edm::ProductID::ProductID
ProductID()
Definition: ProductID.h:29
edm::ProductID::reset
void reset()
Definition: ProductID.h:36
edm::ProductID
Definition: ProductID.h:27
edm::ProductID::ProductID
ProductID(ProductIndex prodIndex)
Definition: ProductID.h:30
edm::ProductID::id
ProductIndex id() const
Definition: ProductID.h:35