CMS 3D CMS Logo

ProcessHistory.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_ProcessHistory_h
2 #define DataFormats_Provenance_ProcessHistory_h
3 
6 
7 #include <iosfwd>
8 #include <string>
9 #include <utility>
10 #include <vector>
11 
12 namespace edm {
14  public:
16  typedef std::vector<value_type> collection_type;
17 
18  typedef collection_type::iterator iterator;
19  typedef collection_type::const_iterator const_iterator;
20 
21  typedef collection_type::reverse_iterator reverse_iterator;
22  typedef collection_type::const_reverse_iterator const_reverse_iterator;
23 
25  typedef collection_type::const_reference const_reference;
26 
28 
30  explicit ProcessHistory(size_type n) : data_(n), transient_() {}
31  explicit ProcessHistory(collection_type const& vec) : data_(vec), transient_() {}
32 
33  template<typename... Args>
34  void emplace_back(Args&&... args) {data_.emplace_back(std::forward<Args>(args)...); phid() = ProcessHistoryID();}
35 
36  void push_front(const_reference t) {data_.insert(data_.begin(), t); phid() = ProcessHistoryID();}
37  void push_back(const_reference t) {data_.push_back(t); phid() = ProcessHistoryID();}
38  void swap(ProcessHistory& other) {data_.swap(other.data_); phid().swap(other.phid());}
39  bool empty() const {return data_.empty();}
40  size_type size() const {return data_.size();}
41  size_type capacity() const {return data_.capacity();}
42  void reserve(size_type n) {data_.reserve(n);}
43 
44  reference operator[](size_type i) {return data_[i];}
45  const_reference operator[](size_type i) const {return data_[i];}
46 
47  reference at(size_type i) {return data_.at(i);}
48  const_reference at(size_type i) const {return data_.at(i);}
49 
50  const_iterator begin() const {return data_.begin();}
51  const_iterator end() const {return data_.end();}
52 
53  const_reverse_iterator rbegin() const {return data_.rbegin();}
54  const_reverse_iterator rend() const {return data_.rend();}
55 
56 // iterator begin() {return data_.begin();}
57 // iterator end() {return data_.end();}
58 
59 // reverse_iterator rbegin() {return data_.rbegin();}
60 // reverse_iterator rend() {return data_.rend();}
61 
62  collection_type const& data() const {return data_;}
63  ProcessHistoryID id() const;
65 
66  // Return true, and fill in config appropriately, if the a process
67  // with the given name is recorded in this ProcessHistory. Return
68  // false, and do not modify config, if process with the given name
69  // is not found.
71 
72  void clear() {
73  data_.clear();
74  phid() = ProcessHistoryID();
75  }
76 
78 
80 
81  struct Transients {
82  Transients() : phid_() {}
83  void reset() {phid_.reset();}
85  };
86 
87  private:
89  collection_type data_;
91  };
92 
93  // Free swap function
94  inline
95  void
97  a.swap(b);
98  }
99 
100  inline
101  bool
103  return a.data() == b.data();
104  }
105 
106  inline
107  bool
109  return !(a==b);
110  }
111 
112  bool
113  isAncestor(ProcessHistory const& a, ProcessHistory const& b);
114 
115  inline
116  bool
118  return isAncestor(b, a);
119  }
120 
121  std::ostream& operator<<(std::ostream& ost, ProcessHistory const& ph);
122 }
123 
124 #endif
const_reverse_iterator rbegin() const
collection_type::const_iterator const_iterator
const_iterator begin() const
ProcessHistory & reduce()
size_type size() const
collection_type::const_reverse_iterator const_reverse_iterator
collection_type::const_reference const_reference
bool isDescendant(ProcessHistory const &a, ProcessHistory const &b)
collection_type const & data() const
void swap(Hash< I > &other)
Definition: Hash.h:210
ProcessHistoryID setProcessHistoryID()
Definition: config.py:1
collection_type::reverse_iterator reverse_iterator
ProcessHistory(collection_type const &vec)
uint16_t size_type
void emplace_back(Args &&...args)
ProcessHistory(size_type n)
bool getConfigurationForProcess(std::string const &name, ProcessConfiguration &config) const
size_type capacity() const
bool isAncestor(ProcessHistory const &a, ProcessHistory const &b)
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
const_reverse_iterator rend() const
reference at(size_type i)
std::vector< value_type > collection_type
bool empty() const
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
ProcessConfiguration value_type
Hash< ProcessHistoryType > ProcessHistoryID
void push_front(const_reference t)
collection_type::size_type size_type
collection_type::iterator iterator
reference operator[](size_type i)
void push_back(const_reference t)
double b
Definition: hdecay.h:120
const_iterator end() const
HLT enums.
collection_type::reference reference
double a
Definition: hdecay.h:121
ProcessHistoryID & phid()
const_reference at(size_type i) const
void swap(ProcessHistory &other)
collection_type data_
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
ProcessHistoryID id() const
void reset()
Definition: Hash.h:147
void reserve(size_type n)
const_reference operator[](size_type i) const