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 
14 
15 #include <cassert>
16 #include <iosfwd>
17 #include <vector>
18 
19 namespace edm {
20 
21  class FileIndex {
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;
38  assert(lumi_ != 0U || event_ == 0U);
39  }
42  EntryType getEntryType() const { return lumi_ == 0U ? kRun : (event_ == 0U ? kLumi : kEvent); }
47  };
48 
49  typedef std::vector<Element>::const_iterator const_iterator;
50 
51  typedef std::vector<Element>::iterator iterator;
52 
53  void sortBy_Run_Lumi_Event();
55 
57 
59 
63  EntryNumber_t entry) const;
64 
66 
68 
70 
72  return (event != 0) ? containsEvent(run, lumi, event) : (lumi ? containsLumi(run, lumi) : containsRun(run));
73  }
74 
76  return findEventPosition(run, lumi, event) != entries_.end();
77  }
78 
80  return findLumiPosition(run, lumi) != entries_.end();
81  }
82 
83  bool containsRun(RunNumber_t run) const { return findRunPosition(run) != entries_.end(); }
84 
85  const_iterator begin() const { return entries_.begin(); }
86 
87  const_iterator end() const { return entries_.end(); }
88 
89  iterator begin() { return entries_.begin(); }
90 
91  iterator end() { return entries_.end(); }
92 
93  iterator erase(iterator pos) { return entries_.erase(pos); }
94 
96 
97  std::vector<Element>::size_type size() const { return entries_.size(); }
98 
99  bool empty() const { return entries_.empty(); }
100 
101  bool allEventsInEntryOrder() const;
102 
104 
106 
107  struct Transients {
108  Transients();
109  void reset();
113  };
114 
115  private:
116  bool& allInEntryOrder() const { return transient_.allInEntryOrder_; }
117  bool& resultCached() const { return transient_.resultCached_; }
119 
120  std::vector<Element> entries_;
121  //Only used within source's serial code
123  };
124 
125  bool operator<(FileIndex::Element const& lh, FileIndex::Element const& rh);
126 
127  inline bool operator>(FileIndex::Element const& lh, FileIndex::Element const& rh) { return rh < lh; }
128 
129  inline bool operator>=(FileIndex::Element const& lh, FileIndex::Element const& rh) { return !(lh < rh); }
130 
131  inline bool operator<=(FileIndex::Element const& lh, FileIndex::Element const& rh) { return !(rh < lh); }
132 
133  inline bool operator==(FileIndex::Element const& lh, FileIndex::Element const& rh) { return !(lh < rh || rh < lh); }
134 
135  inline bool operator!=(FileIndex::Element const& lh, FileIndex::Element const& rh) { return lh < rh || rh < lh; }
136 
138  public:
139  bool operator()(FileIndex::Element const& lh, FileIndex::Element const& rh);
140  };
141 
142  std::ostream& operator<<(std::ostream& os, FileIndex const& fileIndex);
143 } // namespace edm
144 
145 #endif
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:89
const_iterator findLumiOrRunPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.cc:150
constexpr bool operator==(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
void initializeTransients() const
Definition: FileIndex.h:105
const_iterator findRunPosition(RunNumber_t run) const
Definition: FileIndex.cc:135
#define CMS_SA_ALLOW
const_iterator end() const
Definition: FileIndex.h:87
bool operator()(FileIndex::Element const &lh, FileIndex::Element const &rh)
Definition: FileIndex.cc:195
bool empty() const
Definition: FileIndex.h:99
bool & resultCached() const
Definition: FileIndex.h:117
constexpr bool operator<=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
unsigned long long EventNumber_t
bool allEventsInEntryOrder() const
Definition: FileIndex.cc:46
bool int lh
Definition: SIMDVec.h:27
const_iterator findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.cc:91
assert(be >=bs)
uint16_t size_type
unsigned int LuminosityBlockNumber_t
void sortBy_Run_Lumi_EventEntry()
Definition: FileIndex.cc:40
iterator begin()
Definition: FileIndex.h:89
constexpr bool operator>=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
EntryNumber_t entry_
Definition: FileIndex.h:46
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:49
const_iterator findEventEntryPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry) const
Definition: FileIndex.cc:159
static EntryNumber_t const invalidEntry
Definition: FileIndex.h:34
long long EntryNumber_t
Definition: FileIndex.h:23
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.h:71
EntryType getEntryType() const
Definition: FileIndex.h:42
bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.h:75
constexpr bool operator!=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
iterator erase(iterator pos)
Definition: FileIndex.h:93
LuminosityBlockNumber_t lumi_
Definition: FileIndex.h:44
iterator erase(iterator begin, iterator end)
Definition: FileIndex.h:95
constexpr bool operator>(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
const_iterator begin() const
Definition: FileIndex.h:85
std::vector< Element >::size_type size() const
Definition: FileIndex.h:97
std::vector< Element > entries_
Definition: FileIndex.h:120
void sortBy_Run_Lumi_Event()
Definition: FileIndex.cc:34
Element(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
Definition: FileIndex.h:40
void addEntry(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
Definition: FileIndex.cc:28
const_iterator findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.cc:120
HLT enums.
Transients transient_
Definition: FileIndex.h:122
unsigned int RunNumber_t
bool & allInEntryOrder() const
Definition: FileIndex.h:116
const_iterator findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
Definition: FileIndex.cc:66
iterator end()
Definition: FileIndex.h:91
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger table.
bool containsRun(RunNumber_t run) const
Definition: FileIndex.h:83
bool containsLumi(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.h:79
EventNumber_t event_
Definition: FileIndex.h:45
SortState & sortState() const
Definition: FileIndex.h:118
Element(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, long long entry)
Definition: FileIndex.h:36
std::vector< Element >::iterator iterator
Definition: FileIndex.h:51
Definition: event.py:1