Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
art::ClosedRangeSetHandler Class Referencefinal

#include <ClosedRangeSetHandler.h>

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

Classes

class  EventInfo
 

Public Member Functions

virtual ~ClosedRangeSetHandler ()
 
 ClosedRangeSetHandler (RangeSet const &inputRangeSet)
 
 ClosedRangeSetHandler (ClosedRangeSetHandler const &)
 
 ClosedRangeSetHandler (ClosedRangeSetHandler &&)
 
ClosedRangeSetHandleroperator= (ClosedRangeSetHandler const &)
 
ClosedRangeSetHandleroperator= (ClosedRangeSetHandler &&)
 
EventInfo const & eventInfo () const
 
- Public Member Functions inherited from art::RangeSetHandler
virtual ~RangeSetHandler () noexcept
 
HandlerType type () const
 
RangeSet seenRanges () const
 
void update (EventID const &id, bool const lastInSubRun)
 
void flushRanges ()
 
void maybeSplitRange ()
 
void rebase ()
 
RangeSetHandlerclone () const
 

Private Member Functions

std::size_t begin_idx () const
 
std::size_t end_idx () const
 
HandlerType do_type () const override
 
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
 
RangeSetHandlerdo_clone () const override
 

Private Attributes

RangeSet ranges_ {RangeSet::invalid()}
 
std::size_t idx_ {0}
 
EventInfo eventInfo_ {}
 

Additional Inherited Members

- Public Types inherited from art::RangeSetHandler
enum  HandlerType { HandlerType::Open = 1, HandlerType::Closed = 2 }
 

Detailed Description

Definition at line 44 of file ClosedRangeSetHandler.h.

Constructor & Destructor Documentation

art::ClosedRangeSetHandler::~ClosedRangeSetHandler ( )
virtualdefault
art::ClosedRangeSetHandler::ClosedRangeSetHandler ( RangeSet const &  inputRangeSet)
explicit
art::ClosedRangeSetHandler::ClosedRangeSetHandler ( ClosedRangeSetHandler const &  )
default
art::ClosedRangeSetHandler::ClosedRangeSetHandler ( ClosedRangeSetHandler &&  )
default

Member Function Documentation

size_t art::ClosedRangeSetHandler::begin_idx ( ) const
private

Definition at line 90 of file ClosedRangeSetHandler.cc.

91  {
92  return ranges_.begin_idx();
93  }
std::size_t begin_idx() const
Definition: RangeSet.cc:189
RangeSetHandler * art::ClosedRangeSetHandler::do_clone ( ) const
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 173 of file ClosedRangeSetHandler.cc.

174  {
175  return new ClosedRangeSetHandler{*this};
176  }
ClosedRangeSetHandler(RangeSet const &inputRangeSet)
void art::ClosedRangeSetHandler::do_flushRanges ( )
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 130 of file ClosedRangeSetHandler.cc.

131  {
132  idx_ = end_idx();
133  }
RangeSet art::ClosedRangeSetHandler::do_getSeenRanges ( ) const
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 108 of file ClosedRangeSetHandler.cc.

109  {
110  RangeSet tmp{ranges_.run()};
111  tmp.assign_ranges(ranges_, begin_idx(), idx_);
112  return tmp;
113  }
RunNumber_t run() const
Definition: RangeSet.cc:89
string tmp
Definition: languages.py:63
void art::ClosedRangeSetHandler::do_maybeSplitRange ( )
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 136 of file ClosedRangeSetHandler.cc.

137  {
138  if (eventInfo_.lastInSubRun()) {
139  // No need to split.
140  return;
141  }
142  if (!eventInfo_.id().isValid()) {
143  // Have not read any events yet.
144  return;
145  }
146  if (eventInfo_.id().isFlush()) {
147  // Should not happen, be careful anyway.
148  return;
149  }
150  if (idx_ == end_idx()) {
151  // No need to split.
152  return;
153  }
154  auto split_range = ranges_.split_range(eventInfo_.id().subRun(),
155  eventInfo_.id().next().event());
156  if (split_range.second) {
157  // The split did happen, update our idx to the right-hand
158  // side of the split (our ranges has already been updated).
159  idx_ = split_range.first;
160  }
161  }
bool isValid() const
Definition: EventID.h:122
EventID next() const
Definition: EventID.h:134
std::pair< std::size_t, bool > split_range(SubRunNumber_t, EventNumber_t)
Definition: RangeSet.cc:345
bool isFlush() const
Definition: EventID.h:128
EventNumber_t event() const
Definition: EventID.h:116
SubRunNumber_t subRun() const
Definition: EventID.h:110
void art::ClosedRangeSetHandler::do_rebase ( )
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 164 of file ClosedRangeSetHandler.cc.

165  {
166  auto rebasedRanges = ranges_.extract_ranges(idx_, end_idx());
167  RangeSet tmpRS{ranges_.run(), rebasedRanges};
168  ClosedRangeSetHandler tmp{tmpRS};
169  std::swap(*this, tmp);
170  }
ClosedRangeSetHandler(RangeSet const &inputRangeSet)
RunNumber_t run() const
Definition: RangeSet.cc:89
void swap(Handle< T > &a, Handle< T > &b)
std::vector< EventRange > extract_ranges(std::size_t const b, std::size_t const e)
Definition: RangeSet.cc:252
string tmp
Definition: languages.py:63
RangeSetHandler::HandlerType art::ClosedRangeSetHandler::do_type ( ) const
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 102 of file ClosedRangeSetHandler.cc.

void art::ClosedRangeSetHandler::do_update ( EventID const &  id,
bool  lastInSubRun 
)
overrideprivatevirtual

Implements art::RangeSetHandler.

Definition at line 116 of file ClosedRangeSetHandler.cc.

117  {
118  eventInfo_.set(id, lastInSubRun);
119  if (lastInSubRun) {
121  return;
122  }
123  while (idx_ != end_idx() &&
124  !ranges_.at(idx_).contains(id.subRun(), id.event())) {
125  ++idx_;
126  }
127  }
bool contains(SubRunNumber_t s, EventNumber_t e) const noexcept
Definition: EventRange.cc:136
void set(EventID const &eid, bool const last)
std::size_t next_subrun_or_end(std::size_t const b) const
Definition: RangeSet.cc:220
EventRange & at(std::size_t)
Definition: RangeSet.cc:246
size_t art::ClosedRangeSetHandler::end_idx ( ) const
private

Definition at line 96 of file ClosedRangeSetHandler.cc.

97  {
98  return ranges_.end_idx();
99  }
std::size_t end_idx() const
Definition: RangeSet.cc:195
ClosedRangeSetHandler::EventInfo const & art::ClosedRangeSetHandler::eventInfo ( ) const

Definition at line 84 of file ClosedRangeSetHandler.cc.

85  {
86  return eventInfo_;
87  }
ClosedRangeSetHandler & art::ClosedRangeSetHandler::operator= ( ClosedRangeSetHandler const &  )
default
ClosedRangeSetHandler & art::ClosedRangeSetHandler::operator= ( ClosedRangeSetHandler &&  )
default

Member Data Documentation

EventInfo art::ClosedRangeSetHandler::eventInfo_ {}
private

Definition at line 94 of file ClosedRangeSetHandler.h.

std::size_t art::ClosedRangeSetHandler::idx_ {0}
private

Definition at line 93 of file ClosedRangeSetHandler.h.

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

Definition at line 92 of file ClosedRangeSetHandler.h.


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