ScheduleIteration.h
Go to the documentation of this file.
1 #ifndef art_Utilities_ScheduleIteration_h
2 #define art_Utilities_ScheduleIteration_h
3 
4 // ==========================================================================
5 // ScheduleIteration exists to facilitate simple iteration through the
6 // configured schedules for an art job, where the user provides a
7 // callable object that receives a ScheduleID argument. It is the
8 // responsibility of the user to provide the correct arguments at
9 // construction.
10 //
11 // Examples:
12 //
13 // ScheduleIteration iteration_a{7u}; // Configured for 7 schedules.
14 // ScheduleIteration iteration_b{ScheduleID{2}, ScheduleID{6}};
15 //
16 // auto print_id = [](ScheduleID const sid) { std::cout << sid << ' '; };
17 //
18 // iteration_a.for_each_schedule(print_id); // prints 0, 1, 2, 3, 4, 5, 6
19 // iteration_b.for_each_schedule(print_id); // prints 2, 3, 4, 5
20 // ==========================================================================
21 
23 
24 namespace art {
26  public:
29  : begin_{begin}, end_{end}
30  {}
31  template <typename F>
32  void
34  {
35  for (auto sid = begin_; sid < end_; sid = sid.next()) {
36  f(sid);
37  }
38  }
39 
40  private:
43  };
44 }
45 
46 #endif /* art_Utilities_ScheduleIteration_h */
47 
48 // Local Variables:
49 // mode: c++
50 // End:
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
ScheduleIteration(ScheduleID const begin, ScheduleID const end)
static constexpr ScheduleID first()
Definition: ScheduleID.h:50
std::void_t< T > n
ScheduleIteration(ScheduleID::size_type const n)
id_type size_type
Definition: ScheduleID.h:25
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
void for_each_schedule(F f) const
ScheduleID next() const
Definition: ScheduleID.cc:23