LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::ClosedRangeSetHandler Class Reference

#include "ClosedRangeSetHandler.h"

Inheritance diagram for art::ClosedRangeSetHandler:
art::RangeSetHandler

Classes

struct  EventInfo
 

Public Member Functions

 ClosedRangeSetHandler (RangeSet const &inputRangeSet)
 
 ClosedRangeSetHandler (ClosedRangeSetHandler const &)=delete
 
ClosedRangeSetHandleroperator= (ClosedRangeSetHandler const &)=delete
 
 ClosedRangeSetHandler (ClosedRangeSetHandler &&)=default
 
ClosedRangeSetHandleroperator= (ClosedRangeSetHandler &&)=default
 
RangeSet seenRanges () const
 
void update (EventID const &id, bool const lastInSubRun)
 
void flushRanges ()
 
void maybeSplitRange ()
 
void rebase ()
 

Private Member Functions

auto begin () const
 
auto end () const
 
RangeSet::const_iterator next_subrun_or_end () const
 
RangeSet do_getSeenRanges () const override
 
void do_update (EventID const &, bool lastInSubRun) override
 
void do_flushRanges () override
 
void do_maybeSplitRange () override
 
void do_rebase () override
 

Private Attributes

RangeSet ranges_ {RangeSet::invalid()}
 
RangeSet::const_iterator rsIter_ {ranges_.begin()}
 
EventInfo eventInfo_ {}
 

Detailed Description

Definition at line 47 of file ClosedRangeSetHandler.h.

Constructor & Destructor Documentation

art::ClosedRangeSetHandler::ClosedRangeSetHandler ( RangeSet const &  inputRangeSet)
explicit

Definition at line 17 of file ClosedRangeSetHandler.cc.

17  : ranges_{rs}
18  {}
art::ClosedRangeSetHandler::ClosedRangeSetHandler ( ClosedRangeSetHandler const &  )
delete
art::ClosedRangeSetHandler::ClosedRangeSetHandler ( ClosedRangeSetHandler &&  )
default

Member Function Documentation

auto art::ClosedRangeSetHandler::begin ( ) const
inlineprivate

Definition at line 61 of file ClosedRangeSetHandler.h.

References art::RangeSet::begin(), and ranges_.

Referenced by do_getSeenRanges().

62  {
63  return ranges_.begin();
64  }
auto begin() const
Definition: RangeSet.h:70
void art::ClosedRangeSetHandler::do_flushRanges ( )
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 44 of file ClosedRangeSetHandler.cc.

References end(), and rsIter_.

Referenced by end().

45  {
46  rsIter_ = end();
47  }
RangeSet::const_iterator rsIter_
RangeSet art::ClosedRangeSetHandler::do_getSeenRanges ( ) const
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 21 of file ClosedRangeSetHandler.cc.

References begin(), ranges_, rsIter_, art::RangeSet::run(), and tmp.

Referenced by end().

22  {
23  RangeSet tmp{ranges_.run()};
24  tmp.assign_ranges(begin(), rsIter_);
25  return tmp;
26  }
RangeSet::const_iterator rsIter_
Float_t tmp
Definition: plot.C:37
RunNumber_t run() const
Definition: RangeSet.h:36
void art::ClosedRangeSetHandler::do_maybeSplitRange ( )
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 50 of file ClosedRangeSetHandler.cc.

References end(), art::EventID::event(), eventInfo_, art::ClosedRangeSetHandler::EventInfo::id, art::ClosedRangeSetHandler::EventInfo::lastInSubRun, art::EventID::next(), ranges_, rsIter_, art::RangeSet::split_range(), and art::EventID::subRun().

Referenced by end().

51  {
52  if (!eventInfo_.lastInSubRun && rsIter_ != end()) {
53  auto split_range = ranges_.split_range(eventInfo_.id.subRun(),
54  eventInfo_.id.next().event());
55  if (split_range.second)
56  rsIter_ = split_range.first;
57  }
58  }
EventID next() const
Definition: EventID.h:135
RangeSet::const_iterator rsIter_
EventNumber_t event() const
Definition: EventID.h:117
SubRunNumber_t subRun() const
Definition: EventID.h:111
std::pair< const_iterator, bool > split_range(SubRunNumber_t, EventNumber_t)
Definition: RangeSet.cc:156
void art::ClosedRangeSetHandler::do_rebase ( )
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 61 of file ClosedRangeSetHandler.cc.

References end(), ranges_, rsIter_, art::RangeSet::run(), and tmp.

Referenced by end().

62  {
63  std::vector<EventRange> rebasedRanges(rsIter_, end());
64  RangeSet tmpRS{ranges_.run(), rebasedRanges};
66  std::swap(*this, tmp);
67  }
RangeSet::const_iterator rsIter_
Float_t tmp
Definition: plot.C:37
ClosedRangeSetHandler(RangeSet const &inputRangeSet)
RunNumber_t run() const
Definition: RangeSet.h:36
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
void art::ClosedRangeSetHandler::do_update ( EventID const &  id,
bool  lastInSubRun 
)
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 29 of file ClosedRangeSetHandler.cc.

References end(), eventInfo_, next_subrun_or_end(), rsIter_, and art::ClosedRangeSetHandler::EventInfo::set().

Referenced by end().

30  {
31  eventInfo_.set(id, lastInSubRun);
32 
33  if (lastInSubRun) {
35  return;
36  }
37 
38  while (rsIter_ != end() && !rsIter_->contains(id.subRun(), id.event())) {
39  ++rsIter_;
40  }
41  }
void set(EventID const &eid, bool const last)
RangeSet::const_iterator rsIter_
RangeSet::const_iterator next_subrun_or_end() const
auto art::ClosedRangeSetHandler::end ( void  ) const
inlineprivate
void art::RangeSetHandler::flushRanges ( )
inlineinherited

Definition at line 29 of file RangeSetHandler.h.

References art::RangeSetHandler::do_flushRanges().

30  {
32  }
virtual void do_flushRanges()=0
void art::RangeSetHandler::maybeSplitRange ( )
inlineinherited

Definition at line 34 of file RangeSetHandler.h.

References art::RangeSetHandler::do_maybeSplitRange().

35  {
37  }
virtual void do_maybeSplitRange()=0
RangeSet::const_iterator art::ClosedRangeSetHandler::next_subrun_or_end ( ) const
private

Definition at line 70 of file ClosedRangeSetHandler.cc.

References end(), and rsIter_.

Referenced by do_update(), and end().

71  {
72  if (rsIter_ == end())
73  return end();
74 
75  auto const sr = rsIter_->subRun();
76  auto pos = std::find_if(
77  rsIter_, end(), [sr](auto const& range) { return range.subRun() != sr; });
78  return pos;
79  }
RangeSet::const_iterator rsIter_
ClosedRangeSetHandler& art::ClosedRangeSetHandler::operator= ( ClosedRangeSetHandler const &  )
delete
ClosedRangeSetHandler& art::ClosedRangeSetHandler::operator= ( ClosedRangeSetHandler &&  )
default
RangeSet art::RangeSetHandler::seenRanges ( ) const
inlineinherited

Definition at line 17 of file RangeSetHandler.h.

References art::RangeSetHandler::do_getSeenRanges().

18  {
19  return do_getSeenRanges();
20  }
virtual RangeSet do_getSeenRanges() const =0
void art::RangeSetHandler::update ( EventID const &  id,
bool const  lastInSubRun 
)
inlineinherited

Definition at line 23 of file RangeSetHandler.h.

References art::RangeSetHandler::do_update().

24  {
25  do_update(id, lastInSubRun);
26  }
virtual void do_update(EventID const &, bool lastInSubRun)=0

Member Data Documentation

EventInfo art::ClosedRangeSetHandler::eventInfo_ {}
private

Definition at line 93 of file ClosedRangeSetHandler.h.

Referenced by do_maybeSplitRange(), and do_update().

RangeSet art::ClosedRangeSetHandler::ranges_ {RangeSet::invalid()}
private

Definition at line 91 of file ClosedRangeSetHandler.h.

Referenced by begin(), do_getSeenRanges(), do_maybeSplitRange(), do_rebase(), and end().

RangeSet::const_iterator art::ClosedRangeSetHandler::rsIter_ {ranges_.begin()}
private

The documentation for this class was generated from the following files: