CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProcessHistory.cc
Go to the documentation of this file.
1 #include <iterator>
2 #include <ostream>
3 #include <sstream>
6 
8 
9 namespace edm {
12  if(transient_.phid_.isValid()) {
13  return transient_.phid_;
14  }
15  // This implementation is ripe for optimization.
16  // We do not use operator<< because it does not write out everything.
17  std::ostringstream oss;
18  for(auto const& item : *this) {
19  oss << item.processName() << ' '
20  << item.parameterSetID() << ' '
21  << item.releaseVersion() << ' '
22  << item.passID() << ' ';
23  }
24  std::string stringrep = oss.str();
25  cms::Digest md5alg(stringrep);
26  ProcessHistoryID phID(md5alg.digest().toString());
27  return phID;
28  }
29 
32  if(!transient_.phid_.isValid()) {
33  transient_.phid_ = id();
34  }
35  return transient_.phid_;
36  }
37 
38  bool
41  for(auto const& item : *this) {
42  if (item.processName() == name) {
43  config = item;
44  return true;
45  }
46  }
47  // Name not found!
48  return false;
49  }
50 
53  phid() = ProcessHistoryID();
54  for(auto& item : data_) {
55  item.reduce();
56  }
57  return *this;
58  }
59 
60  bool
62  if (a.size() >= b.size()) return false;
63  typedef ProcessHistory::collection_type::const_iterator const_iterator;
64  for (const_iterator itA = a.data().begin(), itB = b.data().begin(),
65  itAEnd = a.data().end(); itA != itAEnd; ++itA, ++itB) {
66  if (*itA != *itB) return false;
67  }
68  return true;
69  }
70 
71  std::ostream&
72  operator<<(std::ostream& ost, ProcessHistory const& ph) {
73  ost << "Process History = ";
74  copy_all(ph, std::ostream_iterator<ProcessHistory::value_type>(ost,";"));
75  return ost;
76  }
77 }
ProcessHistory & reduce()
size_type size() const
collection_type const & data() const
ProcessHistoryID setProcessHistoryID()
MD5Result digest() const
Definition: Digest.cc:194
bool getConfigurationForProcess(std::string const &name, ProcessConfiguration &config) const
bool isAncestor(ProcessHistory const &a, ProcessHistory const &b)
Hash< ProcessHistoryType > ProcessHistoryID
std::string toString() const
Definition: Digest.cc:87
double b
Definition: hdecay.h:120
bool isValid() const
Definition: Hash.h:150
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
Definition: Algorithms.h:24
double a
Definition: hdecay.h:121
ProcessHistoryID & phid()
collection_type data_
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
ProcessHistoryID id() const