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

The Station class implements a station. More...

#include <Station.h>

Public Member Functions

 Station (string name_="Unknown", double smile_=0)
 Construct a station object, given a name and a scale mile location. More...
 
 Station (const Station &other)
 Copy constructor. More...
 
Stationoperator= (const Station &other)
 Assignment operator. More...
 
 ~Station ()
 Destructor. More...
 
const char * Name () const
 Return the name of the station. More...
 
double SMile () const
 Return the scale mile of the station. More...
 
int DuplicateStationIndex () const
 Return the duplicate station index. More...
 
void SetDuplicateStationIndex (int index)
 Set the duplication station index. More...
 
StorageTrackAddStorageTrack (string name_)
 Add a storage track. More...
 
StorageTrackFindStorageTrack (string name)
 Find a storage track by name. More...
 
StorageTrackFindTrackTrainIsStoredOn (string trainNumber, double fromtime, double totime)
 Find track a train is stored on. More...
 
int NumberOfStorageTracks () const
 Number of storage tracks. More...
 
StorageTrackMap::const_iterator FirstStorageTrack () const
 Return a const_iterator for the first element in the storage track map. More...
 
StorageTrackMap::const_iterator LastStorageTrack () const
 Return a const_iterator for the last element in the storage track map. More...
 
ostream & Write (ostream &stream) const
 Write object to a stream. More...
 
istream & Read (istream &stream)
 Read an object from a stream. More...
 

Private Attributes

string name
 Station name. More...
 
StorageTrackMap storageTracks
 Storage track map. More...
 
double smile
 Scale Mile. More...
 
int duplicateStationIndex
 Duplicate station index. More...
 

Detailed Description

The Station class implements a station.

Stations are not specifically passenger stations, but are any place where trains stop or meet or might just be important mile post locations used for time keeping checks. They also can be just sidings.

Author
Robert Heller <heller@deepsoft.com>

Constructor & Destructor Documentation

◆ Station() [1/2]

TTSupport::Station::Station ( string  name_ = "Unknown",
double  smile_ = 0 
)
inline

Construct a station object, given a name and a scale mile location.

Parameters
name_The name of the station.
smile_The scale mile location of the station.

References duplicateStationIndex, name, and smile.

◆ Station() [2/2]

TTSupport::Station::Station ( const Station other)
inline

Copy constructor.

Copy one station to another.

Parameters
otherThe other station.

References duplicateStationIndex, name, smile, and storageTracks.

◆ ~Station()

TTSupport::Station::~Station ( )
inline

Destructor.

Member Function Documentation

◆ AddStorageTrack()

StorageTrack* TTSupport::Station::AddStorageTrack ( string  name_)

Add a storage track.

Parameters
name_The name of the storage track.

◆ DuplicateStationIndex()

int TTSupport::Station::DuplicateStationIndex ( ) const
inline

Return the duplicate station index.

This is the index of another station that is the physical duplicate of this one. Only meaningful on out-and-back type layouts or other layout configurations where stations are logically duplicated due to trackage having dual meaning.

References duplicateStationIndex.

◆ FindStorageTrack()

StorageTrack* TTSupport::Station::FindStorageTrack ( string  name)
inline

Find a storage track by name.

Parameters
nameThe name of the storage track.

References name, and storageTracks.

◆ FindTrackTrainIsStoredOn()

StorageTrack* TTSupport::Station::FindTrackTrainIsStoredOn ( string  trainNumber,
double  fromtime,
double  totime 
)

Find track a train is stored on.

Parameters
trainNumberThe train number (symbol) to search for.
fromtimeThe from time to check.
totimeThe to time to check.

◆ FirstStorageTrack()

StorageTrackMap::const_iterator TTSupport::Station::FirstStorageTrack ( ) const
inline

Return a const_iterator for the first element in the storage track map.

References storageTracks.

◆ LastStorageTrack()

StorageTrackMap::const_iterator TTSupport::Station::LastStorageTrack ( ) const
inline

Return a const_iterator for the last element in the storage track map.

References storageTracks.

◆ Name()

const char* TTSupport::Station::Name ( ) const
inline

Return the name of the station.

References name.

◆ NumberOfStorageTracks()

int TTSupport::Station::NumberOfStorageTracks ( ) const
inline

Number of storage tracks.

◆ operator=()

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

Assignment operator.

Assign one station to another.

Parameters
otherThe other station.

References duplicateStationIndex, name, smile, and storageTracks.

◆ Read()

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

Read an object from a stream.

Parameters
streamStream to read from.

◆ SetDuplicateStationIndex()

void TTSupport::Station::SetDuplicateStationIndex ( int  index)
inline

Set the duplication station index.

Parameters
indexThe index of the duplicate station.

References duplicateStationIndex.

◆ SMile()

double TTSupport::Station::SMile ( ) const
inline

Return the scale mile of the station.

References smile.

◆ Write()

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

Write object to a stream.

Parameters
streamStream to write to.

Member Data Documentation

◆ duplicateStationIndex

int TTSupport::Station::duplicateStationIndex
private

Duplicate station index.

Referenced by DuplicateStationIndex(), operator=(), SetDuplicateStationIndex(), and Station().

◆ name

string TTSupport::Station::name
private

Station name.

Referenced by FindStorageTrack(), Name(), operator=(), and Station().

◆ smile

double TTSupport::Station::smile
private

Scale Mile.

Referenced by operator=(), SMile(), and Station().

◆ storageTracks

StorageTrackMap TTSupport::Station::storageTracks
private