PrevUpHomeNext

Class timepiece_test_player

fd::timepiece_test_player

Synopsis

// In header: <fd/timepiece_test_player.h>


class timepiece_test_player {
public:
  // types
  typedef void(const schedule_timepoint &, zeitgeber_timepoint_type) callback_signature;
  typedef std::function< callback_signature >                        callback_type;     

  // member classes/structs/unions

  struct parameters {

    // public static functions
    static scheduling_purpose default_purpose() noexcept(false);

    // public data members
    scheduling_purpose purpose;
    schedule_timepoint now;
    int nSets;    // How many cycles the player should cycle through. 
    bool skip_contiguously_up_or_down;
  };

  struct State {

    // public member functions
    bool test_limit_reached() const noexcept;

    // public data members
    const timepiece_test_player::parameters & params;
    schedule_timepiece & schedule;
    const timepiece_test_player::callback_type f;
    const scheduling_purpose purpose;
    const int nInitialReps;
    const int nMaxReps;
    const bool beganWithinInterval;
    schedule_timepoint now;
  };

  // construct/copy/destruct
  timepiece_test_player(parameters, timepiece_settings, 
                        interval_schedule_definition);

  // public member functions
  const schedule_timepiece & get_schedule() const;
  const parameters & get_parameters() const;
  void play(callback_type);

  // private member functions
  void play_task_execution(callback_type);
  void play_app_restart(callback_type);
  void play_app_uptime(callback_type);
  void play_app_downtime(callback_type);
};

Description

A test player for a single schedule_timepiece.

timepiece_test_player public construct/copy/destruct

  1. timepiece_test_player(parameters params, timepiece_settings settings, 
                          interval_schedule_definition def);
    Construct the test player.

    Requires:

    Given schedule must be active.

timepiece_test_player public member functions

  1. const schedule_timepiece & get_schedule() const;
  2. const parameters & get_parameters() const;
  3. void play(callback_type f);

timepiece_test_player private member functions

  1. void play_task_execution(callback_type f);
  2. void play_app_restart(callback_type f);
  3. void play_app_uptime(callback_type f);
  4. void play_app_downtime(callback_type f);

PrevUpHomeNext