PrevUpHomeNext

Reference

Header <fd/algorithm.h>
Header <fd/date_time.h>
Header <fd/date_time_typed.h>
Header <fd/functional.h>
Header <fd/interval_schedule_definition.h>
Header <fd/interval_types.h>
Header <fd/ptime_iteration.h>
Header <fd/ptime_iteration_visitors.h>
Header <fd/ptree_io.h>
Header <fd/ptree_io_xml.h>
Header <fd/schedule_debugging.h>
Header <fd/schedule_timepiece.h>
Header <fd/scheduling_chrono.h>
Header <fd/synkronize_version.h>
Header <fd/timepiece_test_player.h>

Header <fd/algorithm.h>

namespace fd {

  // Check whether given reference time point is not beyond time point bounds; considers possible infinity of boundary. 
  template<auto converter = schedule_timepoint_ident, 
           time_bounds_notation halfopen = time_bounds_notation::halfopen, 
           typename TP> 
    bool within_boundary(const TP & tp, const schedule_time_bounds & boundary);
  template<auto converter, typename TP> 
    bool within_activity_boundary(const TP &, const schedule_timepiece &);
  template<std::ranges::input_range Rng, typename Proj = std::identity> 
    bool all_schedules_completed(const Rng &, Proj && = {});
  template<std::ranges::input_range Rng, typename Proj = std::identity> 
    bool any_of_fixed_duration(const Rng &, Proj && = {});
  template<std::ranges::input_range Rng, typename Proj = std::identity> 
    bool none_of_fixed_duration(const Rng &, Proj && = {});
  template<std::ranges::input_range Rng, typename Proj = std::identity> 
    bool execution_scheduled(const Rng &, scheduling_purpose, Proj && = {});
  template<std::ranges::input_range Rng> 
    bool schedule_implicitly_down(const Rng &, scheduling_purpose);
  template<auto converter, typename TP, std::ranges::forward_range Rng> 
    std::optional< bool > within_schedule_uptime(const TP &, const Rng &);
  template<std::ranges::forward_range Rng> 
    std::optional< schedule_time_bounds > 
    uptime_bounds_for(const schedule_timepoint &, const Rng &);
  template<std::ranges::forward_range Rng> 
    std::optional< std::pair< schedule_timepoint, schedule_timepoint > > 
    uptime_bounds_for_action(const schedule_timepiece &, const Rng &);
  bool within_activity_boundary(const schedule_timepoint & now, 
                                const schedule_timepiece & schedule);
  template<std::ranges::forward_range Rng> 
    std::optional< bool > 
    within_schedule_uptime(const schedule_timepoint & now, 
                           const Rng & schedules);
  template<std::ranges::forward_range Rng> 
    std::optional< bool > 
    within_schedule_uptime(time_t now, const Rng & schedules);
  template<std::ranges::forward_range Rng> 
    std::optional< bool > 
    within_schedule_uptime(std::chrono::system_clock::time_point now, 
                           const Rng & schedules);
}

Header <fd/date_time.h>

namespace fd {
  enum iso_weekday_value;
  iso_weekday iso_first_dow_from(special_iso_weekday);
  iso_weekday_value iso_first_dow_from(iso_weekday_value);
  constexpr int convert_weekday(int, int, int);
  constexpr int convert_weekday(int, iso_weekday_value, iso_weekday_value);

  // Calculate offset from a weekday to the following. 
  constexpr int 
  offset_to_following_weekday(int fromWeekday, int toFollowingWeekday);

  // Calculate negative offset from a weekday to the previous. 
  constexpr int offset_to_prev_weekday(int fromWeekday, int toPrevWeekday);
}
namespace fd {
  struct to_iso_weekday_value;

  // Enumeration of ISO 8601 weekday names. 
  enum iso_weekday { mon, tue, wed, thu, fri, sat, sun, first = = mon, 
                     second = = tue, third = = wed, fourth = = thu, 
                     fifth = = fri, sixth = = sat, seventh = = sun, 
                     last = = sun, first_dow = = first };

  // Enumeration of special designators for locale-based calculations to iso_weekday. 
  enum special_iso_weekday { first_dow_from_system_locale = = -1, 
                             first_dow_from_user_locale = = -2 };

  typedef std::variant< iso_weekday, special_iso_weekday > iso_weekday_variant;  // Variant holding a iso-based weekday. 
  constexpr iso_weekday iso_first_dow_from(iso_weekday);
  constexpr int convert_weekday(int, iso_weekday, iso_weekday);
}

Header <fd/functional.h>

namespace fd {
  enum scheduling_purpose;

  constexpr decltype(has_completed) & has_schedule_completed;
  constexpr decltype(is_completing) & is_schedule_completing;
  constexpr decltype(schedule_timepoint_to_ts) & ts_from_schedule_tp;
  constexpr decltype(schedule_timepoint_to_s) & s_from_schedule_tp;
  constexpr decltype(schedule_timepoint_to_tp) & tp_from_schedule_tp;

  // Copy schedule time point unchanged. 
  schedule_timepoint schedule_timepoint_ident(schedule_timepoint);
  constexpr bool operator!(const schedule_timepoint & tp);

  // Check whether given reference time point is not beyond time point bounds. 
  template<time_bounds_notation halfopen = time_bounds_notation::halfopen, 
           typename TP> 
    bool within_timepoint_interval(const TP & tp, 
                                   const time_bounds< TP > & interval);

  // Check whether given schedule has completed. 
  bool has_completed(const schedule_timepiece & schedule);
  bool is_completing(const schedule_timepiece &);
  bool will_complete_after_current_interval(const schedule_timepiece &);

  // Check whether given schedule is an 'action' schedule, which is mutually exclusive with is_fixed_duration_schedule(). 
  bool is_action_schedule(const schedule_timepiece & schedule);

  // Check whether given schedule is an 'action' schedule used in the context of application uptime. 
  bool is_application_action_schedule(const schedule_timepiece & schedule, 
                                      scheduling_purpose purpose);

  // Check whether given schedule is an 'action' schedule used for task execution. 
  bool is_task_execution_schedule(const schedule_timepiece & schedule, 
                                  scheduling_purpose purpose);

  // Check whether given schedule is a 'fixed duration' ('uptime' or 'downtime') schedule, which is mutually exclusive with is_action_schedule(). 
  bool is_fixed_duration_schedule(const schedule_timepiece & schedule);

  // Check whether given schedule is an 'uptime' schedule, which is mutually exclusive with is_action_schedule() and is_downtime_schedule(). 
  bool is_uptime_schedule(const schedule_timepiece & schedule);

  // Check whether given schedule is a 'fixed duration' schedule, which is mutually exclusive with is_action_schedule() and is_uptime_schedule(). 
  bool is_downtime_schedule(const schedule_timepiece & schedule);

  // Check whether given schedule is a completed 'downtime' schedule. 
  bool is_completed_downtime_schedule(const schedule_timepiece & schedule);

  // Check whether given schedule is an ongoing 'action' schedule. 
  bool is_ongoing_action_schedule(const schedule_timepiece & schedule);

  // Check whether given schedule is a completing 'application action' schedule. 
  bool is_completing_application_action_schedule(const schedule_timepiece & schedule, 
                                                 scheduling_purpose purpose);

  // Check whether given schedule is a completed 'application action' schedule. 
  bool is_completed_application_action_schedule(const schedule_timepiece & schedule, 
                                                scheduling_purpose purpose);

  // Check whether given schedule is a completed 'task execution' schedule. 
  bool is_completed_task_execution_schedule(const schedule_timepiece & schedule, 
                                            scheduling_purpose purpose);

  // Check whether given schedule is an ongoing 'fixed duration' schedule. 
  bool is_ongoing_fixed_duration_schedule(const schedule_timepiece & schedule);
  bool is_non_operational_interval(const schedule_time_bounds &);
  bool is_non_operational_interval(const schedule_timepiece &);
  bool is_contiguously_up(const schedule_timepiece &);
  bool is_contiguously_down(const schedule_timepiece &);

  // Convert a unix timestamp to a schedule time point (in local time). 
  schedule_timepoint ts_to_schedule_timepoint(time_t ts);

  // Convert a schedule time point (in local time) to a unix timestamp, 0 if not a date/time. 
  time_t schedule_timepoint_to_ts(const schedule_timepoint & tp);

  // Convert seconds (UTC assumed) to a schedule time point (in local time). 
  schedule_timepoint s_to_schedule_timepoint(std::chrono::seconds s);

  // Convert a schedule time point (in local time) to seconds (in UTC), 0 if not a date/time. 
  std::chrono::seconds schedule_timepoint_to_s(const schedule_timepoint & tp);

  // Convert a system clock time point to a schedule time point (in local time). 
  schedule_timepoint 
  tp_to_schedule_timepoint(std::chrono::system_clock::time_point tp);

  // Convert a schedule time point (in local time) to a system clock time point, 0 if not a date/time. 
  std::chrono::system_clock::time_point 
  schedule_timepoint_to_tp(const schedule_timepoint & tp);

  // Currently calculated onset time point, converted to explicitly specified return type; 0 if past activity frame (i.e. completed). 
  template<typename R = schedule_timepoint> 
    R currently_scheduled_at(const schedule_timepiece & schedule);

  // Currently calculated onset time point, converted by explicitly specified conversion function; 0 if past activity frame (i.e. completed). 
  template<auto converter> 
    decltype(auto) currently_scheduled_at(const schedule_timepiece & schedule);

  // Currently calculated ending time point, converted to explicitly specified return type; 0 if past activity frame (i.e. completed). 
  template<typename R = schedule_timepoint> 
    R currently_ending_at(const schedule_timepiece & schedule);

  // Currently calculated ending time point, converted by explicitly specified conversion function; 0 if past activity frame (i.e. completed). 
  template<auto converter> 
    decltype(auto) currently_ending_at(const schedule_timepiece & schedule);

  // Currently calculated onset time point since unix epoch (in UTC); 0 if past activity frame (i.e. completed). 
  time_t currently_scheduled_at__ts(const schedule_timepiece & schedule);

  // Currently calculated ending time point since unix epoch (in UTC); 0 if past activity frame (i.e. completed). 
  time_t currently_ending_at__ts(const schedule_timepiece & schedule);

  // Currently calculated onset time point in seconds since unix epoch (in UTC); 0 if past activity frame (i.e. completed). 
  std::chrono::seconds 
  currently_scheduled_at__s(const schedule_timepiece & schedule);

  // Currently calculated ending time point in seconds since unix epoch (in UTC); 0 if past activity frame (i.e. completed). 
  std::chrono::seconds 
  currently_ending_at__s(const schedule_timepiece & schedule);

  // Currently calculated onset time point as a system clock time point; 0 if past activity frame (i.e. completed). 
  std::chrono::system_clock::time_point 
  currently_scheduled_at__tp(const schedule_timepiece & schedule);

  // Currently calculated ending time point as a system clock time point; 0 if past activity frame (i.e. completed). 
  std::chrono::system_clock::time_point 
  currently_ending_at__tp(const schedule_timepiece & schedule);

  // Convert given time point bounds - denoting a time span - from one type to an explictly specified type. 
  template<typename R = schedule_timepoint> 
    time_bounds< R > convert(const schedule_time_bounds & span);

  // Convert given time point bounds - denoting a time span - from one type to another, using explicitly specified conversion function. 
  template<auto converter> auto convert(const schedule_time_bounds & span);

  // 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). 
  template<typename R = schedule_timepoint> 
    time_bounds< R > current_interval(const schedule_timepiece & schedule);

  // Obbain currently calculated onset+ending time points as a half-open range [onset, ending), converted by explicitly specified conversion function. 
  template<auto converter> 
    decltype(auto) current_interval(const schedule_timepiece & schedule);

  // Currently calculated onset+ending time points since unix epoch (in UTC); 0 if past activity frame (i.e. completed). 
  time_bounds< time_t > 
  current_interval__ts(const schedule_timepiece & schedule);

  // Currently calculated onset+ending time points in seconds since unix epoch (in UTC); 0 if past activity frame (i.e. completed). 
  time_bounds< std::chrono::seconds > 
  current_interval__s(const schedule_timepiece & schedule);

  // Currently calculated onset+ending time points as system clock time points; 0 if past activity frame (i.e. completed). 
  time_bounds< std::chrono::system_clock::time_point > 
  current_interval__tp(const schedule_timepiece & schedule);
  timepiece_move 
  natural_timepiece_move_setup(const interval_schedule_data &, 
                               scheduling_purpose);
  std::tuple< schedule_timepiece &, timepiece_move, schedule_timepoint > 
  natural_timepiece_move_arguments(schedule_timepiece &, scheduling_purpose, 
                                   const schedule_timepoint & = schedule_clock::local_time());

  // Advance timepoint generator, yield onset time point that needs to be scheduled next, converted to explicitly specified return type. 
  template<typename R = schedule_timepoint> 
    R advance(schedule_timepiece & schedule, timepiece_move advanceTo, 
              const schedule_timepoint & now = schedule_clock::local_time());

  // Advance timepoint generator, yield onset time point that needs to be scheduled next, converted by explicitly specified conversion function. 
  template<auto converter> 
    decltype(auto) 
    advance(schedule_timepiece & schedule, timepiece_move advanceTo, 
            const schedule_timepoint & now = schedule_clock::local_time());

  // Advance timepoint generator, yield onset time point that needs to be scheduled next, converted to a unix timestamp (in UTC). 
  time_t advance__ts(schedule_timepiece & schedule, timepiece_move advanceTo, 
                     const schedule_timepoint & now = schedule_clock::local_time());

  // Advance timepoint generator, yield onset time point that needs to be scheduled next, converted to seconds (in UTC). 
  std::chrono::seconds 
  advance__s(schedule_timepiece & schedule, timepiece_move advanceTo, 
             const schedule_timepoint & now = schedule_clock::local_time());

  // Advance timepoint generator, yield onset time point that needs to be scheduled next, converted to a system clock time point. 
  std::chrono::system_clock::time_point 
  advance__tp(schedule_timepiece & schedule, timepiece_move advanceTo, 
              const schedule_timepoint & now = schedule_clock::local_time());
}
namespace fd {
  struct interval_schedule_data;

  class interval_schedule_definition;

  enum onset_series_blueprint_category { 
                                         onset_series_sub_blueprint = = INT32_MIN, 
                                         onset_series_duration_blueprint = = -(INT32_MIN >> 1) };
  enum onset_series_blueprint;
  bool is_category(onset_series_blueprint blueprint, 
                   onset_series_blueprint_category category);
}
namespace fd {
  struct interval_onset;
  struct interval_onset_duration;
  struct interval_spec;

  enum interval_granularity { invalid_interval_granularity = = 0, 
                              second_interval = = 0x01, 
                              minute_interval = = 0x02, 
                              hour_interval = = 0x04, day_interval = = 0x08, 
                              week_interval = = 0x10, month_interval = = 0x20, 
                              year_interval = = 0x40, 
                              first_interval_granularity = = second_interval, 
                              last_interval_granularity = = year_interval };

  enum special_interval_factor { numeric_interval_factor = = 0, 
                                 leapyear_interval_factor = = -1 };
  typedef int32_t time_value_t;
  typedef unsigned short greg_value_t;

  constexpr auto time_intervals;
  constexpr auto date_intervals;
  constexpr auto day_intervals;
  constexpr int convert_weekday(const interval_onset &, iso_weekday_value);
  bool operator==(const interval_onset & o2, const interval_onset & o1);
}
namespace fd {
  template<typename date_type> class leapyear_filter_functor;
  class leapyear_iterator;

  struct ptime_iteration_state;
  bool less_schedule_timepoint(const schedule_timepoint & left, 
                               const schedule_timepoint & right);
  bool less_equal_schedule_timepoint(const schedule_timepoint & left, 
                                     const schedule_timepoint & right);
}
namespace fd {
  struct progress_ptime_iteration;
  struct regress_ptime_iteration;
  struct yield_next_ptime;
  struct yield_ptime;

  typedef kj::functional_variant_visitor< Visitor > functional_ptime_iteration_visitor;
}

Header <fd/ptree_io.h>

namespace fd {

  enum ptree_io_storage { xml, json };

  static std::wstring_convert< std::codecvt_utf8_utf16< wchar_t > > u2u8conv;

  // Read a schedule from a (boost) property tree, encoded in utf-8. 
  std::list< interval_schedule_definition > 
  read_interval_schedule(const boost::property_tree::ptree & rootTree, 
                         ptree_io_storage storageType, 
                         const std::function< void(const boost::property_tree::ptree &, interval_schedule_data *)> & read_appdata = {});
  void write_interval_schedule(boost::property_tree::ptree & rootTree, 
                               const std::list< interval_schedule_definition > & schedules, 
                               ptree_io_storage storageType, 
                               const std::function< void(boost::property_tree::ptree &, const interval_schedule_data &)> & write_appdata = {}, 
                               std::initializer_list< std::pair< boost::property_tree::ptree::key_type, boost::property_tree::ptree::data_type > > ns = {});
}
namespace fd {
  std::list< interval_schedule_definition > 
  read_xml_interval_schedule(std::istream &, 
                             const std::function< void(const boost::property_tree::ptree &, interval_schedule_data *)> & = {});
  void write_xml_interval_schedule(std::ostream &, 
                                   const std::list< interval_schedule_definition > &, 
                                   const std::function< void(boost::property_tree::ptree &, const interval_schedule_data &)> & = {}, 
                                   std::initializer_list< std::pair< boost::property_tree::ptree::key_type, boost::property_tree::ptree::data_type > > = {});
}
namespace fd {
  template<typename Char> struct schedule_timepiece_self_disclosure;

  // Compile human readable status and state information for a timepiece. 
  template<typename Char = char> 
    schedule_timepiece_self_disclosure< Char > 
    self_disclosure(const schedule_timepiece & schedule, 
                    scheduling_purpose purpose, 
                    schedule_timepoint now = schedule_clock::local_time());
  template schedule_timepiece_self_disclosure< char > 
  self_disclosure<char >(const schedule_timepiece &, scheduling_purpose, 
                         schedule_timepoint);
  template schedule_timepiece_self_disclosure< wchar_t > 
  self_disclosure<wchar_t >(const schedule_timepiece &, scheduling_purpose, 
                            schedule_timepoint);
}
namespace fd {
  class schedule_timepiece;

  struct timepiece_settings;

  // Designator describing where to move the timepoint generator's timeline cursor. 
  enum timepiece_move { rewind, to_adjacent_end, to_current, to_adjacent, 
                        to_adjacent_begin = = to_adjacent, to_next };
}
namespace fd {
  enum time_bounds_notation;

  typedef boost::posix_time::ptime schedule_timepoint;
  typedef std::pair< TP, TP > time_bounds;
  typedef time_bounds<> schedule_time_bounds;
  typedef boost::date_time::time_itr< schedule_timepoint > schedule_time_iterator;
  typedef boost::date_time::second_clock< schedule_timepoint > schedule_clock;
  typedef schedule_timepoint::time_system_type schedule_time_system;
  typedef schedule_time_system::time_duration_type::traits_type schedule_time_traits;
  typedef std::chrono::duration< schedule_time_traits::tick_type, std::ratio< 1, schedule_time_traits::ticks_per_second > > schedule_duration;
}

SYNKRONIZE_GITDESCRIBE
SYNKRONIZE_GITTAG
SYNKRONIZE_GITABBREVCOMMIT
SYNKRONIZE_GITVERSION
SYNKRONIZE_CURRENTYEAR
namespace fd {
  class timepiece_test_player;

  enum zeitgeber_timepoint_type { onset, ending, prelude = = ending };
}

PrevUpHomeNext