Stride Reference Manual  - generated for commit 9643b11
stride::Calendar Class Reference

Class that keeps track of the 'state' of simulated world. More...

#include <Calendar.h>

Collaboration diagram for stride::Calendar:
Collaboration graph

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

stride::Calendar::Calendar ( const boost::property_tree::ptree &  configPt)
explicit

Constructor.

Definition at line 107 of file Calendar.cpp.

References stride::ConvertFromString(), InitializeHolidays(), and m_date.

Here is the call graph for this function:

Member Function Documentation

void stride::Calendar::AdvanceDay ( )

Advance the simulated calendar by one day.

Definition at line 117 of file Calendar.cpp.

References m_date, and m_day.

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().

Here is the caller graph for this function:

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.

bool stride::Calendar::IsHoliday ( ) const
inline

Check if it's a holiday.

Definition at line 67 of file Calendar.h.

References m_date, and m_holidays.

bool stride::Calendar::IsSchoolHoliday ( ) const
inline

Check if it's a school holiday.

Definition at line 70 of file Calendar.h.

References m_date, and m_school_holidays.

bool stride::Calendar::IsWeekend ( ) const
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.

Here is the call graph for this function:

void stride::Calendar::InitializeHolidays ( const boost::property_tree::ptree &  configPt)
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().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

date::year_month_day stride::Calendar::m_date
private

Current simulated date.

Definition at line 89 of file Calendar.h.

Referenced by AdvanceDay(), Calendar(), GetDay(), GetDayOfTheWeek(), GetMonth(), GetYear(), IsHoliday(), IsSchoolHoliday(), and IsWeekend().

std::vector<date::year_month_day> stride::Calendar::m_holidays
private

Vector of general holidays.

Definition at line 90 of file Calendar.h.

Referenced by InitializeHolidays(), IsHoliday(), and IsWeekend().

std::vector<date::year_month_day> stride::Calendar::m_school_holidays
private

Vector of school holidays.

Definition at line 91 of file Calendar.h.

Referenced by InitializeHolidays(), IsSchoolHoliday(), and IsWeekend().

unsigned short int stride::Calendar::m_day
private

Current day since start of simulation.

Definition at line 93 of file Calendar.h.

Referenced by AdvanceDay(), and GetSimulationDay().


The documentation for this class was generated from the following files: