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

This class records a train sitting on a storage track during a specified time frame. More...

#include <Station.h>

Public Member Functions

 Occupied (string trainnum_="", double from_=0.0, double until_=0.0, string trainnum2_="")
 Constructor: record a train occupying a storage track. More...
 
const char * TrainNum () const
 Return the train that arrives. More...
 
const char * TrainNum2 () const
 Return the train that departs. More...
 
double From () const
 Return the start time;. More...
 
double Until () const
 Return the end time. More...
 
 Occupied (const Occupied &other)
 Copy constructor – create an instance from another Occupied instance. More...
 
Occupiedoperator= (const Occupied &other)
 Assignment operator. 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

string trainnum
 The train that arrived. More...
 
string trainnum2
 The train that departs. More...
 
double from
 The start time of the occupation. More...
 
double until
 The end time of the occupation. More...
 

Friends

class TimeTableSystem
 We are best buddies with the TimeTableSystem class. More...
 

Detailed Description

This class records a train sitting on a storage track during a specified time frame.

The train number (symbol) might change when the train leaves the storage track.

Author
Robert Heller <heller@deepsoft.com>

Constructor & Destructor Documentation

◆ Occupied() [1/2]

TTSupport::Occupied::Occupied ( string  trainnum_ = "",
double  from_ = 0.0,
double  until_ = 0.0,
string  trainnum2_ = "" 
)
inline

Constructor: record a train occupying a storage track.

Parameters
trainnum_The arriving train number (symbol).
from_The arrival time.
until_The departure time.
trainnum2_The departing train number (symbol). If it is the empty string, the departing train has the same number (symbol) as the arriving train.

References from, trainnum, trainnum2, and until.

◆ Occupied() [2/2]

TTSupport::Occupied::Occupied ( const Occupied other)
inline

Copy constructor – create an instance from another Occupied instance.

Parameters
otherThe other instance.

References from, trainnum, trainnum2, and until.

Member Function Documentation

◆ From()

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

Return the start time;.

References from.

◆ operator=()

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

Assignment operator.

Assign an Occupied instance to another Occupied instance.

Parameters
otherThe other instance.

References from, trainnum, trainnum2, and until.

◆ Read()

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

Read ourselves from an input stream.

Parameters
streamThe stream to read from.

Referenced by TTSupport::Station::LastStorageTrack(), TTSupport::TimeRange::operator=(), and TTSupport::StorageTrack::operator=().

◆ TrainNum()

const char* TTSupport::Occupied::TrainNum ( ) const
inline

Return the train that arrives.

References trainnum.

◆ TrainNum2()

const char* TTSupport::Occupied::TrainNum2 ( ) const
inline

Return the train that departs.

References trainnum2.

◆ Until()

double TTSupport::Occupied::Until ( ) const
inline

Return the end time.

References until.

◆ Write()

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

Write ourselves to an output stream.

Parameters
streamThe stream to write to.

Referenced by TTSupport::Station::LastStorageTrack(), TTSupport::TimeRange::operator=(), and TTSupport::StorageTrack::operator=().

Friends And Related Function Documentation

◆ TimeTableSystem

friend class TimeTableSystem
friend

We are best buddies with the TimeTableSystem class.

Member Data Documentation

◆ from

double TTSupport::Occupied::from
private

◆ trainnum

string TTSupport::Occupied::trainnum
private

The train that arrived.

Referenced by Occupied(), operator=(), and TrainNum().

◆ trainnum2

string TTSupport::Occupied::trainnum2
private

The train that departs.

Referenced by Occupied(), operator=(), and TrainNum2().

◆ until

double TTSupport::Occupied::until
private

The end time of the occupation.

Referenced by Occupied(), operator=(), and Until().