25 #include <boost/property_tree/json_parser.hpp> 36 const string start_date {pt_config.get<
string>(
"run.start_date",
"2016-01-01")};
37 m_date = boost::gregorian::from_simple_string(start_date);
50 boost::property_tree::ptree pt_holidays;
52 const auto file_name {pt_config.get<
string>(
"run.holidays",
"holidays_flanders_2016.json")};
54 if (!is_regular_file(file_path)) {
55 throw runtime_error(
string(__func__) +
"Holidays file " + file_path.string() +
" not present.");
57 read_json(file_path.string(), pt_holidays);
61 for (
int i = 1; i < 13; i++) {
62 const string month {to_string(i)};
63 const string year {pt_holidays.get<
string>(
"year",
"2016")};
66 const string general_key {
"general." + month};
67 for (
auto& date: pt_holidays.get_child(general_key)) {
68 const string date_string {year +
"-" + month +
"-" + date.second.get_value<
string>()};
69 const auto new_holiday = boost::gregorian::from_simple_string(date_string);
74 const string school_key {
"school." + month};
75 for (
auto& date: pt_holidays.get_child(school_key)) {
76 const string date_string {year +
"-" + month +
"-" + date.second.get_value<
string>()};
77 const auto new_holiday = boost::gregorian::from_simple_string(date_string);
std::vector< boost::gregorian::date > m_school_holidays
Vector of school holidays.
Interface for install directory queries.
std::vector< boost::gregorian::date > m_holidays
Vector of general holidays.
Header file for the Calendar class.
Time Dependent Person DataType.
static boost::filesystem::path getDataDir()
Utility method: get path to the directory for data files.
void initializeHolidays(const boost::property_tree::ptree &pt_config)
Utilities for the project.
void advanceDay()
Advance the internal calendar by one day.
Calendar(const boost::property_tree::ptree &pt_config)
Constructor.
std::size_t m_day
The current simulation day.
boost::gregorian::date m_date
The current simulated day.