Stride Reference Manual
- generated for commit 9643b11
|
Class that keeps track of the 'state' of simulated world. More...
#include <Calendar.h>
Public Member Functions | |
Calendar (const boost::property_tree::ptree &configPt) | |
Constructor. More... | |
void | AdvanceDay () |
Advance the simulated calendar by one day. More... | |
std::size_t | GetDay () const |
Current day of the month in the simulated calendar. More... | |
std::size_t | GetDayOfTheWeek () const |
Current day of the week (0 (Sunday), ..., 6 (Saturday)) in the simulated calendar. More... | |
std::size_t | GetMonth () const |
Current month in the simulated calendar. More... | |
unsigned short int | GetSimulationDay () const |
Current simulated day since the start of the simulation. More... | |
std::size_t | GetYear () const |
Current year in the simulated calendar. More... | |
bool | IsHoliday () const |
Check if it's a holiday. More... | |
bool | IsSchoolHoliday () const |
Check if it's a school holiday. More... | |
bool | IsWeekend () const |
Check if it's the weekend. More... | |
Private Member Functions | |
void | InitializeHolidays (const boost::property_tree::ptree &configPt) |
Private Attributes | |
date::year_month_day | m_date |
Current simulated date. More... | |
std::vector< date::year_month_day > | m_holidays |
Vector of general holidays. More... | |
std::vector< date::year_month_day > | m_school_holidays |
Vector of school holidays. More... | |
unsigned short int | m_day |
Current day since start of simulation. More... | |
Class that keeps track of the 'state' of simulated world.
E.g. what day it is, holidays, quarantines, ...
Definition at line 42 of file Calendar.h.
|
explicit |
Constructor.
Definition at line 107 of file Calendar.cpp.
References stride::ConvertFromString(), InitializeHolidays(), and m_date.
void stride::Calendar::AdvanceDay | ( | ) |
Advance the simulated calendar by one day.
Definition at line 117 of file Calendar.cpp.
size_t stride::Calendar::GetDay | ( | ) | const |
Current day of the month in the simulated calendar.
Definition at line 161 of file Calendar.cpp.
References m_date.
size_t stride::Calendar::GetDayOfTheWeek | ( | ) | const |
Current day of the week (0 (Sunday), ..., 6 (Saturday)) in the simulated calendar.
Definition at line 163 of file Calendar.cpp.
References m_date.
Referenced by IsWeekend().
size_t stride::Calendar::GetMonth | ( | ) | const |
Current month in the simulated calendar.
Definition at line 168 of file Calendar.cpp.
References m_date.
unsigned short int stride::Calendar::GetSimulationDay | ( | ) | const |
Current simulated day since the start of the simulation.
Definition at line 170 of file Calendar.cpp.
References m_day.
size_t stride::Calendar::GetYear | ( | ) | const |
Current year in the simulated calendar.
Definition at line 172 of file Calendar.cpp.
References m_date.
|
inline |
Check if it's a holiday.
Definition at line 67 of file Calendar.h.
References m_date, and m_holidays.
|
inline |
Check if it's a school holiday.
Definition at line 70 of file Calendar.h.
References m_date, and m_school_holidays.
|
inline |
Check if it's the weekend.
Definition at line 77 of file Calendar.h.
References GetDayOfTheWeek(), InitializeHolidays(), m_date, m_holidays, and m_school_holidays.
|
private |
Append zero's due to a bug in stdc++ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45896
Append zero's due to a bug in stdc++ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45896
Definition at line 123 of file Calendar.cpp.
References stride::ConvertFromString(), stride::util::FileSys::GetDataDir(), m_holidays, and m_school_holidays.
Referenced by Calendar(), and IsWeekend().
|
private |
Current simulated date.
Definition at line 89 of file Calendar.h.
Referenced by AdvanceDay(), Calendar(), GetDay(), GetDayOfTheWeek(), GetMonth(), GetYear(), IsHoliday(), IsSchoolHoliday(), and IsWeekend().
|
private |
Vector of general holidays.
Definition at line 90 of file Calendar.h.
Referenced by InitializeHolidays(), IsHoliday(), and IsWeekend().
|
private |
Vector of school holidays.
Definition at line 91 of file Calendar.h.
Referenced by InitializeHolidays(), IsSchoolHoliday(), and IsWeekend().
|
private |
Current day since start of simulation.
Definition at line 93 of file Calendar.h.
Referenced by AdvanceDay(), and GetSimulationDay().