PrevUpHomeNext

Class schedule_timepiece

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.

Synopsis

// 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();
};

Description

schedule_timepiece public construct/copy/destruct

  1. explicit 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:

    now

    Reference time point that specifies where to set up the timepiece.

    Throws:

    `std::logic_error` if schedule is inactive or is lacking at least one onset.
  2. 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:

    now

    Reference time point that specifies where to set up the timepiece.

    Throws:

    `std::logic_error` if schedule is inactive or is lacking at least one onset.
  3. 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:

    now

    Reference time point that specifies where to set up the timepiece. Must contain the onset delay specified in the settings parameter.

    settings

    timepiece settings. now must contain the onset delay specified in the settings parameter.

    Throws:

    `std::logic_error` if schedule is inactive or is lacking at least one onset.
  4. 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.
  5. schedule_timepiece(interval_schedule_definition def, timepiece_move advanceTo, 
                       schedule_timepoint now = schedule_clock::local_time());
  6. schedule_timepiece(interval_schedule_definition def, timepiece_move advanceTo, 
                       timepiece_settings settings, 
                       schedule_timepoint now = schedule_clock::local_time());
  7. schedule_timepiece(const schedule_timepiece &) = delete;
  8. schedule_timepiece & operator=(const schedule_timepiece &) = delete;
  9. ~schedule_timepiece();

schedule_timepiece public member functions

  1. const timepiece_settings & settings() const;
    Copy of settings that were provided at construction time.
  2. schedule_time_bounds activity_boundary() const;
    Effective activity boundary.
  3. 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.
  4. 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).
  5. 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.
  6. 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).
  7. 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).
  8. bool completed() const;
    Whether schedule has completed (i.e. number of repetitions has been reached or past fixed activity frame (completed).
  9. int repetition() const;
    Number of repetitions.

schedule_timepiece private member functions

  1. bool advance_to(schedule_timepoint now, ptime_comparator compare);
  2. bool advance_adjacent_to(schedule_timepoint now);
  3. bool advance_next_to(schedule_timepoint now);
  4. void unskip();
  5. void calculate_ending_timepoint();
  6. void skip_non_operational_kday_uptimes();
  7. void generate_kday_sub_onsets(const schedule_timepoint & bor, 
                                  const schedule_timepoint & eor, 
                                  ptime_iteration_state rngIteration, 
                                  ptime_comparator compare);
  8. void regenerate_kday_dependent_sub_onsets();
  9. void construct_itemized_onset_series();
  10. void construct_remainder_subrange_interval_onset_series();
  11. void construct_subinterval_onset_series();
  12. void construct_uptime_cycle();
  13. void construct_subrange_uptime_cycle();
  14. void construct_onset_completion_for_any_uptime(const interval_onset & onset, 
                                                   const interval_onset & until, 
                                                   const schedule_timepoint & bor, 
                                                   const schedule_timepoint & eor);
  15. void construct_cycle();
  16. void setup_at(schedule_timepoint now);
  17. void rewind_to(schedule_timepoint now);
  18. void sort_onset_series();
  19. std::list< ptime_iteration_state >::iterator current_onset_upper_bound();

PrevUpHomeNext