CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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) {
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  }
47  void swap(ProcessHistory& other) {
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
const_reverse_iterator rbegin() const
collection_type::const_iterator const_iterator
constexpr bool operator==(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
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:181
ProcessHistoryID setProcessHistoryID()
collection_type::reverse_iterator reverse_iterator
ProcessHistory(collection_type const &vec)
uint16_t size_type
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:117
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)
const_reverse_iterator rend() const
reference at(size_type i)
constexpr bool operator!=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
std::vector< value_type > collection_type
tuple ProcessHistory
bool empty() const
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:118
const_iterator end() const
tuple config
parse the configuration file
collection_type::reference reference
double a
Definition: hdecay.h:119
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:136
void reserve(size_type n)
const_reference operator[](size_type i) const