CMS 3D CMS Logo

HistoryAppender.cc
Go to the documentation of this file.
5 
6 #include <string>
7 #include <cassert>
8 
9 namespace {
10  edm::ProcessHistory initializeEmpty() {
12  tmp.setProcessHistoryID();
13  return tmp;
14  }
15 }
16 static const edm::ProcessHistory s_emptyHistory = initializeEmpty();
17 
18 namespace edm {
19 
21  {
22  }
23 
24  std::shared_ptr<ProcessHistory const>
26  ProcessHistory const* iInputProcessHistory,
27  ProcessConfiguration const& pc) {
28  assert((iInputProcessHistory) == nullptr or (inputPHID == iInputProcessHistory->id()));
29  if (m_cachedHistory.get() != nullptr and inputPHID==m_cachedInputPHID) {
30  return m_cachedHistory;
31  }
32 
33  ProcessHistory const* inputProcessHistory = iInputProcessHistory? iInputProcessHistory : &s_emptyHistory;
34 
35  if (inputPHID.isValid()) {
36  if (iInputProcessHistory == nullptr) {
38  << "HistoryAppender::appendToProcessHistory\n"
39  << "Input ProcessHistory has valid ID but is nullptr\n"
40  << "Contact a Framework developer\n";
41  }
42  }
43 
44  auto newProcessHistory = std::make_shared<ProcessHistory>();
45  *newProcessHistory = *inputProcessHistory;
46  checkProcessHistory(*newProcessHistory, pc);
47  newProcessHistory->push_back(pc);
48  //force it to create the ID
49  newProcessHistory->setProcessHistoryID();
50  m_cachedInputPHID =inputPHID;
51  m_cachedHistory = newProcessHistory;
52  return m_cachedHistory;
53  }
54 
55  void
57  ProcessConfiguration const& pc) const {
58  std::string const& processName = pc.processName();
59  for (auto const& process : ph) {
60  if (processName == process.processName()) {
61  throw edm::Exception(errors::Configuration, "Duplicate Process.")
62  << "The process name " << processName << " was already in the ProcessHistory.\n"
63  << "Please modify the configuration file to use a distinct process name.\n";
64  }
65  }
66  }
67 }
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
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
HLT enums.
ProcessHistoryID id() const
std::shared_ptr< ProcessHistory const > m_cachedHistory