Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:30

0001 #ifndef DataFormats_Provenance_ProductProvenance_h
0002 #define DataFormats_Provenance_ProductProvenance_h
0003 
0004 /*----------------------------------------------------------------------
0005 
0006 ProductProvenance: The event dependent portion of the description of a product
0007 and how it came into existence.
0008 
0009 ----------------------------------------------------------------------*/
0010 #include "DataFormats/Provenance/interface/BranchID.h"
0011 #include "DataFormats/Provenance/interface/ParentageID.h"
0012 #include "DataFormats/Provenance/interface/ProvenanceFwd.h"
0013 
0014 #include <memory>
0015 
0016 #include <iosfwd>
0017 #include <vector>
0018 
0019 /*
0020   ProductProvenance
0021 */
0022 
0023 namespace edm {
0024   class ProductProvenance {
0025   public:
0026     ProductProvenance();
0027     explicit ProductProvenance(BranchID bid);
0028     ProductProvenance(BranchID bid, ParentageID id);
0029 
0030     ProductProvenance(BranchID bid, std::vector<BranchID> const& parents);
0031 
0032     ProductProvenance(BranchID bid, std::vector<BranchID>&& parents);
0033 
0034     ProductProvenance makeProductProvenance() const;
0035 
0036     void write(std::ostream& os) const;
0037 
0038     BranchID const& branchID() const { return branchID_; }
0039     ParentageID const& parentageID() const { return parentageID_; }
0040     Parentage const& parentage() const;
0041 
0042     void set(ParentageID id) { parentageID_ = std::move(id); }
0043     ParentageID moveParentageID() { return std::move(parentageID_); }
0044 
0045   private:
0046     BranchID branchID_;
0047     ParentageID parentageID_;
0048   };
0049 
0050   inline bool operator<(ProductProvenance const& a, ProductProvenance const& b) { return a.branchID() < b.branchID(); }
0051 
0052   inline std::ostream& operator<<(std::ostream& os, ProductProvenance const& p) {
0053     p.write(os);
0054     return os;
0055   }
0056 
0057   // Only the 'salient attributes' are testing in equality comparison.
0058   bool operator==(ProductProvenance const& a, ProductProvenance const& b);
0059   inline bool operator!=(ProductProvenance const& a, ProductProvenance const& b) { return !(a == b); }
0060   typedef std::vector<ProductProvenance> ProductProvenanceVector;
0061 }  // namespace edm
0062 #endif