Go to the documentation of this file.00001 #ifndef DataFormats_Provenance_ProductID_h
00002 #define DataFormats_Provenance_ProductID_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <iosfwd>
00022
00023 namespace edm {
00024
00025 typedef unsigned short ProcessIndex;
00026 typedef unsigned short ProductIndex;
00027 class ProductID {
00028 public:
00029 ProductID() : processIndex_(0),
00030 productIndex_(0),
00031 oldID_(0) {}
00032 explicit
00033 ProductID(ProductIndex productIndex) : processIndex_(0), productIndex_(productIndex), oldID_(0) {}
00034 ProductID(ProcessIndex processIndex, ProductIndex productIndex) :
00035 processIndex_(processIndex), productIndex_(productIndex), oldID_(0) {}
00036 bool isValid() const {return productIndex_ != 0;}
00037 ProcessIndex processIndex() const {return processIndex_;}
00038 ProcessIndex productIndex() const {return productIndex_;}
00039 ProductIndex id() const {return productIndex_;}
00040 void reset() {processIndex_ = productIndex_ = 0;}
00041
00042 unsigned int oldID() const {return oldID_;}
00043 unsigned int & oldID() {return oldID_;}
00044 void swap(ProductID& other);
00045
00046 private:
00047 ProcessIndex processIndex_;
00048 ProductIndex productIndex_;
00049 unsigned int oldID_;
00050 };
00051
00052 inline
00053 void swap(ProductID& a, ProductID& b) {
00054 a.swap(b);
00055 }
00056
00057 inline
00058 bool operator==(ProductID const& lh, ProductID const& rh) {
00059 return lh.processIndex() == rh.processIndex() && lh.productIndex() == rh.productIndex();
00060 }
00061 inline
00062 bool operator!=(ProductID const& lh, ProductID const& rh) {
00063 return !(lh == rh);
00064 }
00065
00066 bool operator<(ProductID const& lh, ProductID const& rh);
00067
00068 std::ostream&
00069 operator<<(std::ostream& os, ProductID const& id);
00070 }
00071 #endif