CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/DataFormats/Provenance/interface/BranchKey.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Provenance_BranchKey_h
00002 #define DataFormats_Provenance_BranchKey_h
00003 
00004 /*----------------------------------------------------------------------
00005   
00006 BranchKey: The key used to identify a Group in the EventPrincipal. The
00007 name of the branch to which the related data product will be written
00008 is determined entirely from the BranchKey.
00009 
00010 ----------------------------------------------------------------------*/
00011 #include <iosfwd>
00012 #include <string>
00013 
00014 namespace edm {
00015   class BranchDescription;
00016   class ConstBranchDescription;
00017 
00018   struct BranchKey {
00019     BranchKey() : friendlyClassName_(), moduleLabel_(), productInstanceName_(), processName_()
00020     {}
00021 
00022     BranchKey(std::string const& cn, std::string const& ml,
00023         std::string const& pin, std::string const& pn) :
00024       friendlyClassName_(cn), 
00025       moduleLabel_(ml), 
00026       productInstanceName_(pin), 
00027       processName_(pn) 
00028     {}
00029 
00030     explicit BranchKey(BranchDescription const& desc);
00031     explicit BranchKey(ConstBranchDescription const& desc);
00032 
00033     std::string friendlyClassName_;
00034     std::string moduleLabel_;
00035     std::string productInstanceName_;
00036     std::string processName_;
00037   };
00038 
00039   inline
00040   bool 
00041   operator<(BranchKey const& a, BranchKey const& b) {
00042       return 
00043         a.friendlyClassName_ < b.friendlyClassName_ ? true :
00044         a.friendlyClassName_ > b.friendlyClassName_ ? false :
00045         a.moduleLabel_ < b.moduleLabel_ ? true :
00046         a.moduleLabel_ > b.moduleLabel_ ? false :
00047         a.productInstanceName_ < b.productInstanceName_ ? true :
00048         a.productInstanceName_ > b.productInstanceName_ ? false :
00049         a.processName_ < b.processName_ ? true :
00050         false;
00051   }
00052 
00053   inline
00054   bool 
00055   operator==(BranchKey const& a, BranchKey const& b) {
00056     return !(a < b || b < a);
00057   }
00058 
00059   inline
00060   bool 
00061   operator!=(BranchKey const& a, BranchKey const& b) {
00062     return !(a == b);
00063   }
00064 
00065   std::ostream&
00066   operator<<(std::ostream& os, BranchKey const& bk);
00067 }
00068 #endif