PrevUpHomeNext

Class schedule_timepiece

fd::schedule_timepiece — A timepiece device, aka timepoint generator, that generates timepoints 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_impl
{
public:
  // construct/copy/destruct
  explicit schedule_timepiece(interval_schedule_data, 
                              const schedule_timepoint & = schedule_clock::local_time());
  schedule_timepiece(interval_schedule_data, timepiece_move, 
                     const schedule_timepoint & = schedule_clock::local_time());
  schedule_timepiece(interval_schedule_data, timepiece_move, 
                     timepiece_settings, 
                     const schedule_timepoint & = schedule_clock::local_time());
  explicit schedule_timepiece(interval_schedule_definition, 
                              const schedule_timepoint & = schedule_clock::local_time());
  schedule_timepiece(interval_schedule_definition, timepiece_move, 
                     const schedule_timepoint & = schedule_clock::local_time());
  schedule_timepiece(interval_schedule_definition, timepiece_move, 
                     timepiece_settings, 
                     const 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;
  std::pair< schedule_timepoint, schedule_timepoint > 
  activity_boundary() const;
  schedule_timepoint 
  advance(timepiece_move, 
          const schedule_timepoint & = schedule_clock::local_time());
  schedule_timepoint currently_scheduled_at() const;
  schedule_timepoint currently_ending_at() const;
  std::pair< schedule_timepoint, schedule_timepoint > current_interval() const;
  bool completed() const;
  int repetition() const;

  // private member functions
  bool advance_to(const schedule_timepoint &, ptime_comparator);
  bool advance_adjacent_to(const schedule_timepoint &);
  bool advance_next_to(const 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(const schedule_timepoint &);
  void rewind_to(const schedule_timepoint &);
  void sort_onset_series();
  std::list< ptime_iteration_state >::iterator current_onset_upper_bound();
  const schedule_timepiece_impl & inner_state() const;
};

Description

schedule_timepiece public construct/copy/destruct

  1. explicit schedule_timepiece(interval_schedule_data d, 
                                const schedule_timepoint & now = schedule_clock::local_time());
    Construct from schedule definition, advancing to the beginning of activity frame.

    Sets beginning of activity frame to timepoint 'now' if undefined by schedule definition.

    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, 
                       const schedule_timepoint & now = schedule_clock::local_time());
  3. schedule_timepiece(interval_schedule_data d, timepiece_move advanceTo, 
                       timepiece_settings settings, 
                       const schedule_timepoint & now = schedule_clock::local_time());
  4. explicit schedule_timepiece(interval_schedule_definition def, 
                                const schedule_timepoint & now = schedule_clock::local_time());
    Construct from schedule definition, advancing to the beginning of activity frame.

    Sets beginning of activity frame to timepoint '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, 
                       const schedule_timepoint & now = schedule_clock::local_time());
  6. schedule_timepiece(interval_schedule_definition def, timepiece_move advanceTo, 
                       timepiece_settings settings, 
                       const 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;
    Copyied settings that were provided at construction time.
  2. std::pair< schedule_timepoint, schedule_timepoint > activity_boundary() const;
    Effective activity boundary.
  3. schedule_timepoint 
    advance(timepiece_move advanceTo, 
            const schedule_timepoint & now = schedule_clock::local_time());
    Advance to timepoint as specified, yield currently scheduled onset.
  4. schedule_timepoint currently_scheduled_at() const;
    Currently calculated starting timepoint (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 timepoint (including onset delay); boost::date_time::not_a_date_time if past activity frame (completed) or no execution span is configured.
  6. std::pair< schedule_timepoint, schedule_timepoint > current_interval() const;
  7. bool completed() const;
    Whether schedule has completed (i.e. number of repetitions has been reached or past fixed activity frame (completed).
  8. int repetition() const;
    Number of repetitions.

schedule_timepiece private member functions

  1. bool advance_to(const schedule_timepoint & now, ptime_comparator compare);
  2. bool advance_adjacent_to(const schedule_timepoint & now);
  3. bool advance_next_to(const 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(const schedule_timepoint & now);
  17. void rewind_to(const schedule_timepoint & now);
  18. void sort_onset_series();
  19. std::list< ptime_iteration_state >::iterator current_onset_upper_bound();
  20. const schedule_timepiece_impl & inner_state() const;

PrevUpHomeNext