[#BloombergLP-bdlt-PackedCalendar]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::PackedCalendar
:relfileprefix: ../../
:mrdocs:

Space&hyphen;efficient, value&hyphen;semantic repository of weekend and holiday information&period;

== Synopsis

Declared in `&lt;bdlt&lowbar;packedcalendar&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class PackedCalendar;
----

== Description

This class implements a space&hyphen;efficient, value&hyphen;semantic repository of weekend and holiday information over a _valid_ _range_ of dates&period; This valid range, `&lsqb;firstDate() &period;&period; lastDate()&rsqb;`, spans the first and last dates of a calendar&apos;s accessible contents&period; A calendar can be &quot;populated&quot; with weekend and holiday information via a suite of &quot;add&quot; methods&period; Any subset of days of the week may be specified as weekend (i&period;e&period;, recurring non&hyphen;business) days starting from a specified date by adding a weekend&hyphen;days transition&semi; holidays within the valid range are specified individually&period; When adding a holiday, an arbitrary integer &quot;holiday code&quot; may be associated with that date&period; Additional holiday codes for that date may subsequently be added&period; Both the holidays and the set of unique holiday codes associated with each holiday date are maintained (internally) in order of increasing value&period; 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&period;g&period;, `isWeekendDay`) is undefined&period;

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/PackedCalendar/BusinessDayConstIterator.adoc[`BusinessDayConstIterator`] 
| Constant iterator over business days in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/BusinessDayConstReverseIterator.adoc[`BusinessDayConstReverseIterator`] 
| Constant reverse iterator over business days in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/HolidayCodeConstIterator.adoc[`HolidayCodeConstIterator`] 
| Constant iterator over holiday codes in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/HolidayCodeConstReverseIterator.adoc[`HolidayCodeConstReverseIterator`] 
| Constant reverse iterator over holiday codes in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/HolidayConstIterator.adoc[`HolidayConstIterator`] 
| Constant iterator over holidays in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/HolidayConstReverseIterator.adoc[`HolidayConstReverseIterator`] 
| Constant reverse iterator over holidays in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/WeekendDaysTransition-0f.adoc[`WeekendDaysTransition`] 
| Transition describing a change in weekend days&period;
| xref:BloombergLP/bdlt/PackedCalendar/WeekendDaysTransitionConstIterator.adoc[`WeekendDaysTransitionConstIterator`] 
| Constant iterator over weekend&hyphen;days transitions in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/WeekendDaysTransitionConstReverseIterator.adoc[`WeekendDaysTransitionConstReverseIterator`] 
| Constant reverse iterator over weekend&hyphen;days transitions in this calendar&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/PackedCalendar/2constructor-06.adoc[`PackedCalendar`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlt/PackedCalendar/2destructor.adoc[`&#126;PackedCalendar`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/bdlt/PackedCalendar/operator_assign.adoc[`operator&equals;`] 
| Assign to this calendar the value of the specified `rhs` calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/addDay.adoc[`addDay`] 
| Extend the valid range (if necessary) of this calendar to include the specified `date` value&period;
| xref:BloombergLP/bdlt/PackedCalendar/addHoliday.adoc[`addHoliday`] 
| Mark the specified `date` as a holiday in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/addHolidayCode.adoc[`addHolidayCode`] 
| Mark `date` as a holiday and add `holidayCode` for that date&period;
| xref:BloombergLP/bdlt/PackedCalendar/addHolidayCodeIfInRange.adoc[`addHolidayCodeIfInRange`] 
| Mark `date` as a holiday and add `holidayCode` if `date` is in range&period;
| xref:BloombergLP/bdlt/PackedCalendar/addHolidayIfInRange.adoc[`addHolidayIfInRange`] 
| Mark `date` as a holiday if it is within the valid range&period;
| xref:BloombergLP/bdlt/PackedCalendar/addWeekendDay.adoc[`addWeekendDay`] 
| Add `weekendDay` to the weekend days at the January 1, 0001 transition&period;
| xref:BloombergLP/bdlt/PackedCalendar/addWeekendDays.adoc[`addWeekendDays`] 
| Add `weekendDays` to the weekend days at the January 1, 0001 transition&period;
| xref:BloombergLP/bdlt/PackedCalendar/addWeekendDaysTransition.adoc[`addWeekendDaysTransition`] 
| Add a weekend&hyphen;days transition on `startDate` with `weekendDays`&period;
| xref:BloombergLP/bdlt/PackedCalendar/allocator.adoc[`allocator`] 
| Return the allocator used by this object to supply memory&period;
| xref:BloombergLP/bdlt/PackedCalendar/bdexStreamIn.adoc[`bdexStreamIn`] 
| Assign to this object the value read from the specified input stream&period;
| xref:BloombergLP/bdlt/PackedCalendar/bdexStreamOut.adoc[`bdexStreamOut`] 
| Write this value to the specified output `stream` in `version` format&period;
| 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&hyphen;days transition&period;
| 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&hyphen;the&hyphen;end iterator for weekend&hyphen;days transitions&period;
| xref:BloombergLP/bdlt/PackedCalendar/firstDate.adoc[`firstDate`] 
| Return the earliest date in the valid range of this calendar&period;
| 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&period;
| xref:BloombergLP/bdlt/PackedCalendar/holidayCode.adoc[`holidayCode`] 
| Return the holiday code at `index` for the holiday on `date`&period;
| xref:BloombergLP/bdlt/PackedCalendar/intersectBusinessDays.adoc[`intersectBusinessDays`] 
| Merge `other` so business days become the intersection of both&period;
| xref:BloombergLP/bdlt/PackedCalendar/intersectNonBusinessDays.adoc[`intersectNonBusinessDays`] 
| Merge `other` so non&hyphen;business days become the intersection of both&period;
| xref:BloombergLP/bdlt/PackedCalendar/isBusinessDay.adoc[`isBusinessDay`] 
| Return `true` if `date` is a business day in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/isHoliday.adoc[`isHoliday`] 
| Return `true` if `date` is a holiday in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/isInRange.adoc[`isInRange`] 
| Return `true` if `date` is within the valid range of this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/isNonBusinessDay.adoc[`isNonBusinessDay`] 
| Return `true` if `date` is not a business day in this calendar&period;
| 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&period;
| 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() &hyphen; firstDate() &plus; 1` otherwise&period;
| 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`&period;
| xref:BloombergLP/bdlt/PackedCalendar/numHolidayCodesTotal.adoc[`numHolidayCodesTotal`] 
| Return the total number of holiday codes in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/numHolidays.adoc[`numHolidays`] 
| Return the number of holiday dates in this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/numNonBusinessDays.adoc[`numNonBusinessDays`] 
| Return the number of non&hyphen;business days in this calendar&period;
| 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&period;
| xref:BloombergLP/bdlt/PackedCalendar/numWeekendDaysTransitions.adoc[`numWeekendDaysTransitions`] 
| Return the number of weekend&hyphen;days transitions maintained by this calendar&period;
| xref:BloombergLP/bdlt/PackedCalendar/print.adoc[`print`] 
| Format this object to the specified output `stream`&period;
| 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&hyphen;days transition&period;
| xref:BloombergLP/bdlt/PackedCalendar/removeAll.adoc[`removeAll`] 
| Remove all information from this calendar, leaving it empty&period;
| xref:BloombergLP/bdlt/PackedCalendar/removeHoliday.adoc[`removeHoliday`] 
| Remove the holiday at the specified `date` if it exists&period;
| xref:BloombergLP/bdlt/PackedCalendar/removeHolidayCode.adoc[`removeHolidayCode`] 
| Remove `holidayCode` from the holiday at the specified `date`&period;
| 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&hyphen;days transitions&period;
| xref:BloombergLP/bdlt/PackedCalendar/reserveHolidayCapacity.adoc[`reserveHolidayCapacity`] 
| Reserve enough space to store at least the specified `numHolidays` within this calendar&period; This method has no effect if `numHolidays &lt;&equals; numHolidays()`&period;
| xref:BloombergLP/bdlt/PackedCalendar/reserveHolidayCodeCapacity.adoc[`reserveHolidayCodeCapacity`] 
| Reserve capacity for at least the specified number of holiday codes&period;
| xref:BloombergLP/bdlt/PackedCalendar/setValidRange.adoc[`setValidRange`] 
| Set the valid range of this calendar to `&lsqb;firstDate &period;&period; lastDate&rsqb;`&period;
| xref:BloombergLP/bdlt/PackedCalendar/swap.adoc[`swap`] 
| Efficiently exchange the value of this object with that of `other`&period;
| xref:BloombergLP/bdlt/PackedCalendar/unionBusinessDays.adoc[`unionBusinessDays`] 
| Merge `other` so business days become the union of both calendars&period;
| xref:BloombergLP/bdlt/PackedCalendar/unionNonBusinessDays.adoc[`unionNonBusinessDays`] 
| Merge `other` so non&hyphen;business days become the union of both&period;
| xref:BloombergLP/bdlt/PackedCalendar/weekendDaysTransition-07.adoc[`weekendDaysTransition`] 
| Return the weekend&hyphen;days transition at the specified `index`&period;
|===


== 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`&period;
| `xref:BloombergLP/bdlt/operator_not_eq-07cb.adoc[BloombergLP::bdlt::operator!&equals;]`
| Return `true` if the specified `lhs` and `rhs` calendars differ&period;
| `xref:BloombergLP/bdlt/operator_eq-0d.adoc[BloombergLP::bdlt::operator&equals;&equals;]`
| Return `true` if the specified `lhs` and `rhs` calendars have the same value&period;
| `xref:BloombergLP/bdlt/PackedCalendar_BusinessDayConstIterator.adoc[BloombergLP::bdlt::PackedCalendar&lowbar;BusinessDayConstIterator]`
| Provide read&hyphen;only, sequential access in increasing (chronological) order to the business days in a `PackedCalendar` object&period;
|===

== 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&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
