Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DataFormats_Provenance_StableProvenance_h
0002 #define DataFormats_Provenance_StableProvenance_h
0003 
0004 /*----------------------------------------------------------------------
0005 
0006 StableProvenance: The full description of a product, excluding the parentage.
0007 The parentage can change from event to event.
0008 
0009 ----------------------------------------------------------------------*/
0010 
0011 #include "DataFormats/Provenance/interface/BranchDescription.h"
0012 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0013 #include "DataFormats/Provenance/interface/ProcessHistory.h"
0014 #include "DataFormats/Provenance/interface/ProductID.h"
0015 #include "DataFormats/Provenance/interface/ReleaseVersion.h"
0016 
0017 #include <memory>
0018 
0019 #include <iosfwd>
0020 /*
0021   StableProvenance
0022 
0023   definitions:
0024   Product: The EDProduct to which a provenance object is associated
0025 
0026   Creator: The EDProducer that made the product.
0027 */
0028 
0029 namespace edm {
0030   class StableProvenance {
0031   public:
0032     StableProvenance();
0033 
0034     StableProvenance(std::shared_ptr<BranchDescription const> const& p, ProductID const& pid);
0035 
0036     BranchDescription const& branchDescription() const { return *branchDescription_; }
0037     std::shared_ptr<BranchDescription const> const& constBranchDescriptionPtr() const { return branchDescription_; }
0038 
0039     BranchID const& branchID() const { return branchDescription().branchID(); }
0040     BranchID const& originalBranchID() const { return branchDescription().originalBranchID(); }
0041     std::string const& branchName() const { return branchDescription().branchName(); }
0042     std::string const& className() const { return branchDescription().className(); }
0043     std::string const& moduleLabel() const { return branchDescription().moduleLabel(); }
0044     std::string const& moduleName() const { return branchDescription().moduleName(); }
0045     std::string const& processName() const { return branchDescription().processName(); }
0046     std::string const& productInstanceName() const { return branchDescription().productInstanceName(); }
0047     std::string const& friendlyClassName() const { return branchDescription().friendlyClassName(); }
0048     std::set<std::string> const& branchAliases() const { return branchDescription().branchAliases(); }
0049 
0050     void write(std::ostream& os) const;
0051 
0052     ProductID const& productID() const { return productID_; }
0053 
0054     void setProductID(ProductID const& pid) { productID_ = pid; }
0055 
0056     void setBranchDescription(std::shared_ptr<BranchDescription const> const& p) { branchDescription_ = p; }
0057 
0058     void swap(StableProvenance&);
0059 
0060   private:
0061     std::shared_ptr<BranchDescription const> branchDescription_;
0062     ProductID productID_;
0063   };
0064 
0065   inline std::ostream& operator<<(std::ostream& os, StableProvenance const& p) {
0066     p.write(os);
0067     return os;
0068   }
0069 
0070   bool operator==(StableProvenance const& a, StableProvenance const& b);
0071 
0072 }  // namespace edm
0073 #endif