CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HistoryAppender.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_HistoryAppender_h
2 #define FWCore_Framework_HistoryAppender_h
3 
6 
7 #include <map>
8 
9 namespace edm {
10 
11  class ProcessConfiguration;
12 
13  class CachedHistory {
14  public:
15 
19  inputProcessHistory_(inputProcessHistory),
20  processHistory_(processHistory),
21  processHistoryID_(processHistoryID) {
22  }
23 
25  ProcessHistory const* processHistory() const { return processHistory_; }
27 
28  private:
29 
30  // This class does not own the memory
33 
35  };
36 
38  public:
39 
41 
42  // Used to append the current process to the process history
43  // when necessary. Optimized to cache the results so it
44  // does not need to repeat the same calculations many times.
45  CachedHistory const&
47  ProcessConfiguration const& pc);
48 
49  private:
52 
53  // Throws if the new process name is already in the process
54  // process history
55  void checkProcessHistory(ProcessHistory const& ph,
56  ProcessConfiguration const& pc) const;
57 
58  // The map is intended to have the key be the ProcessHistoryID
59  // read from the input file in one of the Auxiliary objects.
60  // The CachedHistory has the ProcessHistoryID after adding
61  // the current process and the two pointers to the corresponding
62  // ProcessHistory objects in the registry, except if the history
63  // is empty then the pointer is to the data member of this class
64  // because the empty one is never in the registry.
65  typedef std::map<ProcessHistoryID, CachedHistory> HistoryMap;
67 
68  // We cache iterator to the previous element for
69  // performance. We expect the IDs to repeat many times
70  // and this avoids the lookup in that case.
71  HistoryMap::const_iterator previous_;
72 
74  };
75 }
76 #endif
ProcessHistoryID processHistoryID_
std::map< ProcessHistoryID, CachedHistory > HistoryMap
CachedHistory const & appendToProcessHistory(ProcessHistoryID const &inputPHID, ProcessConfiguration const &pc)
CachedHistory(ProcessHistory const *inputProcessHistory, ProcessHistory const *processHistory, ProcessHistoryID const &processHistoryID)
ProcessHistoryID const & processHistoryID() const
ProcessHistory const * processHistory_
ProcessHistory const * inputProcessHistory_
HistoryAppender & operator=(HistoryAppender const &)
HistoryMap::const_iterator previous_
void checkProcessHistory(ProcessHistory const &ph, ProcessConfiguration const &pc) const
ProcessHistory const * processHistory() const
ProcessHistory const * inputProcessHistory() const
ProcessHistory emptyHistory_