#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 &) | |
HistoryAppender & | operator= (HistoryAppender const &) |
Private Attributes | |
ProcessHistory | emptyHistory_ |
HistoryMap | historyMap_ |
HistoryMap::const_iterator | previous_ |
Definition at line 37 of file HistoryAppender.h.
typedef std::map<ProcessHistoryID, CachedHistory> edm::HistoryAppender::HistoryMap [private] |
Definition at line 65 of file HistoryAppender.h.
edm::HistoryAppender::HistoryAppender | ( | ) |
Definition at line 10 of file HistoryAppender.cc.
: previous_(historyMap_.end()) { }
edm::HistoryAppender::HistoryAppender | ( | HistoryAppender const & | ) | [private] |
CachedHistory const & edm::HistoryAppender::appendToProcessHistory | ( | ProcessHistoryID const & | inputPHID, |
ProcessConfiguration const & | pc | ||
) |
Definition at line 15 of file HistoryAppender.cc.
References checkProcessHistory(), emptyHistory_, 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().
{ if (previous_ != historyMap_.end() && inputPHID == previous_->first) return previous_->second; HistoryMap::iterator iter = historyMap_.find(inputPHID); if (iter != historyMap_.end()) return iter->second; ProcessHistoryRegistry* registry = ProcessHistoryRegistry::instance(); ProcessHistory const* inputProcessHistory = &emptyHistory_; if (inputPHID.isValid()) { inputProcessHistory = registry->getMapped(inputPHID); if (inputProcessHistory == 0) { throw Exception(errors::LogicError) << "HistoryAppender::appendToProcessHistory\n" << "Input ProcessHistory not found in registry\n" << "Contact a Framework developer\n"; } } ProcessHistory newProcessHistory; newProcessHistory = *inputProcessHistory; checkProcessHistory(newProcessHistory, pc); newProcessHistory.push_back(pc); registry->insertMapped(newProcessHistory); ProcessHistoryID newProcessHistoryID = newProcessHistory.id(); CachedHistory newValue(inputProcessHistory, registry->getMapped(newProcessHistoryID), newProcessHistoryID); std::pair<ProcessHistoryID, CachedHistory> newEntry(inputPHID, newValue); std::pair<HistoryMap::iterator, bool> result = historyMap_.insert(newEntry); previous_ = result.first; return result.first->second; }
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(), Exception, and edm::ProcessConfiguration::processName().
Referenced by appendToProcessHistory().
{ std::string const& processName = pc.processName(); for (ProcessHistory::const_iterator it = ph.begin(), itEnd = ph.end(); it != itEnd; ++it) { if (processName == it->processName()) { throw edm::Exception(errors::Configuration, "Duplicate Process.") << "The process name " << processName << " was already in the ProcessHistory.\n" << "Please modify the configuration file to use a distinct process name.\n"; } } }
HistoryAppender& edm::HistoryAppender::operator= | ( | HistoryAppender const & | ) | [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().