Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:04

0001 #include "DataFormats/Provenance/interface/Parentage.h"
0002 #include "FWCore/Utilities/interface/Digest.h"
0003 #include <ostream>
0004 #include <sstream>
0005 
0006 /*----------------------------------------------------------------------
0007 
0008 ----------------------------------------------------------------------*/
0009 
0010 namespace edm {
0011   Parentage::Parentage() : parents_() {}
0012 
0013   Parentage::Parentage(std::vector<BranchID> const& parents) : parents_(parents) {}
0014 
0015   Parentage::Parentage(std::vector<BranchID>&& parents) : parents_(std::move(parents)) {}
0016 
0017   ParentageID Parentage::id() const {
0018     std::ostringstream oss;
0019     for (auto const& parent : parents_) {
0020       oss << parent << ' ';
0021     }
0022 
0023     std::string stringrep = oss.str();
0024     cms::Digest md5alg(stringrep);
0025     ParentageID id(md5alg.digest().toString());
0026     return id;
0027   }
0028 
0029   void Parentage::write(std::ostream&) const {
0030     // This is grossly inadequate, but it is not critical for the
0031     // first pass.
0032   }
0033 
0034   bool operator==(Parentage const& a, Parentage const& b) { return a.parents() == b.parents(); }
0035 }  // namespace edm