CMS 3D CMS Logo

FileIndex.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_FileIndex_h
2 #define DataFormats_Provenance_FileIndex_h
3 
4 /*----------------------------------------------------------------------
5 
6 FileIndex.h
7 // Obsolete: For Backward compatibility only.
8 
9 ----------------------------------------------------------------------*/
10 
13 
14 #include <cassert>
15 #include <iosfwd>
16 #include <vector>
17 
18 namespace edm {
19 
20  class FileIndex {
21 
22  public:
23  typedef long long EntryNumber_t;
24 
25  FileIndex();
27 
29 
31 
32  class Element {
33  public:
34  static EntryNumber_t const invalidEntry = -1LL;
35  Element() : run_(0U), lumi_(0U), event_(0U), entry_(invalidEntry) {
36  }
37  Element(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, long long entry) :
38  run_(run), lumi_(lumi),
39  event_(event), entry_(entry) {
40  assert(lumi_ != 0U || event_ == 0U);
41  }
43  run_(run), lumi_(lumi), event_(event), entry_(invalidEntry) {}
45  return lumi_ == 0U ? kRun : (event_ == 0U ? kLumi : kEvent);
46  }
50  EntryNumber_t entry_;
51  };
52 
53  typedef std::vector<Element>::const_iterator const_iterator;
54 
55  typedef std::vector<Element>::iterator iterator;
56 
57  void sortBy_Run_Lumi_Event();
59 
60  const_iterator
61  findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi = 0U, EventNumber_t event = 0U) const;
62 
63  const_iterator
65 
66  const_iterator
67  findEventEntryPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry) const;
68 
69  const_iterator
71 
72  const_iterator
73  findRunPosition(RunNumber_t run) const;
74 
75  const_iterator
77 
78  bool
80  return (event != 0) ? containsEvent(run, lumi, event) : (lumi ? containsLumi(run, lumi) : containsRun(run));
81  }
82 
83  bool
85  return findEventPosition(run, lumi, event) != entries_.end();
86  }
87 
88  bool
90  return findLumiPosition(run, lumi) != entries_.end();
91  }
92 
93  bool
94  containsRun(RunNumber_t run) const {
95  return findRunPosition(run) != entries_.end();
96  }
97 
98  const_iterator begin() const {return entries_.begin();}
99 
100  const_iterator end() const {return entries_.end();}
101 
102  iterator begin() {return entries_.begin();}
103 
104  iterator end() {return entries_.end();}
105 
106  iterator erase(iterator pos) {return entries_.erase(pos);}
107 
108  iterator erase(iterator begin, iterator end) {return entries_.erase(begin, end);}
109 
111 
112  bool empty() const {return entries_.empty();}
113 
114  bool allEventsInEntryOrder() const;
115 
117 
119 
120  struct Transients {
121  Transients();
122  void reset();
126  };
127 
128  private:
129 
131  bool& resultCached() const {return transient_.resultCached_;}
133 
134  std::vector<Element> entries_;
136  };
137 
138  bool operator<(FileIndex::Element const& lh, FileIndex::Element const& rh);
139 
140  inline
141  bool operator>(FileIndex::Element const& lh, FileIndex::Element const& rh) {return rh < lh;}
142 
143  inline
144  bool operator>=(FileIndex::Element const& lh, FileIndex::Element const& rh) {return !(lh < rh);}
145 
146  inline
147  bool operator<=(FileIndex::Element const& lh, FileIndex::Element const& rh) {return !(rh < lh);}
148 
149  inline
150  bool operator==(FileIndex::Element const& lh, FileIndex::Element const& rh) {return !(lh < rh || rh < lh);}
151 
152  inline
153  bool operator!=(FileIndex::Element const& lh, FileIndex::Element const& rh) {return lh < rh || rh < lh;}
154 
156  public:
157  bool operator()(FileIndex::Element const& lh, FileIndex::Element const& rh);
158  };
159 
160  std::ostream&
161  operator<<(std::ostream& os, FileIndex const& fileIndex);
162 }
163 
164 #endif
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:90
const_iterator findEventEntryPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry) const
Definition: FileIndex.cc:162
bool & allInEntryOrder() const
Definition: FileIndex.h:130
SortState & sortState() const
Definition: FileIndex.h:132
unsigned long long EventNumber_t
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
bool int lh
Definition: SIMDVec.h:21
uint16_t size_type
unsigned int LuminosityBlockNumber_t
void sortBy_Run_Lumi_EventEntry()
Definition: FileIndex.cc:41
bool operator<=(View< T > const &, View< T > const &)
Definition: View.h:376
iterator begin()
Definition: FileIndex.h:102
bool containsRun(RunNumber_t run) const
Definition: FileIndex.h:94
EntryNumber_t entry_
Definition: FileIndex.h:50
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:53
bool operator>=(View< T > const &, View< T > const &)
Definition: View.h:388
bool allEventsInEntryOrder() const
Definition: FileIndex.cc:47
static EntryNumber_t const invalidEntry
Definition: FileIndex.h:34
bool empty() const
Definition: FileIndex.h:112
long long EntryNumber_t
Definition: FileIndex.h:23
const_iterator findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.cc:91
bool containsLumi(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.h:89
const_iterator findRunPosition(RunNumber_t run) const
Definition: FileIndex.cc:136
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
bool operator>(View< T > const &, View< T > const &)
Definition: View.h:382
const_iterator end() const
Definition: FileIndex.h:100
void initializeTransients() const
Definition: FileIndex.h:118
iterator erase(iterator pos)
Definition: FileIndex.h:106
const_iterator findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.cc:120
LuminosityBlockNumber_t lumi_
Definition: FileIndex.h:48
iterator erase(iterator begin, iterator end)
Definition: FileIndex.h:108
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.h:79
bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.h:84
const_iterator findLumiOrRunPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.cc:152
std::vector< Element > entries_
Definition: FileIndex.h:134
void sortBy_Run_Lumi_Event()
Definition: FileIndex.cc:35
Element(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
Definition: FileIndex.h:42
void addEntry(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
Definition: FileIndex.cc:29
EntryType getEntryType() const
Definition: FileIndex.h:44
HLT enums.
Transients transient_
Definition: FileIndex.h:135
const_iterator findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
Definition: FileIndex.cc:67
bool & resultCached() const
Definition: FileIndex.h:131
std::vector< Element >::size_type size() const
Definition: FileIndex.h:110
const_iterator begin() const
Definition: FileIndex.h:98
unsigned int RunNumber_t
iterator end()
Definition: FileIndex.h:104
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
void reset(double vett[256])
Definition: TPedValues.cc:11
EventNumber_t event_
Definition: FileIndex.h:49
Element(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, long long entry)
Definition: FileIndex.h:37
std::vector< Element >::iterator iterator
Definition: FileIndex.h:55
Definition: event.py:1