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
edm::FileIndex::Element::Element
Element()
Definition: FileIndex.h:35
edm::FileIndex::sortState
SortState & sortState() const
Definition: FileIndex.h:118
edm::FileIndex
Definition: FileIndex.h:21
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
edm::FileIndex::iterator
std::vector< Element >::iterator iterator
Definition: FileIndex.h:51
edm::FileIndex::findLumiPosition
const_iterator findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.cc:120
edm::operator<=
constexpr bool operator<=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
Definition: ELseverityLevel.h:111
edm::FileIndex::Element::event_
EventNumber_t event_
Definition: FileIndex.h:45
edm::FileIndex::begin
iterator begin()
Definition: FileIndex.h:89
edm::FileIndex::Element::Element
Element(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, long long entry)
Definition: FileIndex.h:36
edm::FileIndex::kRun
Definition: FileIndex.h:30
edm::FileIndex::findEventPosition
const_iterator findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.cc:91
edm::FileIndex::resultCached
bool & resultCached() const
Definition: FileIndex.h:117
edm
HLT enums.
Definition: AlignableModifier.h:19
mps_splice.entry
entry
Definition: mps_splice.py:68
pos
Definition: PixelAliasList.h:18
edm::FileIndex::entries_
std::vector< Element > entries_
Definition: FileIndex.h:120
edm::FileIndex::kNotSorted
Definition: FileIndex.h:103
cms::cuda::assert
assert(be >=bs)
edm::FileIndex::kEnd
Definition: FileIndex.h:30
mathSSE::lh
bool int lh
Definition: SIMDVec.h:20
edm::FileIndex::findLumiOrRunPosition
const_iterator findLumiOrRunPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.cc:150
edm::Compare_Run_Lumi_EventEntry
Definition: FileIndex.h:137
edm::FileIndex::kSorted_Run_Lumi_EventEntry
Definition: FileIndex.h:103
edm::FileIndex::Element::Element
Element(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
Definition: FileIndex.h:40
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
CMS_SA_ALLOW
#define CMS_SA_ALLOW
Definition: thread_safety_macros.h:5
edm::FileIndex::begin
const_iterator begin() const
Definition: FileIndex.h:85
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
edm::FileIndex::SortState
SortState
Definition: FileIndex.h:103
edm::operator!=
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
Definition: debugging_allocator.h:75
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::FileIndex::Transients::reset
void reset()
Definition: FileIndex.cc:22
edm::operator>=
constexpr bool operator>=(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
Definition: ELseverityLevel.h:117
edm::FileIndex::FileIndex
FileIndex()
Definition: FileIndex.cc:10
edm::FileIndex::containsLumi
bool containsLumi(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: FileIndex.h:79
edm::operator==
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
Definition: debugging_allocator.h:72
edm::FileIndex::Transients::Transients
Transients()
Definition: FileIndex.cc:19
EventID.h
edm::Compare_Run_Lumi_EventEntry::operator()
bool operator()(FileIndex::Element const &lh, FileIndex::Element const &rh)
Definition: FileIndex.cc:195
edm::operator<
bool operator<(DetSet< T > const &x, DetSet< T > const &y)
Definition: DetSet.h:89
edm::FileIndex::EntryNumber_t
long long EntryNumber_t
Definition: FileIndex.h:23
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
edm::FileIndex::containsItem
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.h:71
edm::FileIndex::EntryType
EntryType
Definition: FileIndex.h:30
edm::FileIndex::Element::entry_
EntryNumber_t entry_
Definition: FileIndex.h:46
edm::FileIndex::end
const_iterator end() const
Definition: FileIndex.h:87
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::FileIndex::const_iterator
std::vector< Element >::const_iterator const_iterator
Definition: FileIndex.h:49
edm::FileIndex::empty
bool empty() const
Definition: FileIndex.h:99
edm::FileIndex::addEntry
void addEntry(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry)
Definition: FileIndex.cc:28
edm::FileIndex::initializeTransients
void initializeTransients() const
Definition: FileIndex.h:105
edm::FileIndex::kLumi
Definition: FileIndex.h:30
edm::FileIndex::sortBy_Run_Lumi_EventEntry
void sortBy_Run_Lumi_EventEntry()
Definition: FileIndex.cc:40
thread_safety_macros.h
edm::FileIndex::containsEvent
bool containsEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: FileIndex.h:75
edm::FileIndex::allInEntryOrder
bool & allInEntryOrder() const
Definition: FileIndex.h:116
edm::FileIndex::findPosition
const_iterator findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
Definition: FileIndex.cc:66
edm::FileIndex::Transients::sortState_
SortState sortState_
Definition: FileIndex.h:112
edm::FileIndex::Element::invalidEntry
static const EntryNumber_t invalidEntry
Definition: FileIndex.h:34
edm::FileIndex::containsRun
bool containsRun(RunNumber_t run) const
Definition: FileIndex.h:83
edm::FileIndex::allEventsInEntryOrder
bool allEventsInEntryOrder() const
Definition: FileIndex.cc:46
edm::FileIndex::end
iterator end()
Definition: FileIndex.h:91
L1DTConfigBti_cff.LL
LL
Definition: L1DTConfigBti_cff.py:25
edm::FileIndex::Element::lumi_
LuminosityBlockNumber_t lumi_
Definition: FileIndex.h:44
edm::FileIndex::Element::run_
RunNumber_t run_
Definition: FileIndex.h:43
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::FileIndex::kSorted_Run_Lumi_Event
Definition: FileIndex.h:103
edm::FileIndex::sortBy_Run_Lumi_Event
void sortBy_Run_Lumi_Event()
Definition: FileIndex.cc:34
edm::FileIndex::findRunPosition
const_iterator findRunPosition(RunNumber_t run) const
Definition: FileIndex.cc:135
edm::FileIndex::kEvent
Definition: FileIndex.h:30
edm::FileIndex::Element::getEntryType
EntryType getEntryType() const
Definition: FileIndex.h:42
edm::FileIndex::erase
iterator erase(iterator begin, iterator end)
Definition: FileIndex.h:95
edm::FileIndex::findEventEntryPosition
const_iterator findEventEntryPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, EntryNumber_t entry) const
Definition: FileIndex.cc:159
edm::FileIndex::Transients
Definition: FileIndex.h:107
edm::FileIndex::~FileIndex
~FileIndex()
Definition: FileIndex.h:26
edm::FileIndex::erase
iterator erase(iterator pos)
Definition: FileIndex.h:93
edm::FileIndex::size
std::vector< Element >::size_type size() const
Definition: FileIndex.h:97
edm::operator>
constexpr bool operator>(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
Definition: ELseverityLevel.h:114
edm::FileIndex::transient_
Transients transient_
Definition: FileIndex.h:122
event
Definition: event.py:1
edm::FileIndex::Transients::allInEntryOrder_
bool allInEntryOrder_
Definition: FileIndex.h:110
edm::FileIndex::Transients::resultCached_
bool resultCached_
Definition: FileIndex.h:111
lumi
Definition: LumiSectionData.h:20
RunID.h
edm::FileIndex::Element
Definition: FileIndex.h:32