Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-06-11 04:37:00

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 namespace edm {
0015   class BranchDescription;
0016 
0017   class BranchKey {
0018   public:
0019     BranchKey() : friendlyClassName_(), moduleLabel_(), productInstanceName_(), processName_() {}
0020 
0021     BranchKey(std::string const& cn, std::string const& ml, std::string const& pin, std::string const& pn)
0022         : friendlyClassName_(cn), moduleLabel_(ml), productInstanceName_(pin), processName_(pn) {}
0023 
0024     explicit BranchKey(BranchDescription const& desc);
0025 
0026     std::string const& friendlyClassName() const { return friendlyClassName_; }
0027     std::string const& moduleLabel() const { return moduleLabel_; }
0028     std::string const& productInstanceName() const { return productInstanceName_; }
0029     std::string const& processName() const { return processName_; }
0030 
0031   private:
0032     std::string friendlyClassName_;
0033     std::string moduleLabel_;
0034     std::string productInstanceName_;
0035     std::string processName_;
0036   };
0037 
0038   inline bool operator<(BranchKey const& a, BranchKey const& b) {
0039     return a.friendlyClassName() < b.friendlyClassName()       ? true
0040            : a.friendlyClassName() > b.friendlyClassName()     ? false
0041            : a.moduleLabel() < b.moduleLabel()                 ? true
0042            : a.moduleLabel() > b.moduleLabel()                 ? false
0043            : a.productInstanceName() < b.productInstanceName() ? true
0044            : a.productInstanceName() > b.productInstanceName() ? false
0045            : a.processName() < b.processName()                 ? true
0046                                                                : false;
0047   }
0048 
0049   inline bool operator==(BranchKey const& a, BranchKey const& b) { return !(a < b || b < a); }
0050 
0051   inline bool operator!=(BranchKey const& a, BranchKey const& b) { return !(a == b); }
0052 
0053   std::ostream& operator<<(std::ostream& os, BranchKey const& bk);
0054 }  // namespace edm
0055 #endif