CMS 3D CMS Logo

HistoryAppender.cc
Go to the documentation of this file.
5 
6 #include <string>
7 #include <cassert>
8 
10 
11 namespace edm {
12 
14  {
15  }
16 
17  std::shared_ptr<ProcessHistory const>
19  ProcessHistory const* iInputProcessHistory,
20  ProcessConfiguration const& pc) {
21  assert((iInputProcessHistory) == nullptr or (inputPHID == iInputProcessHistory->id()));
22  if (m_cachedHistory.get() != nullptr and inputPHID==m_cachedInputPHID) {
23  return m_cachedHistory;
24  }
25 
26  ProcessHistory const* inputProcessHistory = iInputProcessHistory? iInputProcessHistory : &s_emptyHistory;
27 
28  if (inputPHID.isValid()) {
29  if (iInputProcessHistory == nullptr) {
31  << "HistoryAppender::appendToProcessHistory\n"
32  << "Input ProcessHistory has valid ID but is nullptr\n"
33  << "Contact a Framework developer\n";
34  }
35  }
36 
37  auto newProcessHistory = std::make_shared<ProcessHistory>();
38  *newProcessHistory = *inputProcessHistory;
39  checkProcessHistory(*newProcessHistory, pc);
40  newProcessHistory->push_back(pc);
41  //force it to create the ID
42  newProcessHistory->setProcessHistoryID();
43  m_cachedInputPHID =inputPHID;
44  m_cachedHistory = newProcessHistory;
45  return m_cachedHistory;
46  }
47 
48  void
50  ProcessConfiguration const& pc) const {
51  std::string const& processName = pc.processName();
52  for (auto const& process : ph) {
53  if (processName == process.processName()) {
54  throw edm::Exception(errors::Configuration, "Duplicate Process.")
55  << "The process name " << processName << " was already in the ProcessHistory.\n"
56  << "Please modify the configuration file to use a distinct process name.\n";
57  }
58  }
59  }
60 }
std::shared_ptr< ProcessHistory const > appendToProcessHistory(ProcessHistoryID const &inputPHID, ProcessHistory const *inputProcessHistory, ProcessConfiguration const &pc)
std::string const & processName() const
ProcessHistoryID m_cachedInputPHID
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
static const edm::ProcessHistory s_emptyHistory
void checkProcessHistory(ProcessHistory const &ph, ProcessConfiguration const &pc) const
HLT enums.
ProcessHistoryID id() const
std::shared_ptr< ProcessHistory const > m_cachedHistory