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  public:
22  typedef long long EntryNumber_t;
23 
24  FileIndex();
26 
28 
30 
31  class Element {
32  public:
33  static EntryNumber_t const invalidEntry = -1LL;
34  Element() : run_(0U), lumi_(0U), event_(0U), entry_(invalidEntry) {}
35  Element(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, long long entry)
36  : run_(run), lumi_(lumi), event_(event), entry_(entry) {
37  assert(lumi_ != 0U || event_ == 0U);
38  }
40  : run_(run), lumi_(lumi), event_(event), entry_(invalidEntry) {}
41  EntryType getEntryType() const { return lumi_ == 0U ? kRun : (event_ == 0U ? kLumi : kEvent); }
45  EntryNumber_t entry_;
46  };
47 
48  typedef std::vector<Element>::const_iterator const_iterator;
49 
50  typedef std::vector<Element>::iterator iterator;
51 
52  void sortBy_Run_Lumi_Event();
54 
55  const_iterator findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi = 0U, EventNumber_t event = 0U) const;
56 
57  const_iterator findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const;
58 
59  const_iterator findEventEntryPosition(RunNumber_t run,
61  EventNumber_t event,
62  EntryNumber_t entry) const;
63 
64  const_iterator findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const;
65 
66  const_iterator findRunPosition(RunNumber_t run) const;
67 
68  const_iterator findLumiOrRunPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const;
69 
71  return (event != 0) ? containsEvent(run, lumi, event) : (lumi ? containsLumi(run, lumi) : containsRun(run));
72  }
73 
75  return findEventPosition(run, lumi, event) != entries_.end();
76  }
77 
79  return findLumiPosition(run, lumi) != entries_.end();
80  }
81 
82  bool containsRun(RunNumber_t run) const { return findRunPosition(run) != entries_.end(); }
83 
84  const_iterator begin() const { return entries_.begin(); }
85 
86  const_iterator end() const { return entries_.end(); }
87 
88  iterator begin() { return entries_.begin(); }
89 
90  iterator end() { return entries_.end(); }
91 
92  iterator erase(iterator pos) { return entries_.erase(pos); }
93 
94  iterator erase(iterator begin, iterator end) { return entries_.erase(begin, end); }
95 
96  std::vector<Element>::size_type size() const { return entries_.size(); }
97 
98  bool empty() const { return entries_.empty(); }
99 
100  bool allEventsInEntryOrder() const;
101 
103 
105 
106  struct Transients {
107  Transients();
108  void reset();
112  };
113 
114  private:
115  bool& allInEntryOrder() const { return transient_.allInEntryOrder_; }
116  bool& resultCached() const { return transient_.resultCached_; }
118 
119  std::vector<Element> entries_;
121  };
122 
123  bool operator<(FileIndex::Element const& lh, FileIndex::Element const& rh);
124 
125  inline bool operator>(FileIndex::Element const& lh, FileIndex::Element const& rh) { return rh < lh; }
126 
127  inline bool operator>=(FileIndex::Element const& lh, FileIndex::Element const& rh) { return !(lh < rh); }
128 
129  inline bool operator<=(FileIndex::Element const& lh, FileIndex::Element const& rh) { return !(rh < lh); }
130 
131  inline bool operator==(FileIndex::Element const& lh, FileIndex::Element const& rh) { return !(lh < rh || rh < lh); }
132 
133  inline bool operator!=(FileIndex::Element const& lh, FileIndex::Element const& rh) { return lh < rh || rh < lh; }
134 
136  public:
137  bool operator()(FileIndex::Element const& lh, FileIndex::Element const& rh);
138  };
139 
140  std::ostream& operator<<(std::ostream& os, FileIndex const& fileIndex);
141 } // namespace edm
142 
143 #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:159
bool & allInEntryOrder() const
Definition: FileIndex.h:115
SortState & sortState() const
Definition: FileIndex.h:117
unsigned long long EventNumber_t
bool int lh
Definition: SIMDVec.h:20
uint16_t size_type
unsigned int LuminosityBlockNumber_t
void sortBy_Run_Lumi_EventEntry()
Definition: FileIndex.cc:40
bool operator<=(View< T > const &, View< T > const &)
Definition: View.h:320
iterator begin()
Definition: FileIndex.h:88
bool containsRun(RunNumber_t run) const
Definition: FileIndex.h:82
EntryNumber_t entry_
Definition: FileIndex.h:45
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:48
bool operator>=(View< T > const &, View< T > const &)
Definition: View.h:330
bool allEventsInEntryOrder() const
Definition: FileIndex.cc:46
static EntryNumber_t const invalidEntry
Definition: FileIndex.h:33
bool empty() const
Definition: FileIndex.h:98
long long EntryNumber_t
Definition: FileIndex.h:22
const_iterator findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.cc:91
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
bool containsLumi(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.h:78
const_iterator findRunPosition(RunNumber_t run) const
Definition: FileIndex.cc:135
bool operator>(View< T > const &, View< T > const &)
Definition: View.h:325
const_iterator end() const
Definition: FileIndex.h:86
void initializeTransients() const
Definition: FileIndex.h:104
iterator erase(iterator pos)
Definition: FileIndex.h:92
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
const_iterator findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.cc:120
LuminosityBlockNumber_t lumi_
Definition: FileIndex.h:43
iterator erase(iterator begin, iterator end)
Definition: FileIndex.h:94
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.h:70
bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.h:74
const_iterator findLumiOrRunPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.cc:150
std::vector< Element > entries_
Definition: FileIndex.h:119
void sortBy_Run_Lumi_Event()
Definition: FileIndex.cc:34
Element(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
Definition: FileIndex.h:39
void addEntry(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
Definition: FileIndex.cc:28
EntryType getEntryType() const
Definition: FileIndex.h:41
HLT enums.
Transients transient_
Definition: FileIndex.h:120
const_iterator findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
Definition: FileIndex.cc:66
bool & resultCached() const
Definition: FileIndex.h:116
std::vector< Element >::size_type size() const
Definition: FileIndex.h:96
const_iterator begin() const
Definition: FileIndex.h:84
unsigned int RunNumber_t
iterator end()
Definition: FileIndex.h:90
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:44
Element(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, long long entry)
Definition: FileIndex.h:35
std::vector< Element >::iterator iterator
Definition: FileIndex.h:50
Definition: event.py:1