Model Railroad System 2.2.2
Public Types | Public Member Functions | Private Attributes | List of all members
TTSupport::Stop Class Reference

This class implements a stop. More...

#include <Train.h>

Public Types

enum  FlagType { Origin , Terminate , Transit }
 Type of stop. More...
 

Public Member Functions

 Stop (int stationindex_=0, FlagType flag_=Origin)
 Constructor: create a new stop. More...
 
 Stop (const Stop &other)
 Copy constructor, create a stop from another stop. More...
 
Stopoperator= (const Stop &other)
 Assignment operator, assign one stop to another stop. More...
 
 ~Stop ()
 Destructor. More...
 
double Layover () const
 Return layover period. More...
 
void SetLayover (double period)
 Update layover period. More...
 
double Departure (double arrival) const
 Return departure time. More...
 
int StationIndex () const
 Return the station index. More...
 
CabTheCab () const
 Return the cab. More...
 
void SetCab (Cab *newcab)
 Update the cab. More...
 
int NumberOfNotes () const
 Return the number of notes. More...
 
int Note (int i) const
 Return the ith note. More...
 
void AddNote (int note)
 Add a note. More...
 
void RemoveNote (int note)
 Remove note. More...
 
FlagType Flag () const
 Return the flag. More...
 
const char * StorageTrackName () const
 Return storage track name. More...
 
void SetStorageTrackName (string name)
 Update storage track name. More...
 
ostream & Write (ostream &stream) const
 Write object to a stream. More...
 
istream & Read (istream &stream, const CabNameMap cabs)
 Read an object from a stream. More...
 

Private Attributes

double layover
 The layover time. More...
 
int stationindex
 The station index. More...
 
Cabcab
 The Cab object. More...
 
vector< int > notes
 The vector of note numbers. More...
 
FlagType flag
 The type of stop, originating, terminating, or passing through. More...
 
string storageTrackName
 The storage track name. More...
 

Detailed Description

This class implements a stop.

This specifies the station the train goes through, even if it does not actually stop. A layover of 0 means the train does not stop and this station is a timekeeping check point.

Author
Robert Heller <heller@deepsoft.com>

Member Enumeration Documentation

◆ FlagType

Type of stop.


Origin for originating trains, Terminate for terminating trains, and Transit for trains passing through.

Enumerator
Origin 
Terminate 
Transit 

Constructor & Destructor Documentation

◆ Stop() [1/2]

TTSupport::Stop::Stop ( int  stationindex_ = 0,
FlagType  flag_ = Origin 
)
inline

Constructor: create a new stop.

Parameters
stationindex_The index of the station.
flag_The type of stop (originating, terminating, or passing through).

References cab, flag, layover, stationindex, and storageTrackName.

◆ Stop() [2/2]

TTSupport::Stop::Stop ( const Stop other)
inline

Copy constructor, create a stop from another stop.

Parameters
otherThe other stop.

References cab, flag, layover, notes, stationindex, and storageTrackName.

◆ ~Stop()

TTSupport::Stop::~Stop ( )
inline

Destructor.

Member Function Documentation

◆ AddNote()

void TTSupport::Stop::AddNote ( int  note)
inline

Add a note.

Parameters
noteThe note number.

References i, and notes.

◆ Departure()

double TTSupport::Stop::Departure ( double  arrival) const
inline

Return departure time.


This is just the layover period added to the arrival time.

Parameters
arrivalThe arrival time.

References layover.

◆ Flag()

FlagType TTSupport::Stop::Flag ( ) const
inline

Return the flag.

References flag.

◆ Layover()

double TTSupport::Stop::Layover ( ) const
inline

Return layover period.

References layover.

◆ Note()

int TTSupport::Stop::Note ( int  i) const
inline

Return the ith note.

Returns -1 if the index is out of range.

Parameters
iThe index of the note.

References i, and notes.

◆ NumberOfNotes()

int TTSupport::Stop::NumberOfNotes ( ) const
inline

Return the number of notes.

References notes.

◆ operator=()

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

Assignment operator, assign one stop to another stop.

Parameters
otherThe other stop.

References cab, flag, layover, notes, stationindex, and storageTrackName.

◆ Read()

istream & TTSupport::Stop::Read ( istream &  stream,
const CabNameMap  cabs 
)

Read an object from a stream.

Parameters
streamStream to read from.
cabsMap of cab names.

◆ RemoveNote()

void TTSupport::Stop::RemoveNote ( int  note)
inline

Remove note.

Parameters
noteThe note number to remove.

References notes.

◆ SetCab()

void TTSupport::Stop::SetCab ( Cab newcab)
inline

Update the cab.

Parameters
newcabThe new cab value.

References cab.

◆ SetLayover()

void TTSupport::Stop::SetLayover ( double  period)
inline

Update layover period.

Parameters
periodNew layover period.

References layover.

◆ SetStorageTrackName()

void TTSupport::Stop::SetStorageTrackName ( string  name)
inline

Update storage track name.

Parameters
nameThe name of the storage track.

References storageTrackName.

◆ StationIndex()

int TTSupport::Stop::StationIndex ( ) const
inline

Return the station index.

References stationindex.

◆ StorageTrackName()

const char * TTSupport::Stop::StorageTrackName ( ) const
inline

Return storage track name.

References storageTrackName.

◆ TheCab()

Cab * TTSupport::Stop::TheCab ( ) const
inline

Return the cab.

References cab.

◆ Write()

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

Write object to a stream.

Parameters
streamStream to write to.

Member Data Documentation

◆ cab

Cab* TTSupport::Stop::cab
private

The Cab object.

Referenced by operator=(), SetCab(), Stop(), and TheCab().

◆ flag

FlagType TTSupport::Stop::flag
private

The type of stop, originating, terminating, or passing through.

Referenced by Flag(), operator=(), and Stop().

◆ layover

double TTSupport::Stop::layover
private

The layover time.

Referenced by Departure(), Layover(), operator=(), SetLayover(), and Stop().

◆ notes

vector<int> TTSupport::Stop::notes
private

The vector of note numbers.

Referenced by AddNote(), Note(), NumberOfNotes(), operator=(), RemoveNote(), and Stop().

◆ stationindex

int TTSupport::Stop::stationindex
private

The station index.

Referenced by operator=(), StationIndex(), and Stop().

◆ storageTrackName

string TTSupport::Stop::storageTrackName
private

The storage track name.

Referenced by operator=(), SetStorageTrackName(), Stop(), and StorageTrackName().