CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 #ifndef __GCCXML__
34  template<typename... Args>
35  void emplace_back(Args&&... args) {data_.emplace_back(std::forward<Args>(args)...); phid() = ProcessHistoryID();}
36 #endif
37 
38  void push_front(const_reference t) {data_.insert(data_.begin(), t); phid() = ProcessHistoryID();}
39  void push_back(const_reference t) {data_.push_back(t); phid() = ProcessHistoryID();}
40  void swap(ProcessHistory& other) {data_.swap(other.data_); phid().swap(other.phid());}
41  bool empty() const {return data_.empty();}
42  size_type size() const {return data_.size();}
43  size_type capacity() const {return data_.capacity();}
44  void reserve(size_type n) {data_.reserve(n);}
45 
48 
49  reference at(size_type i) {return data_.at(i);}
50  const_reference at(size_type i) const {return data_.at(i);}
51 
52  const_iterator begin() const {return data_.begin();}
53  const_iterator end() const {return data_.end();}
54 
55  const_reverse_iterator rbegin() const {return data_.rbegin();}
56  const_reverse_iterator rend() const {return data_.rend();}
57 
58 // iterator begin() {return data_.begin();}
59 // iterator end() {return data_.end();}
60 
61 // reverse_iterator rbegin() {return data_.rbegin();}
62 // reverse_iterator rend() {return data_.rend();}
63 
64  collection_type const& data() const {return data_;}
65  ProcessHistoryID id() const;
67 
68  // Return true, and fill in config appropriately, if the a process
69  // with the given name is recorded in this ProcessHistory. Return
70  // false, and do not modify config, if process with the given name
71  // is not found.
73 
74  void clear() {
75  data_.clear();
76  phid() = ProcessHistoryID();
77  }
78 
80 
82 
83  struct Transients {
84  Transients() : phid_() {}
85  void reset() {phid_.reset();}
87  };
88 
89  private:
93  };
94 
95  // Free swap function
96  inline
97  void
99  a.swap(b);
100  }
101 
102  inline
103  bool
105  return a.data() == b.data();
106  }
107 
108  inline
109  bool
111  return !(a==b);
112  }
113 
114  bool
115  isAncestor(ProcessHistory const& a, ProcessHistory const& b);
116 
117  inline
118  bool
120  return isAncestor(b, a);
121  }
122 
123  std::ostream& operator<<(std::ostream& ost, ProcessHistory const& ph);
124 }
125 
126 #endif
const_reverse_iterator rbegin() const
collection_type::const_iterator const_iterator
const_iterator begin() const
ProcessHistory & reduce()
int i
Definition: DBlmapReader.cc:9
size_type size() const
collection_type::const_reverse_iterator const_reverse_iterator
collection_type::const_reference const_reference
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
bool isDescendant(ProcessHistory const &a, ProcessHistory const &b)
collection_type const & data() const
void swap(Hash< I > &other)
Definition: Hash.h:206
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:116
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
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
reference at(size_type i)
std::vector< value_type > collection_type
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:120
const_iterator end() const
dictionary args
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:143
void reserve(size_type n)
const_reference operator[](size_type i) const