[#BloombergLP-bdlt-PackedCalendar] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::PackedCalendar :relfileprefix: ../../ :mrdocs: Space‐efficient, value‐semantic repository of weekend and holiday information. == Synopsis Declared in `<bdlt_packedcalendar.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlt/PackedCalendar/BusinessDayConstIterator.adoc[`BusinessDayConstIterator`] | Constant iterator over business days in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/BusinessDayConstReverseIterator.adoc[`BusinessDayConstReverseIterator`] | Constant reverse iterator over business days in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/HolidayCodeConstIterator.adoc[`HolidayCodeConstIterator`] | Constant iterator over holiday codes in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/HolidayCodeConstReverseIterator.adoc[`HolidayCodeConstReverseIterator`] | Constant reverse iterator over holiday codes in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/HolidayConstIterator.adoc[`HolidayConstIterator`] | Constant iterator over holidays in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/HolidayConstReverseIterator.adoc[`HolidayConstReverseIterator`] | Constant reverse iterator over holidays in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/WeekendDaysTransition-0f.adoc[`WeekendDaysTransition`] | Transition describing a change in weekend days. | xref:BloombergLP/bdlt/PackedCalendar/WeekendDaysTransitionConstIterator.adoc[`WeekendDaysTransitionConstIterator`] | Constant iterator over weekend‐days transitions in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/WeekendDaysTransitionConstReverseIterator.adoc[`WeekendDaysTransitionConstReverseIterator`] | Constant reverse iterator over weekend‐days transitions in this calendar. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlt/PackedCalendar/2constructor-06.adoc[`PackedCalendar`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlt/PackedCalendar/2destructor.adoc[`~PackedCalendar`] [.small]#[destructor]# | Destroy this object. | xref:BloombergLP/bdlt/PackedCalendar/operator_assign.adoc[`operator=`] | Assign to this calendar the value of the specified `rhs` calendar. | xref:BloombergLP/bdlt/PackedCalendar/addDay.adoc[`addDay`] | Extend the valid range (if necessary) of this calendar to include the specified `date` value. | xref:BloombergLP/bdlt/PackedCalendar/addHoliday.adoc[`addHoliday`] | Mark the specified `date` as a holiday in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/addHolidayCode.adoc[`addHolidayCode`] | Mark `date` as a holiday and add `holidayCode` for that date. | xref:BloombergLP/bdlt/PackedCalendar/addHolidayCodeIfInRange.adoc[`addHolidayCodeIfInRange`] | Mark `date` as a holiday and add `holidayCode` if `date` is in range. | xref:BloombergLP/bdlt/PackedCalendar/addHolidayIfInRange.adoc[`addHolidayIfInRange`] | Mark `date` as a holiday if it is within the valid range. | xref:BloombergLP/bdlt/PackedCalendar/addWeekendDay.adoc[`addWeekendDay`] | Add `weekendDay` to the weekend days at the January 1, 0001 transition. | xref:BloombergLP/bdlt/PackedCalendar/addWeekendDays.adoc[`addWeekendDays`] | Add `weekendDays` to the weekend days at the January 1, 0001 transition. | xref:BloombergLP/bdlt/PackedCalendar/addWeekendDaysTransition.adoc[`addWeekendDaysTransition`] | Add a weekend‐days transition on `startDate` with `weekendDays`. | xref:BloombergLP/bdlt/PackedCalendar/allocator.adoc[`allocator`] | Return the allocator used by this object to supply memory. | xref:BloombergLP/bdlt/PackedCalendar/bdexStreamIn.adoc[`bdexStreamIn`] | Assign to this object the value read from the specified input stream. | xref:BloombergLP/bdlt/PackedCalendar/bdexStreamOut.adoc[`bdexStreamOut`] | Write this value to the specified output `stream` in `version` format. | xref:BloombergLP/bdlt/PackedCalendar/beginBusinessDays-0a.adoc[`beginBusinessDays`] | `beginBusinessDays` overloads | xref:BloombergLP/bdlt/PackedCalendar/beginHolidayCodes-098.adoc[`beginHolidayCodes`] | `beginHolidayCodes` overloads | xref:BloombergLP/bdlt/PackedCalendar/beginHolidays-02.adoc[`beginHolidays`] | `beginHolidays` overloads | xref:BloombergLP/bdlt/PackedCalendar/beginWeekendDaysTransitions.adoc[`beginWeekendDaysTransitions`] | Return an iterator to the first weekend‐days transition. | xref:BloombergLP/bdlt/PackedCalendar/endBusinessDays-00.adoc[`endBusinessDays`] | `endBusinessDays` overloads | xref:BloombergLP/bdlt/PackedCalendar/endHolidayCodes-0f.adoc[`endHolidayCodes`] | `endHolidayCodes` overloads | xref:BloombergLP/bdlt/PackedCalendar/endHolidays-06.adoc[`endHolidays`] | `endHolidays` overloads | xref:BloombergLP/bdlt/PackedCalendar/endWeekendDaysTransitions.adoc[`endWeekendDaysTransitions`] | Return a past‐the‐end iterator for weekend‐days transitions. | xref:BloombergLP/bdlt/PackedCalendar/firstDate.adoc[`firstDate`] | Return the earliest date in the valid range of this calendar. | xref:BloombergLP/bdlt/PackedCalendar/getNextBusinessDay-02.adoc[`getNextBusinessDay`] | `getNextBusinessDay` overloads | xref:BloombergLP/bdlt/PackedCalendar/holiday.adoc[`holiday`] | Return the holiday at the specified `index` in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/holidayCode.adoc[`holidayCode`] | Return the holiday code at `index` for the holiday on `date`. | xref:BloombergLP/bdlt/PackedCalendar/intersectBusinessDays.adoc[`intersectBusinessDays`] | Merge `other` so business days become the intersection of both. | xref:BloombergLP/bdlt/PackedCalendar/intersectNonBusinessDays.adoc[`intersectNonBusinessDays`] | Merge `other` so non‐business days become the intersection of both. | xref:BloombergLP/bdlt/PackedCalendar/isBusinessDay.adoc[`isBusinessDay`] | Return `true` if `date` is a business day in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/isHoliday.adoc[`isHoliday`] | Return `true` if `date` is a holiday in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/isInRange.adoc[`isInRange`] | Return `true` if `date` is within the valid range of this calendar. | xref:BloombergLP/bdlt/PackedCalendar/isNonBusinessDay.adoc[`isNonBusinessDay`] | Return `true` if `date` is not a business day in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/isWeekendDay-04.adoc[`isWeekendDay`] | `isWeekendDay` overloads | xref:BloombergLP/bdlt/PackedCalendar/lastDate.adoc[`lastDate`] | Return the latest date in the valid range of this calendar. | xref:BloombergLP/bdlt/PackedCalendar/length.adoc[`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. | xref:BloombergLP/bdlt/PackedCalendar/numBusinessDays-08a.adoc[`numBusinessDays`] | `numBusinessDays` overloads | xref:BloombergLP/bdlt/PackedCalendar/numHolidayCodes.adoc[`numHolidayCodes`] | Return the number of holiday codes associated with `date`. | xref:BloombergLP/bdlt/PackedCalendar/numHolidayCodesTotal.adoc[`numHolidayCodesTotal`] | Return the total number of holiday codes in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/numHolidays.adoc[`numHolidays`] | Return the number of holiday dates in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/numNonBusinessDays.adoc[`numNonBusinessDays`] | Return the number of non‐business days in this calendar. | xref:BloombergLP/bdlt/PackedCalendar/numWeekendDaysInRange.adoc[`numWeekendDaysInRange`] | Return the number of days in the valid range of this calendar that are considered weekend days, irrespective of any designated holidays. | xref:BloombergLP/bdlt/PackedCalendar/numWeekendDaysTransitions.adoc[`numWeekendDaysTransitions`] | Return the number of weekend‐days transitions maintained by this calendar. | xref:BloombergLP/bdlt/PackedCalendar/print.adoc[`print`] | Format this object to the specified output `stream`. | xref:BloombergLP/bdlt/PackedCalendar/rbeginBusinessDays-01.adoc[`rbeginBusinessDays`] | `rbeginBusinessDays` overloads | xref:BloombergLP/bdlt/PackedCalendar/rbeginHolidayCodes-00.adoc[`rbeginHolidayCodes`] | `rbeginHolidayCodes` overloads | xref:BloombergLP/bdlt/PackedCalendar/rbeginHolidays-02.adoc[`rbeginHolidays`] | `rbeginHolidays` overloads | xref:BloombergLP/bdlt/PackedCalendar/rbeginWeekendDaysTransitions.adoc[`rbeginWeekendDaysTransitions`] | Return an iterator to the last weekend‐days transition. | xref:BloombergLP/bdlt/PackedCalendar/removeAll.adoc[`removeAll`] | Remove all information from this calendar, leaving it empty. | xref:BloombergLP/bdlt/PackedCalendar/removeHoliday.adoc[`removeHoliday`] | Remove the holiday at the specified `date` if it exists. | xref:BloombergLP/bdlt/PackedCalendar/removeHolidayCode.adoc[`removeHolidayCode`] | Remove `holidayCode` from the holiday at the specified `date`. | xref:BloombergLP/bdlt/PackedCalendar/rendBusinessDays-02.adoc[`rendBusinessDays`] | `rendBusinessDays` overloads | xref:BloombergLP/bdlt/PackedCalendar/rendHolidayCodes-0a.adoc[`rendHolidayCodes`] | `rendHolidayCodes` overloads | xref:BloombergLP/bdlt/PackedCalendar/rendHolidays-04.adoc[`rendHolidays`] | `rendHolidays` overloads | xref:BloombergLP/bdlt/PackedCalendar/rendWeekendDaysTransitions.adoc[`rendWeekendDaysTransitions`] | Return a reverse end iterator for weekend‐days transitions. | xref:BloombergLP/bdlt/PackedCalendar/reserveHolidayCapacity.adoc[`reserveHolidayCapacity`] | Reserve enough space to store at least the specified `numHolidays` within this calendar. This method has no effect if `numHolidays <= numHolidays()`. | xref:BloombergLP/bdlt/PackedCalendar/reserveHolidayCodeCapacity.adoc[`reserveHolidayCodeCapacity`] | Reserve capacity for at least the specified number of holiday codes. | xref:BloombergLP/bdlt/PackedCalendar/setValidRange.adoc[`setValidRange`] | Set the valid range of this calendar to `[firstDate .. lastDate]`. | xref:BloombergLP/bdlt/PackedCalendar/swap.adoc[`swap`] | Efficiently exchange the value of this object with that of `other`. | xref:BloombergLP/bdlt/PackedCalendar/unionBusinessDays.adoc[`unionBusinessDays`] | Merge `other` so business days become the union of both calendars. | xref:BloombergLP/bdlt/PackedCalendar/unionNonBusinessDays.adoc[`unionNonBusinessDays`] | Merge `other` so non‐business days become the union of both. | xref:BloombergLP/bdlt/PackedCalendar/weekendDaysTransition-07.adoc[`weekendDaysTransition`] | Return the weekend‐days transition at the specified `index`. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlt/PackedCalendar/maxSupportedBdexVersion-0c.adoc[`maxSupportedBdexVersion`] | `maxSupportedBdexVersion` overloads |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bdlt/hashAppend-066.adoc[BloombergLP::bdlt::hashAppend]` | Pass the specified `object` to the specified `hashAlg`. | `xref:BloombergLP/bdlt/operator_not_eq-07cb.adoc[BloombergLP::bdlt::operator!=]` | Return `true` if the specified `lhs` and `rhs` calendars differ. | `xref:BloombergLP/bdlt/operator_eq-0d.adoc[BloombergLP::bdlt::operator==]` | Return `true` if the specified `lhs` and `rhs` calendars have the same value. | `xref:BloombergLP/bdlt/PackedCalendar_BusinessDayConstIterator.adoc[BloombergLP::bdlt::PackedCalendar_BusinessDayConstIterator]` | Provide read‐only, sequential access in increasing (chronological) order to the business days in a `PackedCalendar` object. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlt/swap-010.adoc[`swap`] | Exchange the values of the specified `a` and `b` objects. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#