OSB_LIB::Period Class Reference

Collaboration diagram for OSB_LIB::Period:

Collaboration graph
[legend]
List of all members.

Detailed Description

A time period, with a lower and upper boundary.

The lower boundary is included in the period, the upper boundary is not included.
With only one date, the period is treated as a timestamp.

The function less() is designed to satisfy the definition of strict weak ordering as used by std::map.
See also Period::Less.

Definition at line 68 of file period.h.

Public Member Functions

Accessors

Static Public Member Functions

Private Attributes

Classes


Constructor & Destructor Documentation

OSB_LIB::Period::Period ( const DateTime ts = DateTime()  )  [inline, explicit]

Construct as timestamp and default constructor.

If used as default constructor, the boundaries are not set.

Definition at line 229 of file period.h.

Referenced by infinite().

OSB_LIB::Period::Period ( const DateTime from,
const DateTime to 
)

Constructor taking the period boundaries.

Parameters:
from Lower boundary of the period.
If not set DateTime::min() is used.
to Upper boundary of the period.
If not set DateTime::max() is used.


Member Function Documentation

bool OSB_LIB::Period::contains ( const DateTime ts  )  const [inline]

Check if a given timestamp is within this period.

Returns:
false if ts is not set,
false if the period is a timestamp,
true if the period contains ts:
from_ <= ts && ts < to_
.

Definition at line 251 of file period.h.

References from_, isTs_, OSB_LIB::DateTime::max(), OSB_LIB::DateTime::min(), OSB_LIB::DateTime::notSet(), and to_.

Referenced by overlap().

DateTime OSB_LIB::Period::from (  )  const [inline]

Return the lower boundary of the period.

Definition at line 236 of file period.h.

References from_.

Referenced by OSB_LIB::PersProductCache::Key::mkAssignPeriod().

Period OSB_LIB::Period::infinite (  )  [inline, static]

Named constructor: create an infinite period.

An infinite period contains all timestamps (except the ones that are not set).

Definition at line 223 of file period.h.

References OSB_LIB::DateTime::max(), OSB_LIB::DateTime::min(), and Period().

bool OSB_LIB::Period::isTimestamp (  )  const [inline]

True if this period represents a timestamp.

Definition at line 246 of file period.h.

References isTs_.

Referenced by OSB_LIB::PersProductCache::Key::mkAssignPeriod().

bool OSB_LIB::Period::less ( const Period rhs  )  const [inline]

Less comparison.

Exceptions:
Overlap if the compared periods overlap,
see also overlap().
Rules:

The above rules are designed such that if a timestamp is within a period the function returns false, i.e., the timestamp is not less than the period.

Definition at line 272 of file period.h.

References from_, isTs_, overlap(), and to_.

Referenced by OSB_LIB::Period::Less::operator()(), and OSB_LIB::PersProductCache::Key::operator<().

bool OSB_LIB::Period::overlap ( const Period rhs  )  const [inline]

Check if two periods overlap.

Returns:
Two period overlap if the start date of either period is contained in the other period.
false if either Period is a timestamp.

Definition at line 265 of file period.h.

References contains(), from_, and isTs_.

Referenced by less().

DateTime OSB_LIB::Period::to (  )  const [inline]

Return the upper boundary of the period.

Definition at line 241 of file period.h.

References to_.

Referenced by OSB_LIB::PersProductCache::Key::mkAssignPeriod().


Member Data Documentation

DateTime OSB_LIB::Period::from_ [private]

Lower boundary of the time period.

Definition at line 178 of file period.h.

Referenced by contains(), from(), less(), and overlap().

bool OSB_LIB::Period::isTs_ [private]

Flag to show if the period represents a timestamp.

Definition at line 182 of file period.h.

Referenced by contains(), isTimestamp(), less(), and overlap().

DateTime OSB_LIB::Period::to_ [private]

Upper boundary of the time period.

Definition at line 180 of file period.h.

Referenced by contains(), less(), and to().


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:12:27 2006 for OSB Library by  doxygen 1.4.7