CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

edm::FullHistoryToReducedHistoryMap Class Reference

#include <FullHistoryToReducedHistoryMap.h>

List of all members.

Public Member Functions

 FullHistoryToReducedHistoryMap ()
ProcessHistoryID const & reduceProcessHistoryID (ProcessHistoryID const &fullID)
 Use to obtain reduced ProcessHistoryID's from full ProcessHistoryID's.

Private Types

typedef std::map
< ProcessHistoryID,
ProcessHistoryID
Map

Private Member Functions

 FullHistoryToReducedHistoryMap (FullHistoryToReducedHistoryMap const &)
FullHistoryToReducedHistoryMapoperator= (FullHistoryToReducedHistoryMap const &)

Private Attributes

Map cache_
Map::const_iterator previous_

Detailed Description

Definition at line 35 of file FullHistoryToReducedHistoryMap.h.


Member Typedef Documentation

Definition at line 47 of file FullHistoryToReducedHistoryMap.h.


Constructor & Destructor Documentation

edm::FullHistoryToReducedHistoryMap::FullHistoryToReducedHistoryMap ( )

Definition at line 8 of file FullHistoryToReducedHistoryMap.cc.

References cache_, edm::ProcessHistory::id(), previous_, and query::result.

                                                                 {
    // Put in the conversion for the ID of an empty process history.
    // It always maps onto itself, often is needed, and gives
    // us something valid to initialize the iterator with. That removes
    // the need to check for its validity and also for the validity
    // of the fullID argument to the reduce function, because the invalid
    // ProcessHistoryID is strangely also defined as the ID of the empty
    // Process History (maybe that should be fixed ...).
    ProcessHistory ph;
    std::pair<ProcessHistoryID, ProcessHistoryID> newEntry(ph.id(), ph.id());
    std::pair<Map::iterator, bool> result = cache_.insert(newEntry);
    previous_ = result.first;
  }
edm::FullHistoryToReducedHistoryMap::FullHistoryToReducedHistoryMap ( FullHistoryToReducedHistoryMap const &  ) [private]

Member Function Documentation

FullHistoryToReducedHistoryMap& edm::FullHistoryToReducedHistoryMap::operator= ( FullHistoryToReducedHistoryMap const &  ) [private]
ProcessHistoryID const & edm::FullHistoryToReducedHistoryMap::reduceProcessHistoryID ( ProcessHistoryID const &  fullID)

Use to obtain reduced ProcessHistoryID's from full ProcessHistoryID's.

Definition at line 23 of file FullHistoryToReducedHistoryMap.cc.

References cache_, Exception, edm::detail::ThreadSafeRegistry< KEY, T, E >::getMapped(), edm::ProcessHistory::id(), instance, edm::errors::LogicError, previous_, edm::ProcessHistory::reduce(), PhysicsTools::registry(), and query::result.

Referenced by edm::SubProcess::beginRun(), and edm::IndexIntoFile::reduceProcessHistoryIDs().

                                                                                       {
    if (previous_->first == fullID) return previous_->second;
    Map::const_iterator iter = cache_.find(fullID);
    if (iter != cache_.end()) {
      previous_ = iter;
      return iter->second;
    }
    ProcessHistoryRegistry* registry = ProcessHistoryRegistry::instance();
    ProcessHistory ph;
    if (!registry->getMapped(fullID, ph)) {
      throw Exception(errors::LogicError)
        << "FullHistoryToReducedHistoryMap::reduceProcessHistoryID\n"
        << "ProcessHistory not found in registry\n"
        << "Contact a Framework developer\n";
    }
    ph.reduce();
    std::pair<ProcessHistoryID, ProcessHistoryID> newEntry(fullID, ph.id());
    std::pair<Map::iterator, bool> result = cache_.insert(newEntry);
    previous_ = result.first;
    return result.first->second;
  }

Member Data Documentation

Map::const_iterator edm::FullHistoryToReducedHistoryMap::previous_ [private]