OpenStudio:utilities
Loading...
Searching...
No Matches
openstudio::Calendar Class Reference

#include <Calendar.hpp>

Public Member Functions

void addHoliday (const Date &date, const std::string &name)
 add a holiday
 
void addNamedDay (const Date &date, const std::string &name)
 add a non holiday named day
 
 Calendar ()
 default constructor, uses full assumed year
 
 Calendar (const Date &startDate, const Date &endDate)
 constructor with start and end dates, [startDate, endDate]
 
 Calendar (int year)
 constructor with year, uses full assumed year
 
void daylightSavings (const Date &daylightSavingsStart, const Date &daylightSavingsEnd)
 set daylight savings time, [daylightSavingsStart, daylightSavingsEnd)
 
Date endDate () const
 get the last date in the calendar
 
std::string getName (const Date &date) const
 get the name of date, return empty if not on calendar
 
bool includesDate (const Date &date) const
 does the calendar include this date, e.g. are they from the same year
 
bool isDaylightSavings (const Date &date) const
 is date within daylight savings
 
bool isHoliday (const Date &date) const
 is date a holiday
 
bool isNamedDay (const Date &date) const
 is the date named on the calendar, either holiday or non holiday
 
void standardDaylightSavings ()
 standard daylight savings time, [2nd Sunday in March, 1st Sunday in November)
 
void standardHolidays ()
 add a standard set of holidays
 
Date startDate () const
 get the first date in the calendar
 

Static Public Member Functions

static openstudio::LogChannel logChannel ()
 

Detailed Description

Calendar is a description of a year, noting special days like holidays, special periods like seasons, and daylight savings time.

Constructor & Destructor Documentation

◆ Calendar() [1/3]

openstudio::Calendar::Calendar ( )

default constructor, uses full assumed year

◆ Calendar() [2/3]

openstudio::Calendar::Calendar ( int year)

constructor with year, uses full assumed year

◆ Calendar() [3/3]

openstudio::Calendar::Calendar ( const Date & startDate,
const Date & endDate )

constructor with start and end dates, [startDate, endDate]

Member Function Documentation

◆ addHoliday()

void openstudio::Calendar::addHoliday ( const Date & date,
const std::string & name )

add a holiday

◆ addNamedDay()

void openstudio::Calendar::addNamedDay ( const Date & date,
const std::string & name )

add a non holiday named day

◆ daylightSavings()

void openstudio::Calendar::daylightSavings ( const Date & daylightSavingsStart,
const Date & daylightSavingsEnd )

set daylight savings time, [daylightSavingsStart, daylightSavingsEnd)

◆ endDate()

Date openstudio::Calendar::endDate ( ) const

get the last date in the calendar

◆ getName()

std::string openstudio::Calendar::getName ( const Date & date) const

get the name of date, return empty if not on calendar

◆ includesDate()

bool openstudio::Calendar::includesDate ( const Date & date) const

does the calendar include this date, e.g. are they from the same year

◆ isDaylightSavings()

bool openstudio::Calendar::isDaylightSavings ( const Date & date) const

is date within daylight savings

◆ isHoliday()

bool openstudio::Calendar::isHoliday ( const Date & date) const

is date a holiday

◆ isNamedDay()

bool openstudio::Calendar::isNamedDay ( const Date & date) const

is the date named on the calendar, either holiday or non holiday

◆ logChannel()

static openstudio::LogChannel openstudio::Calendar::logChannel ( )
inlinestatic

◆ standardDaylightSavings()

void openstudio::Calendar::standardDaylightSavings ( )

standard daylight savings time, [2nd Sunday in March, 1st Sunday in November)

◆ standardHolidays()

void openstudio::Calendar::standardHolidays ( )

add a standard set of holidays

◆ startDate()

Date openstudio::Calendar::startDate ( ) const

get the first date in the calendar