CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
edm::HistoryAppender Class Reference

#include <HistoryAppender.h>

Public Member Functions

CachedHistory const & appendToProcessHistory (ProcessHistoryID const &inputPHID, ProcessConfiguration const &pc)
 
 HistoryAppender ()
 

Private Types

typedef std::map
< ProcessHistoryID,
CachedHistory
HistoryMap
 

Private Member Functions

void checkProcessHistory (ProcessHistory const &ph, ProcessConfiguration const &pc) const
 
 HistoryAppender (HistoryAppender const &)
 
HistoryAppenderoperator= (HistoryAppender const &)
 

Private Attributes

ProcessHistory emptyHistory_
 
HistoryMap historyMap_
 
HistoryMap::const_iterator previous_
 

Detailed Description

Definition at line 37 of file HistoryAppender.h.

Member Typedef Documentation

Definition at line 65 of file HistoryAppender.h.

Constructor & Destructor Documentation

edm::HistoryAppender::HistoryAppender ( )

Definition at line 10 of file HistoryAppender.cc.

10  :
11  previous_(historyMap_.end()) {
12  }
HistoryMap::const_iterator previous_
edm::HistoryAppender::HistoryAppender ( HistoryAppender const &  )
private

Member Function Documentation

CachedHistory const & edm::HistoryAppender::appendToProcessHistory ( ProcessHistoryID const &  inputPHID,
ProcessConfiguration const &  pc 
)

Definition at line 15 of file HistoryAppender.cc.

References checkProcessHistory(), emptyHistory_, edm::hlt::Exception, historyMap_, edm::ProcessHistory::id(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::Hash< I >::isValid(), edm::errors::LogicError, previous_, edm::ProcessHistory::push_back(), PhysicsTools::registry, and query::result.

Referenced by edm::Principal::fillPrincipal().

16  {
17 
18  if (previous_ != historyMap_.end() && inputPHID == previous_->first) return previous_->second;
19 
20  HistoryMap::iterator iter = historyMap_.find(inputPHID);
21  if (iter != historyMap_.end()) return iter->second;
22 
24 
25  ProcessHistory const* inputProcessHistory = &emptyHistory_;
26 
27  if (inputPHID.isValid()) {
28  inputProcessHistory = registry->getMapped(inputPHID);
29  if (inputProcessHistory == 0) {
31  << "HistoryAppender::appendToProcessHistory\n"
32  << "Input ProcessHistory not found in registry\n"
33  << "Contact a Framework developer\n";
34  }
35  }
36 
37  ProcessHistory newProcessHistory;
38  newProcessHistory = *inputProcessHistory;
39  checkProcessHistory(newProcessHistory, pc);
40  newProcessHistory.push_back(pc);
41  registry->insertMapped(newProcessHistory);
42  ProcessHistoryID newProcessHistoryID = newProcessHistory.id();
43  CachedHistory newValue(inputProcessHistory,
44  registry->getMapped(newProcessHistoryID),
45  newProcessHistoryID);
46  std::pair<ProcessHistoryID, CachedHistory> newEntry(inputPHID, newValue);
47  std::pair<HistoryMap::iterator, bool> result = historyMap_.insert(newEntry);
48  previous_ = result.first;
49  return result.first->second;
50  }
static ThreadSafeRegistry * instance()
edm::detail::ThreadSafeRegistry< edm::ProcessHistoryID, edm::ProcessHistory, edm::FullHistoryToReducedHistoryMap > ProcessHistoryRegistry
tuple result
Definition: query.py:137
Hash< ProcessHistoryType > ProcessHistoryID
HistoryMap::const_iterator previous_
void checkProcessHistory(ProcessHistory const &ph, ProcessConfiguration const &pc) const
static Interceptor::Registry registry("Interceptor")
ProcessHistory emptyHistory_
void edm::HistoryAppender::checkProcessHistory ( ProcessHistory const &  ph,
ProcessConfiguration const &  pc 
) const
private

Definition at line 53 of file HistoryAppender.cc.

References edm::ProcessHistory::begin(), edm::errors::Configuration, edm::ProcessHistory::end(), edm::hlt::Exception, and edm::ProcessConfiguration::processName().

Referenced by appendToProcessHistory().

54  {
55  std::string const& processName = pc.processName();
56  for (ProcessHistory::const_iterator it = ph.begin(), itEnd = ph.end(); it != itEnd; ++it) {
57  if (processName == it->processName()) {
58  throw edm::Exception(errors::Configuration, "Duplicate Process.")
59  << "The process name " << processName << " was already in the ProcessHistory.\n"
60  << "Please modify the configuration file to use a distinct process name.\n";
61  }
62  }
63  }
collection_type::const_iterator const_iterator
HistoryAppender& edm::HistoryAppender::operator= ( HistoryAppender const &  )
private

Member Data Documentation

ProcessHistory edm::HistoryAppender::emptyHistory_
private

Definition at line 73 of file HistoryAppender.h.

Referenced by appendToProcessHistory().

HistoryMap edm::HistoryAppender::historyMap_
private

Definition at line 66 of file HistoryAppender.h.

Referenced by appendToProcessHistory().

HistoryMap::const_iterator edm::HistoryAppender::previous_
private

Definition at line 71 of file HistoryAppender.h.

Referenced by appendToProcessHistory().