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;
66 
67  // Return true, and fill in config appropriately, if the a process
68  // with the given name is recorded in this ProcessHistory. Return
69  // false, and do not modify config, if process with the given name
70  // is not found.
72 
73  void clear() {
74  data_.clear();
75  phid() = ProcessHistoryID();
76  }
77 
78  void reduce();
79 
81 
82  struct Transients {
83  Transients() : phid_() {}
84  void reset() {phid_.reset();}
86  };
87 
88  private:
92  };
93 
94  // Free swap function
95  inline
96  void
98  a.swap(b);
99  }
100 
101  inline
102  bool
104  return a.data() == b.data();
105  }
106 
107  inline
108  bool
110  return !(a==b);
111  }
112 
113  bool
114  isAncestor(ProcessHistory const& a, ProcessHistory const& b);
115 
116  inline
117  bool
119  return isAncestor(b, a);
120  }
121 
122  std::ostream& operator<<(std::ostream& ost, ProcessHistory const& ph);
123 }
124 
125 #endif
const_reverse_iterator rbegin() const
collection_type::const_iterator const_iterator
const_iterator begin() const
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:202
ProcessHistoryID & phid() const
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
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
void initializeTransients() 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
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:139
void reserve(size_type n)
const_reference operator[](size_type i) const