Space‐efficient, value‐semantic repository of weekend and holiday information.

Synopsis

Declared in <bdlt_packedcalendar.h>

class PackedCalendar;

Description

This class implements a space‐efficient, value‐semantic repository of weekend and holiday information over a valid range of dates. This valid range, [firstDate() .. lastDate()], spans the first and last dates of a calendar's accessible contents. A calendar can be "populated" with weekend and holiday information via a suite of "add" methods. Any subset of days of the week may be specified as weekend (i.e., recurring non‐business) days starting from a specified date by adding a weekend‐days transition; holidays within the valid range are specified individually. When adding a holiday, an arbitrary integer "holiday code" may be associated with that date. Additional holiday codes for that date may subsequently be added. Both the holidays and the set of unique holiday codes associated with each holiday date are maintained (internally) in order of increasing value. Note that the behavior of requesting any calendar information for a supplied date whose value is outside the current valid range for that calendar (unless otherwise noted, e.g., isWeekendDay) is undefined.

Type Aliases

Name

Description

BusinessDayConstIterator

Constant iterator over business days in this calendar.

BusinessDayConstReverseIterator

Constant reverse iterator over business days in this calendar.

HolidayCodeConstIterator

Constant iterator over holiday codes in this calendar.

HolidayCodeConstReverseIterator

Constant reverse iterator over holiday codes in this calendar.

HolidayConstIterator

Constant iterator over holidays in this calendar.

HolidayConstReverseIterator

Constant reverse iterator over holidays in this calendar.

WeekendDaysTransition

Transition describing a change in weekend days.

WeekendDaysTransitionConstIterator

Constant iterator over weekend‐days transitions in this calendar.

WeekendDaysTransitionConstReverseIterator

Constant reverse iterator over weekend‐days transitions in this calendar.

Member Functions

Name

Description

PackedCalendar [constructor]

Constructors

~PackedCalendar [destructor]

Destroy this object.

operator=

Assign to this calendar the value of the specified rhs calendar.

addDay

Extend the valid range (if necessary) of this calendar to include the specified date value.

addHoliday

Mark the specified date as a holiday in this calendar.

addHolidayCode

Mark date as a holiday and add holidayCode for that date.

addHolidayCodeIfInRange

Mark date as a holiday and add holidayCode if date is in range.

addHolidayIfInRange

Mark date as a holiday if it is within the valid range.

addWeekendDay

Add weekendDay to the weekend days at the January 1, 0001 transition.

addWeekendDays

Add weekendDays to the weekend days at the January 1, 0001 transition.

addWeekendDaysTransition

Add a weekend‐days transition on startDate with weekendDays.

allocator

Return the allocator used by this object to supply memory.

bdexStreamIn

Assign to this object the value read from the specified input stream.

bdexStreamOut

Write this value to the specified output stream in version format.

beginBusinessDays

beginBusinessDays overloads

beginHolidayCodes

beginHolidayCodes overloads

beginHolidays

beginHolidays overloads

beginWeekendDaysTransitions

Return an iterator to the first weekend‐days transition.

endBusinessDays

endBusinessDays overloads

endHolidayCodes

endHolidayCodes overloads

endHolidays

endHolidays overloads

endWeekendDaysTransitions

Return a past‐the‐end iterator for weekend‐days transitions.

firstDate

Return the earliest date in the valid range of this calendar.

getNextBusinessDay

getNextBusinessDay overloads

holiday

Return the holiday at the specified index in this calendar.

holidayCode

Return the holiday code at index for the holiday on date.

intersectBusinessDays

Merge other so business days become the intersection of both.

intersectNonBusinessDays

Merge other so non‐business days become the intersection of both.

isBusinessDay

Return true if date is a business day in this calendar.

isHoliday

Return true if date is a holiday in this calendar.

isInRange

Return true if date is within the valid range of this calendar.

isNonBusinessDay

Return true if date is not a business day in this calendar.

isWeekendDay

isWeekendDay overloads

lastDate

Return the latest date in the valid range of this calendar.

length

Return the number of days in the valid range of this calendar, which is defined to be 0 if this calendar is empty, and lastDate() ‐ firstDate() + 1 otherwise.

numBusinessDays

numBusinessDays overloads

numHolidayCodes

Return the number of holiday codes associated with date.

numHolidayCodesTotal

Return the total number of holiday codes in this calendar.

numHolidays

Return the number of holiday dates in this calendar.

numNonBusinessDays

Return the number of non‐business days in this calendar.

numWeekendDaysInRange

Return the number of days in the valid range of this calendar that are considered weekend days, irrespective of any designated holidays.

numWeekendDaysTransitions

Return the number of weekend‐days transitions maintained by this calendar.

print

Format this object to the specified output stream.

rbeginBusinessDays

rbeginBusinessDays overloads

rbeginHolidayCodes

rbeginHolidayCodes overloads

rbeginHolidays

rbeginHolidays overloads

rbeginWeekendDaysTransitions

Return an iterator to the last weekend‐days transition.

removeAll

Remove all information from this calendar, leaving it empty.

removeHoliday

Remove the holiday at the specified date if it exists.

removeHolidayCode

Remove holidayCode from the holiday at the specified date.

rendBusinessDays

rendBusinessDays overloads

rendHolidayCodes

rendHolidayCodes overloads

rendHolidays

rendHolidays overloads

rendWeekendDaysTransitions

Return a reverse end iterator for weekend‐days transitions.

reserveHolidayCapacity

Reserve enough space to store at least the specified numHolidays within this calendar. This method has no effect if numHolidays <= numHolidays().

reserveHolidayCodeCapacity

Reserve capacity for at least the specified number of holiday codes.

setValidRange

Set the valid range of this calendar to [firstDate .. lastDate].

swap

Efficiently exchange the value of this object with that of other.

unionBusinessDays

Merge other so business days become the union of both calendars.

unionNonBusinessDays

Merge other so non‐business days become the union of both.

weekendDaysTransition

Return the weekend‐days transition at the specified index.

Static Member Functions

Name

Description

maxSupportedBdexVersion

maxSupportedBdexVersion overloads

Friends

Name

Description

BloombergLP::bdlt::hashAppend

Pass the specified object to the specified hashAlg.

BloombergLP::bdlt::operator!=

Return true if the specified lhs and rhs calendars differ.

BloombergLP::bdlt::operator==

Return true if the specified lhs and rhs calendars have the same value.

BloombergLP::bdlt::PackedCalendar_BusinessDayConstIterator

Provide read‐only, sequential access in increasing (chronological) order to the business days in a PackedCalendar object.

Non-Member Functions

Name

Description

swap

Exchange the values of the specified a and b objects.

Created with MrDocs