CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
edm::HistoryAppender Class Reference

#include <HistoryAppender.h>

Public Member Functions

std::shared_ptr< ProcessHistory const > appendToProcessHistory (ProcessHistoryID const &inputPHID, ProcessHistory const *inputProcessHistory, ProcessConfiguration const &pc)
 
 HistoryAppender ()
 
 HistoryAppender (HistoryAppender const &)=delete
 
HistoryAppenderoperator= (HistoryAppender const &)=delete
 

Private Member Functions

void checkProcessHistory (ProcessHistory const &ph, ProcessConfiguration const &pc) const
 

Private Attributes

std::shared_ptr< ProcessHistory const > m_cachedHistory
 
ProcessHistoryID m_cachedInputPHID
 

Detailed Description

Definition at line 13 of file HistoryAppender.h.

Constructor & Destructor Documentation

◆ HistoryAppender() [1/2]

edm::HistoryAppender::HistoryAppender ( )

Definition at line 19 of file HistoryAppender.cc.

19 {}

◆ HistoryAppender() [2/2]

edm::HistoryAppender::HistoryAppender ( HistoryAppender const &  )
delete

Member Function Documentation

◆ appendToProcessHistory()

std::shared_ptr< ProcessHistory const > edm::HistoryAppender::appendToProcessHistory ( ProcessHistoryID const &  inputPHID,
ProcessHistory const *  inputProcessHistory,
ProcessConfiguration const &  pc 
)

Definition at line 21 of file HistoryAppender.cc.

References cms::cuda::assert(), checkProcessHistory(), Exception, edm::ProcessHistory::id(), edm::errors::LogicError, m_cachedHistory, m_cachedInputPHID, or, and s_emptyHistory.

22  {
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  }
assert(be >=bs)
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::shared_ptr< ProcessHistory const > m_cachedHistory

◆ checkProcessHistory()

void edm::HistoryAppender::checkProcessHistory ( ProcessHistory const &  ph,
ProcessConfiguration const &  pc 
) const
private

Definition at line 49 of file HistoryAppender.cc.

References edm::errors::Configuration, Exception, LaserDQM_cfg::process, SimL1EmulatorRepack_CalouGT_cff::processName, edm::ProcessConfiguration::processName(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by appendToProcessHistory().

49  {
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  }

◆ operator=()

HistoryAppender& edm::HistoryAppender::operator= ( HistoryAppender const &  )
delete

Member Data Documentation

◆ m_cachedHistory

std::shared_ptr<ProcessHistory const> edm::HistoryAppender::m_cachedHistory
private

Definition at line 32 of file HistoryAppender.h.

Referenced by appendToProcessHistory().

◆ m_cachedInputPHID

ProcessHistoryID edm::HistoryAppender::m_cachedInputPHID
private

Definition at line 31 of file HistoryAppender.h.

Referenced by appendToProcessHistory().