Stride Reference Manual  1.0
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 &pt_config)
 Constructor. More...
 
void advanceDay ()
 Advance the internal calendar by one day. More...
 
std::size_t getDay () const
 Get the current day of the month. More...
 
std::size_t getDayOfTheWeek () const
 Get the current day of the week (0 (Sunday), ..., 6 (Saturday)) More...
 
std::size_t getMonth () const
 Get the current month. More...
 
std::size_t getSimulationDay () const
 Get the current day of the simulation. More...
 
std::size_t getYear () const
 Get the current year. 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 &pt_config)
 

Private Attributes

std::size_t m_day
 The current simulation day. More...
 
boost::gregorian::date m_date
 The current simulated day. More...
 
std::vector< boost::gregorian::date > m_holidays
 Vector of general holidays. More...
 
std::vector< boost::gregorian::date > m_school_holidays
 Vector of school holidays. More...
 

Friends

class Hdf5Loader
 

Detailed Description

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

E.g. what day it is, holidays, quarantines, ...

Definition at line 36 of file Calendar.h.

Constructor & Destructor Documentation

stride::Calendar::Calendar ( const boost::property_tree::ptree &  pt_config)

Constructor.

Definition at line 33 of file Calendar.cpp.

References initializeHolidays(), and m_date.

Member Function Documentation

void stride::Calendar::advanceDay ( )

Advance the internal calendar by one day.

Definition at line 43 of file Calendar.cpp.

References m_date, and m_day.

std::size_t stride::Calendar::getDay ( ) const
inline

Get the current day of the month.

Definition at line 45 of file Calendar.h.

References m_date.

std::size_t stride::Calendar::getDayOfTheWeek ( ) const
inline

Get the current day of the week (0 (Sunday), ..., 6 (Saturday))

Definition at line 48 of file Calendar.h.

References m_date.

Referenced by isWeekend().

std::size_t stride::Calendar::getMonth ( ) const
inline

Get the current month.

Definition at line 51 of file Calendar.h.

References m_date.

std::size_t stride::Calendar::getSimulationDay ( ) const
inline

Get the current day of the simulation.

Definition at line 54 of file Calendar.h.

References m_day.

std::size_t stride::Calendar::getYear ( ) const
inline

Get the current year.

Definition at line 57 of file Calendar.h.

References m_date.

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

Check if it's a holiday.

Definition at line 60 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 63 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 68 of file Calendar.h.

References getDayOfTheWeek(), and initializeHolidays().

void stride::Calendar::initializeHolidays ( const boost::property_tree::ptree &  pt_config)
private

Definition at line 48 of file Calendar.cpp.

References stride::util::InstallDirs::getDataDir(), m_holidays, and m_school_holidays.

Referenced by Calendar(), and isWeekend().

Friends And Related Function Documentation

friend class Hdf5Loader
friend

Definition at line 81 of file Calendar.h.

Member Data Documentation

std::size_t stride::Calendar::m_day
private

The current simulation day.

Definition at line 75 of file Calendar.h.

Referenced by advanceDay(), and getSimulationDay().

boost::gregorian::date stride::Calendar::m_date
private

The current simulated day.

Definition at line 76 of file Calendar.h.

Referenced by advanceDay(), Calendar(), getDay(), getDayOfTheWeek(), getMonth(), getYear(), isHoliday(), and isSchoolHoliday().

std::vector<boost::gregorian::date> stride::Calendar::m_holidays
private

Vector of general holidays.

Definition at line 77 of file Calendar.h.

Referenced by initializeHolidays(), and isHoliday().

std::vector<boost::gregorian::date> stride::Calendar::m_school_holidays
private

Vector of school holidays.

Definition at line 78 of file Calendar.h.

Referenced by initializeHolidays(), and isSchoolHoliday().


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