Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-31 02:19:09

0001 #ifndef DataFormats_Provenance_BranchKey_h
0002 #define DataFormats_Provenance_BranchKey_h
0003 
0004 /*----------------------------------------------------------------------
0005   
0006 BranchKey: The key used to identify a Product in the EventPrincipal. The
0007 name of the branch to which the related data product will be written
0008 is determined entirely from the BranchKey.
0009 
0010 ----------------------------------------------------------------------*/
0011 #include <iosfwd>
0012 #include <string>
0013 
0014 #include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
0015 
0016 namespace edm {
0017 
0018   class BranchKey {
0019   public:
0020     BranchKey() : friendlyClassName_(), moduleLabel_(), productInstanceName_(), processName_() {}
0021 
0022     BranchKey(std::string const& cn, std::string const& ml, std::string const& pin, std::string const& pn)
0023         : friendlyClassName_(cn), moduleLabel_(ml), productInstanceName_(pin), processName_(pn) {}
0024 
0025     explicit BranchKey(ProductDescription const& desc);
0026 
0027     std::string const& friendlyClassName() const { return friendlyClassName_; }
0028     std::string const& moduleLabel() const { return moduleLabel_; }
0029     std::string const& productInstanceName() const { return productInstanceName_; }
0030     std::string const& processName() const { return processName_; }
0031 
0032   private:
0033     std::string friendlyClassName_;
0034     std::string moduleLabel_;
0035     std::string productInstanceName_;
0036     std::string processName_;
0037   };
0038 
0039   inline bool operator<(BranchKey const& a, BranchKey const& b) {
0040     return a.friendlyClassName() < b.friendlyClassName()       ? true
0041            : a.friendlyClassName() > b.friendlyClassName()     ? false
0042            : a.moduleLabel() < b.moduleLabel()                 ? true
0043            : a.moduleLabel() > b.moduleLabel()                 ? false
0044            : a.productInstanceName() < b.productInstanceName() ? true
0045            : a.productInstanceName() > b.productInstanceName() ? false
0046            : a.processName() < b.processName()                 ? true
0047                                                                : false;
0048   }
0049 
0050   inline bool operator==(BranchKey const& a, BranchKey const& b) { return !(a < b || b < a); }
0051 
0052   inline bool operator!=(BranchKey const& a, BranchKey const& b) { return !(a == b); }
0053 
0054   std::ostream& operator<<(std::ostream& os, BranchKey const& bk);
0055 }  // namespace edm
0056 #endif