Model Railroad System
2.2.2
|
This class implements a train. More...
#include <Train.h>
Public Member Functions | |
Train (TimeTableSystem *timetable=NULL, string name="", string number="", int speed=0, int classnumber=0, int departure=0, int start=0, int end=-1) | |
Create and initialize a train object. More... | |
const char * | Name () const |
Return the name of the train. More... | |
const char * | Number () const |
Return the number (or symbol) of the train. More... | |
int | Departure () const |
Return the departure time. More... | |
void | SetDeparture (int depart) |
Update departure time. More... | |
int | Speed () const |
Return the train's speed. More... | |
int | ClassNumber () const |
Return the class number. More... | |
int | NumberOfNotes () const |
Number of notes. More... | |
int | Note (int i) const |
Return the ith note. More... | |
void | AddNoteToTrain (int note) |
Add a note. More... | |
void | RemoveNoteFromTrain (int note) |
Remove a note. More... | |
void | UpdateStopLayover (int istop, double layover) |
Update stop layover. More... | |
void | UpdateStopCab (int istop, Cab *cab) |
Update the cab. More... | |
void | AddNoteToStop (int istop, int note) |
Add a note to a stop. More... | |
void | RemoveNoteFromStop (int istop, int note) |
Remove a note from a stop. More... | |
void | SetOriginStorageTrack (string trackname) |
Set the origin storage track. More... | |
void | SetDestinationStorageTrack (string trackname) |
Set the destination storage track. More... | |
void | SetTransitStorageTrack (int istop, string trackname) |
Set an intermediate storage track. More... | |
int | NumberOfStops () const |
Return the number of stops. More... | |
const Stop * | StopI (int i) const |
Return the ith stop object. More... | |
double | StartSMile () const |
Return the start Scale Mile. 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 | |
string | name |
Name of the train. More... | |
string | number |
Number or symbol of the train;. More... | |
int | speed |
The train's speed. More... | |
int | classnumber |
The train's class. More... | |
vector< int > | notes |
Notes about the train. More... | |
int | departure |
Departure time. More... | |
StopVector | stops |
The train's stops. More... | |
double | startSMile |
Start scale mile. More... | |
This class implements a train.
A train travels down the track passing or stoping at stations along the way.
TTSupport::Train::Train | ( | TimeTableSystem * | timetable = NULL , |
string | name = "" , |
||
string | number = "" , |
||
int | speed = 0 , |
||
int | classnumber = 0 , |
||
int | departure = 0 , |
||
int | start = 0 , |
||
int | end = -1 |
||
) |
Create and initialize a train object.
timetable | The parent time table object. |
name | The name of the train. |
number | The number (or symbol) of the train. |
speed | The maximum (scale) speed of the train. |
classnumber | The class of the train. |
departure | The train's departure time. |
start | The originating station index. |
end | The terminating station index. |
void TTSupport::Train::AddNoteToStop | ( | int | istop, |
int | note | ||
) |
Add a note to a stop.
istop | The stop number to update. |
note | The note to add. |
|
inline |
|
inline |
Return the class number.
References classnumber.
|
inline |
Return the departure time.
References departure.
|
inline |
Return the name of the train.
References name.
|
inline |
|
inline |
Return the number (or symbol) of the train.
References number.
|
inline |
Number of notes.
References notes.
|
inline |
Return the number of stops.
References stops.
istream& TTSupport::Train::Read | ( | istream & | stream, |
const CabNameMap | cabs | ||
) |
Read an object from a stream.
stream | Stream to read from. |
cabs | The cab name map. |
void TTSupport::Train::RemoveNoteFromStop | ( | int | istop, |
int | note | ||
) |
Remove a note from a stop.
istop | The stop number to update. |
note | The note to remove. |
|
inline |
|
inline |
void TTSupport::Train::SetDestinationStorageTrack | ( | string | trackname | ) |
Set the destination storage track.
trackname | The terminating storage track name. |
void TTSupport::Train::SetOriginStorageTrack | ( | string | trackname | ) |
Set the origin storage track.
trackname | The originating storage track name. |
void TTSupport::Train::SetTransitStorageTrack | ( | int | istop, |
string | trackname | ||
) |
Set an intermediate storage track.
istop | The stop index. |
trackname | The intermediate storage track name. |
|
inline |
Return the train's speed.
References speed.
|
inline |
Return the start Scale Mile.
References startSMile.
|
inline |
void TTSupport::Train::UpdateStopCab | ( | int | istop, |
Cab * | cab | ||
) |
Update the cab.
istop | The stop number to update. |
cab | The new cab. |
void TTSupport::Train::UpdateStopLayover | ( | int | istop, |
double | layover | ||
) |
Update stop layover.
istop | The stop number to update. |
layover | The new layover time. |
ostream& TTSupport::Train::Write | ( | ostream & | stream | ) | const |
Write object to a stream.
stream | Stream to write to. |
|
private |
The train's class.
Referenced by ClassNumber().
|
private |
Departure time.
Referenced by Departure(), and SetDeparture().
|
private |
Name of the train.
Referenced by Name().
|
private |
Notes about the train.
Referenced by AddNoteToTrain(), Note(), NumberOfNotes(), and RemoveNoteFromTrain().
|
private |
Number or symbol of the train;.
Referenced by Number().
|
private |
The train's speed.
Referenced by Speed().
|
private |
Start scale mile.
Referenced by StartSMile().
|
private |
The train's stops.
Referenced by NumberOfStops(), and StopI().