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 
4 #include <iosfwd>
5 #include <string>
6 #include <vector>
7 
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 
24  typedef collection_type::reference reference;
25  typedef collection_type::const_reference const_reference;
26 
28 
31  explicit ProcessHistory(collection_type const& vec) : data_(vec), transients_() {}
32 
33  void push_back(const_reference t) {data_.push_back(t); phid() = ProcessHistoryID();}
34  void swap(ProcessHistory& other) {data_.swap(other.data_); phid().swap(other.phid());}
35  bool empty() const {return data_.empty();}
36  size_type size() const {return data_.size();}
37  size_type capacity() const {return data_.capacity();}
38  void reserve(size_type n) {data_.reserve(n);}
39 
42 
43  reference at(size_type i) {return data_.at(i);}
44  const_reference at(size_type i) const {return data_.at(i);}
45 
46  const_iterator begin() const {return data_.begin();}
47  const_iterator end() const {return data_.end();}
48 
49  const_reverse_iterator rbegin() const {return data_.rbegin();}
50  const_reverse_iterator rend() const {return data_.rend();}
51 
52 // iterator begin() {return data_.begin();}
53 // iterator end() {return data_.end();}
54 
55 // reverse_iterator rbegin() {return data_.rbegin();}
56 // reverse_iterator rend() {return data_.rend();}
57 
58  collection_type const& data() const {return data_;}
59  ProcessHistoryID id() const;
60 
61 
62  // Return true, and fill in config appropriately, if the a process
63  // with the given name is recorded in this ProcessHistory. Return
64  // false, and do not modify config, if process with the given name
65  // is not found.
66  bool getConfigurationForProcess(std::string const& name, ProcessConfiguration& config) const;
67 
68  struct Transients {
69  Transients() : phid_() {}
71  };
72 
73  private:
74  ProcessHistoryID & phid() const {return transients_.get().phid_;}
77  };
78 
79  // Free swap function
80  inline
81  void
83  a.swap(b);
84  }
85 
86  inline
87  bool
89  return a.data() == b.data();
90  }
91 
92  inline
93  bool
95  return !(a==b);
96  }
97 
98  bool
99  isAncestor(ProcessHistory const& a, ProcessHistory const& b);
100 
101  inline
102  bool
104  return isAncestor(b, a);
105  }
106 
107  std::ostream& operator<<(std::ostream& ost, ProcessHistory const& ph);
108 }
109 
110 #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:185
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
ProcessHistory(size_type n)
Transient< Transients > transients_
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
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
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 reserve(size_type n)
const_reference operator[](size_type i) const