Complete US Federal Holidays + Restart.xml
The following listing shows how to:
using fixed_duration_as = timepiece_settings::fixed_duration_as; schedule_timepiece schedule1{sd1, timepiece_move::rewind, any_cast<fixed_duration_as>(sd1.appdata)}; schedule_timepiece schedule2{sd2, timepiece_move::rewind, any_cast<fixed_duration_as>(sd2.appdata)}; schedule_timepiece schedule3{sd3, timepiece_move::rewind, any_cast<fixed_duration_as>(sd3.appdata)}; schedule_timepiece restartSchedule{sd4};
Complete US Federal Holidays + Restart.cpp
The following listing shows how to:
fd:fixed_duration_as
attribute.
using fixed_duration_as = timepiece_settings::fixed_duration_as; constexpr auto determineDowntime = [](const boost::property_tree::ptree& scheduleItem, interval_schedule_data* data) { if (is_category(data->blueprint, onset_series_duration_blueprint)) { string durAs = scheduleItem.get<string>("fd:fixed_duration_as", "uptime"); data->appdata = fixed_duration_as(durAs == "downtime"); } }; ifstream is{L"Complete US Federal Holidays + Restart.xml"}; vector<interval_schedule_definition> schedules = read_xml_interval_schedule(is, determineDowntime); is.close(); // filter valid schedules auto validSchedules = schedules | std::views::filter([](const interval_schedule_definition& schedule) { return !schedule.inactive() && !schedule.data().cycle.empty(); }); // construct timepoint generators list<schedule_timepiece> schedules_; // start at currently active interval, // (except if activity boundary is today, which is taken care of by the interval schedule) for (const interval_schedule_definition& def : validSchedules) { const fixed_duration_as* durAs = any_cast<fixed_duration_as>(&def.app_data()); schedules_.emplace_back(def, natural_timepiece_move_setup(def.data(), scheduling_purpose::application_uptime), timepiece_settings{def.is_duration_blueprint() ? *durAs : fixed_duration_as::fixed_duration}); }