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

This class implements a value&hyphen;semantic repository of datetime&hyphen;indexed state transitions over a _valid_ _range_ of dates&period; This valid range, `&lsqb;firstDate() &period;&period; lastDate()&rsqb;`, spans the first and last dates of a timetable&apos;s accessible contents&period; A timetable can be &quot;populated&quot; with state transitions via a suite of &quot;add&quot; methods&period; Note that the behavior of requesting _any_ timetable information for a supplied date whose value is outside the current _valid_ _range_ for that timetable is undefined&period;

== Synopsis

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

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

== Type Aliases

[cols="1"]
|===
| Name
| xref:BloombergLP/bdlt/Timetable/const_iterator.adoc[`const&lowbar;iterator`] 
|===


== Enums

[cols="1"]
|===
| Name
| xref:BloombergLP/bdlt/Timetable/_04enum.adoc[`Unnamed enum`] 
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/Timetable/2constructor-046.adoc[`Timetable`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlt/Timetable/operator_assign.adoc[`operator&equals;`] 
| Assign to this timetable the value of the specified `rhs` timetable, and return a reference providing modifiable access to this timetable&period; This operation invalidates all iterators&period;
| xref:BloombergLP/bdlt/Timetable/addTransition-06.adoc[`addTransition`] 
| `addTransition` overloads
| xref:BloombergLP/bdlt/Timetable/addTransitions.adoc[`addTransitions`] 
| Add transitions to this timetable that occur at the specified `time`, having the specified `code`, on all dates that are of the specified `dayOfWeek` within the closed interval of dates from the specified `firstDate` to the specified `lastDate`&period; For every date on which this transition will occur, if `time` is already a transition point, replace the existing code with `code`&period; The addition of a transition, but not the replacement of the code of an existing transition, invalidates all iterators&period; The behavior is undefined unless `24 &gt; time&period;hour()`, `firstDate &lt;&equals; lastDate`, `firstDate` and `lastDate` are within the valid range of this timetable, and `0 &lt;&equals; code &verbar;&verbar; k&lowbar;UNSET&lowbar;TRANSITION&lowbar;CODE &equals;&equals; code`&period;
| xref:BloombergLP/bdlt/Timetable/allocator.adoc[`allocator`] 
| Return the allocator used by this object to supply memory&period;
| xref:BloombergLP/bdlt/Timetable/begin.adoc[`begin`] 
| Return an iterator referring to the first transition in this timetable, or the past&hyphen;the&hyphen;end iterator if this timetable is empty&period; The iterator remains valid as long as this timetable exists, and the number of transitions within this timetable does not change&period;
| xref:BloombergLP/bdlt/Timetable/end.adoc[`end`] 
| Return the past&hyphen;the&hyphen;end iterator for this timetable&period; The iterator remains valid as long as this timetable exists, and the number of transitions within this timetable does not change&period;
| xref:BloombergLP/bdlt/Timetable/firstDate.adoc[`firstDate`] 
| Return a `const` reference to the earliest date in the valid range of this timetable&period; The behavior is undefined if this timetable does not have a valid range (i&period;e&period;, it is in the default constructed (empty) state)&period;
| xref:BloombergLP/bdlt/Timetable/initialTransitionCode.adoc[`initialTransitionCode`] 
| Return the transition code that is in effect at the start of this timetable (see `setInitialTransitionCode`)&period;
| xref:BloombergLP/bdlt/Timetable/isInRange.adoc[`isInRange`] 
| Return `true` if the specified `date` is within the valid range of this timetable, and `false` otherwise&period;
| xref:BloombergLP/bdlt/Timetable/lastDate.adoc[`lastDate`] 
| Return a `const` reference to the latest date in the valid range of this timetable&period; The behavior is undefined if this timetable does not have a valid range (i&period;e&period;, it is in the default constructed (empty) state)&period;
| xref:BloombergLP/bdlt/Timetable/length.adoc[`length`] 
| Return the number of days in the valid range of this timetable, which is defined to be 0 if this timetable is empty, and `lastDate() &hyphen; firstDate() &plus; 1` otherwise&period;
| xref:BloombergLP/bdlt/Timetable/print.adoc[`print`] 
| Format this object to the specified output `stream` at the (absolute value of) the optionally specified indentation `level` and return a reference to the modifiable `stream`&period; If `level` is specified, optionally specify `spacesPerLevel`, the number of spaces per indentation level for this and all of its nested objects&period; If `level` is negative, suppress indentation of the first line&period; If `spacesPerLevel` is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by `level`)&period; If `stream` is not valid on entry, this operation has no effect&period;
| xref:BloombergLP/bdlt/Timetable/removeAllTransitions.adoc[`removeAllTransitions`] 
| Remove all transitions from this timetable&period; The removal of a transition invalidates all iterators&period;
| xref:BloombergLP/bdlt/Timetable/removeTransition-0b.adoc[`removeTransition`] 
| `removeTransition` overloads
| xref:BloombergLP/bdlt/Timetable/removeTransitions-09.adoc[`removeTransitions`] 
| `removeTransitions` overloads
| xref:BloombergLP/bdlt/Timetable/reset.adoc[`reset`] 
| Reset this timetable to the default constructed (empty) state&period; All associated iterators are invalidated&period;
| xref:BloombergLP/bdlt/Timetable/setInitialTransitionCode.adoc[`setInitialTransitionCode`] 
| Set the transition code in effect at the start of this timetable to the specified `code`&period; The behavior is undefined unless `0 &lt;&equals; code &verbar;&verbar; k&lowbar;UNSET&lowbar;TRANSITION&lowbar;CODE &equals;&equals; code`&period;
| xref:BloombergLP/bdlt/Timetable/setValidRange.adoc[`setValidRange`] 
| Set the range of this timetable using the specified `firstDate` and `lastDate` as, respectively, the first date and the last date of the timetable&period; Any transitions, and associated transition codes, that are outside of the new range are removed&period; The removal of a transition invalidates all iterators&period; The behavior is undefined unless `firstDate &lt;&equals; lastDate`&period;
| xref:BloombergLP/bdlt/Timetable/swap.adoc[`swap`] 
| Efficiently exchange the value of this object with the value of the specified `other` object&period; This method provides the no&hyphen;throw exception&hyphen;safety guarantee&period; The behavior is undefined unless this object was created with the same allocator as `other`&period;
| xref:BloombergLP/bdlt/Timetable/transitionCodeInEffect-091.adoc[`transitionCodeInEffect`] 
| `transitionCodeInEffect` overloads
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bdlt/hashAppend-000.adoc[BloombergLP::bdlt::hashAppend]`
| Pass the specified `object` to the specified `hashAlg`&period; This function integrates with the `bslh` modular hashing system and effectively provides a `bsl&colon;&colon;hash` specialization for `Timetable`&period;
| `xref:BloombergLP/bdlt/operator_not_eq-079.adoc[BloombergLP::bdlt::operator!&equals;]`
| Return `true` if the specified `lhs` and `rhs` timetables do not have the same value, and `false` otherwise&period; Two timetables do not have the same value if they do not have the same initial transition code, do not have the same valid range (and are not both empty), do not have the same number of transitions, or, for at least one corresponding pair of transitions, do not have the same value&period;
| `xref:BloombergLP/bdlt/operator_eq-08bb.adoc[BloombergLP::bdlt::operator&equals;&equals;]`
| Return `true` if the specified `lhs` and `rhs` timetables have the same value, and `false` otherwise&period; Two timetables have the same value if they have the same initial transition code, the same valid range (or are both empty), the same number of transitions, and each corresponding pair of transitions have the same value&period;
| `xref:BloombergLP/bdlt/Timetable_ConstIterator.adoc[BloombergLP::bdlt::Timetable&lowbar;ConstIterator]`
| Provide read&hyphen;only, sequential access in increasing (chronological) order to the transitions in a `Timetable` object&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlt/swap-0f.adoc[`swap`]
| Exchange the values of the specified `a` and `b` objects&period; This function provides the no&hyphen;throw exception&hyphen;safety guarantee if the two objects were created with the same allocator and the basic guarantee otherwise&period;
|===


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