fd::schedule_timepiece — A timepiece device, aka timepoint generator, that generates time points according to simple yet powerful blueprint patterns, which in turn may then be consumed to schedule recurring tasks.
// In header: <fd/schedule_timepiece.h> class schedule_timepiece : public fd::interval_schedule_definition, private schedule_timepiece_state { public: // construct/copy/destruct explicit schedule_timepiece(interval_schedule_data, schedule_timepoint = schedule_clock::local_time()); schedule_timepiece(interval_schedule_data, timepiece_move, schedule_timepoint = schedule_clock::local_time()); schedule_timepiece(interval_schedule_data, timepiece_move, timepiece_settings, schedule_timepoint = schedule_clock::local_time()); explicit schedule_timepiece(interval_schedule_definition, schedule_timepoint = schedule_clock::local_time()); schedule_timepiece(interval_schedule_definition, timepiece_move, schedule_timepoint = schedule_clock::local_time()); schedule_timepiece(interval_schedule_definition, timepiece_move, timepiece_settings, schedule_timepoint = schedule_clock::local_time()); schedule_timepiece(const schedule_timepiece &) = delete; schedule_timepiece & operator=(const schedule_timepiece &) = delete; ~schedule_timepiece(); // public member functions const timepiece_settings & settings() const; schedule_time_bounds activity_boundary() const; schedule_timepoint advance(timepiece_move, schedule_timepoint = schedule_clock::local_time()); schedule_timepoint currently_scheduled_at() const; schedule_timepoint currently_ending_at() const; schedule_time_bounds current_interval() const; schedule_timepoint peek_at_next_scheduled_at() const; bool completed() const; int repetition() const; // private member functions bool advance_to(schedule_timepoint, ptime_comparator); bool advance_adjacent_to(schedule_timepoint); bool advance_next_to(schedule_timepoint); void unskip(); void calculate_ending_timepoint(); void skip_non_operational_kday_uptimes(); void generate_kday_sub_onsets(const schedule_timepoint &, const schedule_timepoint &, ptime_iteration_state, ptime_comparator); void regenerate_kday_dependent_sub_onsets(); void construct_itemized_onset_series(); void construct_remainder_subrange_interval_onset_series(); void construct_subinterval_onset_series(); void construct_uptime_cycle(); void construct_subrange_uptime_cycle(); void construct_onset_completion_for_any_uptime(const interval_onset &, const interval_onset &, const schedule_timepoint &, const schedule_timepoint &); void construct_cycle(); void setup_at(schedule_timepoint); void rewind_to(schedule_timepoint); void sort_onset_series(); std::list< ptime_iteration_state >::iterator current_onset_upper_bound(); };
schedule_timepiece
public
construct/copy/destructexplicit schedule_timepiece(interval_schedule_data d, schedule_timepoint now = schedule_clock::local_time());Construct from schedule definition, advancing to the beginning of activity frame.
Sets beginning of activity frame to a reference time point considered as 'now' if undefined by schedule definition. Moves the timepiece adjacent to 'now'.
Parameters: |
|
||
Throws: |
`std::logic_error` if schedule is inactive or is lacking at least one onset. |
schedule_timepiece(interval_schedule_data d, timepiece_move advanceTo, schedule_timepoint now = schedule_clock::local_time());Construct from schedule definition, advancing to the beginning of activity frame.
Sets beginning of activity frame to a reference time point considered as 'now' if undefined by schedule definition.
Parameters: |
|
||
Throws: |
`std::logic_error` if schedule is inactive or is lacking at least one onset. |
schedule_timepiece(interval_schedule_data d, timepiece_move advanceTo, timepiece_settings settings, schedule_timepoint now = schedule_clock::local_time());Construct from schedule definition, advancing to the beginning of activity frame.
Sets beginning of activity frame to a reference time point considered as 'now' if undefined by schedule definition.
Parameters: |
|
||||
Throws: |
`std::logic_error` if schedule is inactive or is lacking at least one onset. |
explicit schedule_timepiece(interval_schedule_definition def, schedule_timepoint now = schedule_clock::local_time());Construct from schedule definition, advancing to the beginning of activity frame.
Sets beginning of activity frame to a reference timepoint considered as 'now' if undefined by schedule definition.
Throws: |
std::logic_error if schedule is inactive or is lacking at least one onset. |
schedule_timepiece(interval_schedule_definition def, timepiece_move advanceTo, schedule_timepoint now = schedule_clock::local_time());
schedule_timepiece(interval_schedule_definition def, timepiece_move advanceTo, timepiece_settings settings, schedule_timepoint now = schedule_clock::local_time());
schedule_timepiece(const schedule_timepiece &) = delete;
schedule_timepiece & operator=(const schedule_timepiece &) = delete;
~schedule_timepiece();
schedule_timepiece
public member functionsconst timepiece_settings & settings() const;Copy of settings that were provided at construction time.
schedule_time_bounds activity_boundary() const;Effective activity boundary.
schedule_timepoint advance(timepiece_move advanceTo, schedule_timepoint now = schedule_clock::local_time());Advance to time point as specified, yield onset time point that needs to be scheduled next.
schedule_timepoint currently_scheduled_at() const;Currently calculated onset time point (including onset delay); boost::date_time::not_a_date_time if past activity frame (completed).
schedule_timepoint currently_ending_at() const;Currently calculated ending time point;
boost::date_time::not_a_date_time
if past activity frame (completed) or no execution span is configured. schedule_time_bounds current_interval() const;Obbain currently calculated onset+ending time points as a half-open range [onset, ending),
boost::date_time::not_a_date_time
if past activity frame (i.e. completed). schedule_timepoint peek_at_next_scheduled_at() const;Next calculated onset time point (including onset delay) if not completed, currently calculated onset time point if past activity frame (completed).
bool completed() const;Whether schedule has completed (i.e. number of repetitions has been reached or past fixed activity frame (completed).
int repetition() const;Number of repetitions.
schedule_timepiece
private member functionsbool advance_to(schedule_timepoint now, ptime_comparator compare);
bool advance_adjacent_to(schedule_timepoint now);
bool advance_next_to(schedule_timepoint now);
void unskip();
void calculate_ending_timepoint();
void skip_non_operational_kday_uptimes();
void generate_kday_sub_onsets(const schedule_timepoint & bor, const schedule_timepoint & eor, ptime_iteration_state rngIteration, ptime_comparator compare);
void regenerate_kday_dependent_sub_onsets();
void construct_itemized_onset_series();
void construct_remainder_subrange_interval_onset_series();
void construct_subinterval_onset_series();
void construct_uptime_cycle();
void construct_subrange_uptime_cycle();
void construct_onset_completion_for_any_uptime(const interval_onset & onset, const interval_onset & until, const schedule_timepoint & bor, const schedule_timepoint & eor);
void construct_cycle();
void setup_at(schedule_timepoint now);
void rewind_to(schedule_timepoint now);
void sort_onset_series();
std::list< ptime_iteration_state >::iterator current_onset_upper_bound();