CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HistoryAppender.cc
Go to the documentation of this file.
4 
5 #include <string>
6 #include <cassert>
7 
8 namespace {
9  edm::ProcessHistory initializeEmpty() {
11  tmp.setProcessHistoryID();
12  return tmp;
13  }
14 } // namespace
15 static const edm::ProcessHistory s_emptyHistory = initializeEmpty();
16 
17 namespace edm {
18 
20 
21  std::shared_ptr<ProcessHistory const> HistoryAppender::appendToProcessHistory(
22  ProcessHistoryID const& inputPHID, ProcessHistory const* iInputProcessHistory, ProcessConfiguration const& pc) {
23  assert((iInputProcessHistory) == nullptr or (inputPHID == iInputProcessHistory->id()));
24  if (m_cachedHistory.get() != nullptr and inputPHID == m_cachedInputPHID) {
25  return m_cachedHistory;
26  }
27 
28  ProcessHistory const* inputProcessHistory = iInputProcessHistory ? iInputProcessHistory : &s_emptyHistory;
29 
30  if (inputPHID.isValid()) {
31  if (iInputProcessHistory == nullptr) {
32  throw Exception(errors::LogicError) << "HistoryAppender::appendToProcessHistory\n"
33  << "Input ProcessHistory has valid ID but is nullptr\n"
34  << "Contact a Framework developer\n";
35  }
36  }
37 
38  auto newProcessHistory = std::make_shared<ProcessHistory>();
39  *newProcessHistory = *inputProcessHistory;
40  checkProcessHistory(*newProcessHistory, pc);
41  newProcessHistory->push_back(pc);
42  //force it to create the ID
43  newProcessHistory->setProcessHistoryID();
44  m_cachedInputPHID = inputPHID;
45  m_cachedHistory = newProcessHistory;
46  return m_cachedHistory;
47  }
48 
50  std::string const& processName = pc.processName();
51  for (auto const& process : ph) {
52  if (processName == process.processName()) {
53  throw edm::Exception(errors::Configuration, "Duplicate Process.")
54  << "The process name " << processName << " was already in the ProcessHistory.\n"
55  << "Please modify the configuration file to use a distinct process name.\n";
56  }
57  }
58  }
59 } // namespace edm
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::shared_ptr< ProcessHistory const > appendToProcessHistory(ProcessHistoryID const &inputPHID, ProcessHistory const *inputProcessHistory, ProcessConfiguration const &pc)
assert(be >=bs)
std::string const & processName() const
ProcessHistoryID m_cachedInputPHID
static const edm::ProcessHistory s_emptyHistory
void checkProcessHistory(ProcessHistory const &ph, ProcessConfiguration const &pc) const
tuple process
Definition: LaserDQM_cfg.py:3
tmp
align.sh
Definition: createJobs.py:716
ProcessHistoryID id() const
std::shared_ptr< ProcessHistory const > m_cachedHistory