00001 #ifndef DataFormats_Provenance_EventEntryDescription_h 00002 #define DataFormats_Provenance_EventEntryDescription_h 00003 00004 /*---------------------------------------------------------------------- 00005 00006 EventEntryDescription: The event dependent portion of the description of a product 00007 and how it came into existence. 00008 00009 ----------------------------------------------------------------------*/ 00010 #include <iosfwd> 00011 #include <vector> 00012 #include "boost/shared_ptr.hpp" 00013 00014 #include "DataFormats/Provenance/interface/BranchID.h" 00015 #include "DataFormats/Provenance/interface/ModuleDescription.h" 00016 #include "DataFormats/Provenance/interface/EntryDescriptionID.h" 00017 #include "DataFormats/Provenance/interface/Transient.h" 00018 00019 /* 00020 EventEntryDescription 00021 00022 definitions: 00023 Product: The EDProduct to which a provenance object is associated 00024 00025 Creator: The EDProducer that made the product. 00026 00027 Parents: The EDProducts used as input by the creator. 00028 */ 00029 00030 namespace edm { 00031 class EventEntryDescription { 00032 public: 00033 EventEntryDescription(); 00034 00035 ~EventEntryDescription() {} 00036 00037 // Only the 'salient attributes' are encoded into the ID. 00038 EntryDescriptionID id() const; 00039 00040 void write(std::ostream& os) const; 00041 00042 std::string const& moduleName() const {return getModuleDescriptionPtr()->moduleName_;} 00043 PassID const& passID() const {return getModuleDescriptionPtr()->passID();} 00044 ParameterSetID const& psetID() const {return getModuleDescriptionPtr()->parameterSetID();} 00045 ReleaseVersion const& releaseVersion() const {return getModuleDescriptionPtr()->releaseVersion();} 00046 std::vector<BranchID> const& parents() const {return parents_;} 00047 std::vector<BranchID> & parents() {return parents_;} 00048 00049 ModuleDescriptionID const& moduleDescriptionID() const {return moduleDescriptionID_;} 00050 ModuleDescriptionID & moduleDescriptionID() {return moduleDescriptionID_;} 00051 ModuleDescription const& moduleDescription() const {return *getModuleDescriptionPtr();} 00052 00053 struct Transients { 00054 Transients() : moduleDescriptionPtr_() {} 00055 boost::shared_ptr<ModuleDescription> moduleDescriptionPtr_; 00056 }; 00057 00058 void setDefaultTransients() const { 00059 transients_ = Transients(); 00060 }; 00061 00062 private: 00063 void init() const; 00064 00065 boost::shared_ptr<ModuleDescription> & getModuleDescriptionPtr() const { 00066 init(); 00067 return transients_.get().moduleDescriptionPtr_; 00068 } 00069 00070 boost::shared_ptr<ModuleDescription> & moduleDescriptionPtr() const { 00071 return transients_.get().moduleDescriptionPtr_; 00072 } 00073 00074 // The Branch IDs of the parents 00075 std::vector<BranchID> parents_; 00076 00077 // the last of these is not in the roadmap, but is on the board 00078 00079 ModuleDescriptionID moduleDescriptionID_; 00080 00081 mutable Transient<Transients> transients_; 00082 }; 00083 00084 inline 00085 std::ostream& 00086 operator<<(std::ostream& os, EventEntryDescription const& p) { 00087 p.write(os); 00088 return os; 00089 } 00090 00091 // Only the 'salient attributes' are testing in equality comparison. 00092 bool operator==(EventEntryDescription const& a, EventEntryDescription const& b); 00093 inline bool operator!=(EventEntryDescription const& a, EventEntryDescription const& b) { return !(a==b); } 00094 } 00095 #endif