This class implements a value‐semantic repository of time‐indexed state transitions over one date (this class implements one day of a timetable). A Timetable_Day can be "populated" with state transitions via the addTransition method, and queried for the transition code in effect at a specified time via the transitionCodeInEffect method. Note that, as an optimization for the transitionCodeInEffect method, the transition code in effect before the first possible transition is stored in d_initialTransitionCode.

Synopsis

Declared in <bdlt_timetable.h>

class Timetable_Day;

Enums

Member Functions

Name

Description

Timetable_Day [constructor]

Constructors

operator=

Assign to this object the value of the specified rhs daily timetable, and return a reference providing modifiable access to this object.

addTransition

Add a transition to this daily timetable at the specified time having the specified code. If time is already a transition point, replace the existing code with code. Return true if the value returned by finalTransitionCode() prior to this operation is not equal to the value returned by finalTransitionCode() after this operation, and false otherwise. The behavior is undefined unless 24 > time.hour() and 0 <= code || k_UNSET_TRANSITION_CODE == code.

finalTransitionCode

Return the transition code that is in effect at the end of this daily timetable. Note that if this daily timetable has no transitions, initialTransitionCode() is returned.

initialTransitionCode

Return the transition code in effect prior to the start of this daily timetable.

removeAllTransitions

Remove all transitions from this daily timetable. Return true if the value returned by finalTransitionCode() prior to this operation is not equal to the value returned by finalTransitionCode() after this operation, and false otherwise.

removeTransition

If a transition occurs at the specified time, remove the transition from this daily timetable. Otherwise, return without modifying this daily timetable. Return true if the value returned by finalTransitionCode() prior to this operation is not equal to the value returned by finalTransitionCode() after this operation, and false otherwise. The behavior is undefined unless 24 > time.hour().

setInitialTransitionCode

Set the transition code in effect prior to the start of this daily timetable to the specified code. Return true if the value returned by finalTransitionCode() prior to this operation is not equal to the value returned by finalTransitionCode() after this operation, and false otherwise. The behavior is undefined unless 0 <= code || k_UNSET_TRANSITION_CODE == code.

size

Return the number of transitions in this daily timetable.

transitionCodeInEffect

Return the transition code associated with the latest transition that occurs on or before the specified time in this daily timetable. If this daily timetable has no such transition, return initialTransitionCode(). The behavior is undefined unless 24 > time.hour().

Friends

Name

Description

BloombergLP::bdlt::hashAppend

Pass the specified object to the specified hashAlg. This function integrates with the bslh modular hashing system and effectively provides a bsl::hash specialization for Timetable_Day.

BloombergLP::bdlt::operator<

Return true if the specified lhs daily timetable is less than the specified rhs daily timetable, and false otherwise. The lhs daily timetable is less than the rhs daily timetable if lhs.initialTransitionCode() < rhs.initialTransitionCode(), or lhs.initialTransitionCode() == rhs.initialTransitionCode() and lhs.d_transitions < rhs.d_transitions.

BloombergLP::bdlt::operator!=

Return true if the specified lhs and rhs daily timetables do not have the same value, and false otherwise. Two daily timetables do not have the same value if they do not have the same initial transition code, they do not have the same number of transitions, or there is a corresponding pair of transitions that do not have the same value.

BloombergLP::bdlt::operator==

Return true if the specified lhs and rhs daily timetables have the same value, and false otherwise. Two daily timetables have the same value if they have the same initial transition code, the same number of transitions, and each corresponding pair of transitions has the same value.

BloombergLP::bdlt::Timetable_ConstIterator

Provide read‐only, sequential access in increasing (chronological) order to the transitions in a Timetable object.

Created with MrDocs