Model Railroad System  2.2.1
Public Member Functions | Private Attributes | List of all members
TTSupport::TimeRange Class Reference

The TimeRange class implements a range of times. More...

#include <Station.h>

Public Member Functions

 TimeRange (double from_=0.0, double to_=0.0)
 Construct a time range, from a start and end time. More...
 
double From () const
 Return the low end of the range. More...
 
double To () const
 Return the high end of the range. More...
 
bool ContainsTime (double time) const
 Does this interval contain the specified time? More...
 
bool operator< (const TimeRange &other) const
 Less than operator. More...
 
bool operator> (const TimeRange &other) const
 Greater than operator. More...
 
bool operator== (const TimeRange &other) const
 Equality to operator. More...
 
bool operator<= (const TimeRange &other) const
 Less than or equal operator. More...
 
bool operator>= (const TimeRange &other) const
 Greater than or equal operator. More...
 
 TimeRange (const TimeRange &other)
 Copy constructor: create a clone of a TimeRange. More...
 
TimeRangeoperator= (const TimeRange &other)
 Assign a TimeRange to another TimeRange. More...
 
ostream & Write (ostream &stream) const
 Write ourselves to an output stream. More...
 
istream & Read (istream &stream)
 Read ourselves from an input stream. More...
 

Private Attributes

double from
 Start time. More...
 
double to
 End time. More...
 

Detailed Description

The TimeRange class implements a range of times.

Author
Robert Heller <heller@deepsoft.com>

Constructor & Destructor Documentation

◆ TimeRange() [1/2]

TTSupport::TimeRange::TimeRange ( double  from_ = 0.0,
double  to_ = 0.0 
)
inline

Construct a time range, from a start and end time.

Parameters
from_The start time.
to_The end time.

References from, and to.

◆ TimeRange() [2/2]

TTSupport::TimeRange::TimeRange ( const TimeRange other)
inline

Copy constructor: create a clone of a TimeRange.

Parameters
otherThe other TimeRange object.

References from, and to.

Member Function Documentation

◆ ContainsTime()

bool TTSupport::TimeRange::ContainsTime ( double  time) const
inline

Does this interval contain the specified time?

Parameters
timeThe time to check for.

References from, and to.

◆ From()

double TTSupport::TimeRange::From ( ) const
inline

Return the low end of the range.

References from.

◆ operator<()

bool TTSupport::TimeRange::operator< ( const TimeRange other) const
inline

Less than operator.

Parameters
otherThe time range to compare to.

References from, and to.

◆ operator<=()

bool TTSupport::TimeRange::operator<= ( const TimeRange other) const
inline

Less than or equal operator.

Parameters
otherThe time range to compare to.

◆ operator=()

TimeRange& TTSupport::TimeRange::operator= ( const TimeRange other)
inline

Assign a TimeRange to another TimeRange.

Parameters
otherThe other TimeRange object.

References from, and to.

◆ operator==()

bool TTSupport::TimeRange::operator== ( const TimeRange other) const
inline

Equality to operator.

Parameters
otherThe time range to compare to.

References from, and to.

◆ operator>()

bool TTSupport::TimeRange::operator> ( const TimeRange other) const
inline

Greater than operator.

Parameters
otherThe time range to compare to.

References from, and to.

◆ operator>=()

bool TTSupport::TimeRange::operator>= ( const TimeRange other) const
inline

Greater than or equal operator.

Parameters
otherThe time range to compare to.

◆ Read()

istream& TTSupport::TimeRange::Read ( istream &  stream)

Read ourselves from an input stream.

Parameters
streamThe stream to read from.

◆ To()

double TTSupport::TimeRange::To ( ) const
inline

Return the high end of the range.

References to.

◆ Write()

ostream& TTSupport::TimeRange::Write ( ostream &  stream) const

Write ourselves to an output stream.

Parameters
streamThe stream to write to.

Member Data Documentation

◆ from

double TTSupport::TimeRange::from
private

◆ to

double TTSupport::TimeRange::to
private