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 
31  explicit ProcessHistory(collection_type const& vec) : data_(vec), transient_() {}
32 
33  template <typename... Args>
34  void emplace_back(Args&&... args) {
35  data_.emplace_back(std::forward<Args>(args)...);
36  phid() = ProcessHistoryID();
37  }
38 
40  data_.insert(data_.begin(), t);
41  phid() = ProcessHistoryID();
42  }
44  data_.push_back(t);
45  phid() = ProcessHistoryID();
46  }
48  data_.swap(other.data_);
49  phid().swap(other.phid());
50  }
51  bool empty() const { return data_.empty(); }
52  size_type size() const { return data_.size(); }
53  size_type capacity() const { return data_.capacity(); }
54  void reserve(size_type n) { data_.reserve(n); }
55 
58 
59  reference at(size_type i) { return data_.at(i); }
60  const_reference at(size_type i) const { return data_.at(i); }
61 
62  const_iterator begin() const { return data_.begin(); }
63  const_iterator end() const { return data_.end(); }
64 
65  const_reverse_iterator rbegin() const { return data_.rbegin(); }
66  const_reverse_iterator rend() const { return data_.rend(); }
67 
68  // iterator begin() {return data_.begin();}
69  // iterator end() {return data_.end();}
70 
71  // reverse_iterator rbegin() {return data_.rbegin();}
72  // reverse_iterator rend() {return data_.rend();}
73 
74  collection_type const& data() const { return data_; }
75  ProcessHistoryID id() const;
77 
78  // Return true, and fill in config appropriately, if the a process
79  // with the given name is recorded in this ProcessHistory. Return
80  // false, and do not modify config, if process with the given name
81  // is not found.
83 
84  void clear() {
85  data_.clear();
86  phid() = ProcessHistoryID();
87  }
88 
90 
92 
93  struct Transients {
94  Transients() : phid_() {}
95  void reset() { phid_.reset(); }
97  };
98 
99  private:
103  };
104 
105  // Free swap function
106  inline void swap(ProcessHistory& a, ProcessHistory& b) { a.swap(b); }
107 
108  inline bool operator==(ProcessHistory const& a, ProcessHistory const& b) { return a.data() == b.data(); }
109 
110  inline bool operator!=(ProcessHistory const& a, ProcessHistory const& b) { return !(a == b); }
111 
112  bool isAncestor(ProcessHistory const& a, ProcessHistory const& b);
113 
114  inline bool isDescendant(ProcessHistory const& a, ProcessHistory const& b) { return isAncestor(b, a); }
115 
116  std::ostream& operator<<(std::ostream& ost, ProcessHistory const& ph);
117 } // namespace edm
118 
119 #endif
collection_type::const_iterator const_iterator
constexpr bool operator==(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
ProcessHistory & reduce()
size_type size() const
ProcessHistoryID id() const
bool empty() const
collection_type::const_reverse_iterator const_reverse_iterator
const_reference at(size_type i) const
collection_type::const_reference const_reference
bool isDescendant(ProcessHistory const &a, ProcessHistory const &b)
void swap(Hash< I > &other)
Definition: Hash.h:181
ProcessHistoryID setProcessHistoryID()
Definition: config.py:1
collection_type::reverse_iterator reverse_iterator
ProcessHistory(collection_type const &vec)
uint16_t size_type
const_iterator end() const
const_reverse_iterator rend() const
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
bool getConfigurationForProcess(std::string const &name, ProcessConfiguration &config) const
ProcessHistory(size_type n)
bool isAncestor(ProcessHistory const &a, ProcessHistory const &b)
reference at(size_type i)
constexpr bool operator!=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
std::vector< value_type > collection_type
collection_type const & data() const
ProcessConfiguration value_type
Hash< ProcessHistoryType > ProcessHistoryID
void push_front(const_reference t)
collection_type::size_type size_type
const_reference operator[](size_type i) const
collection_type::iterator iterator
reference operator[](size_type i)
void push_back(const_reference t)
const_reverse_iterator rbegin() const
double b
Definition: hdecay.h:118
HLT enums.
collection_type::reference reference
double a
Definition: hdecay.h:119
void emplace_back(Args &&... args)
ProcessHistoryID & phid()
void swap(ProcessHistory &other)
collection_type data_
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger table.
size_type capacity() const
void reset()
Definition: Hash.h:136
void reserve(size_type n)
const_iterator begin() const