Model Railroad System
2.2.2
|
The StorageTrack class implements a storage track. More...
#include <Station.h>
Public Member Functions | |
StorageTrack (string name_="Track 0") | |
Construct a storage track. More... | |
~StorageTrack () | |
Destructor. More... | |
const char * | Name () const |
Return the name of the storage track. More... | |
void | SetName (string name_) |
Set the storage track's name. More... | |
const Occupied * | IncludesTime (double time) const |
Return the occupation that includes the specified time;. More... | |
const Occupied * | StoreTrain (string train, double from, double to, string train2) |
Insert train onto storage track for a time. More... | |
bool | RemovedStoredTrain (double from, double to) |
Remove stored train. More... | |
bool | UsedTimeRange (double from, double to) const |
Return true if the time range is in use. More... | |
const Occupied * | FindOccupied (double from, double to) const |
Return occupication structure for a given time tange. More... | |
const Occupied * | UpdateStoredTrain (double from, double to, string train) |
Replace a stored arrrival train. More... | |
const Occupied * | UpdateStoredTrain2 (double from, double to, string train) |
Replace a stored departure train. More... | |
const Occupied * | UpdateStoredTrainArrival (double from, double to, double newArrival) |
Update a train's arrival time. More... | |
const Occupied * | UpdateStoredTrainDeparture (double from, double to, double newDeparture) |
Update a train's departure time. More... | |
StorageTrack (const StorageTrack &other) | |
Clone a StorageTrack – copy constructor. More... | |
StorageTrack & | operator= (const StorageTrack &other) |
Assign a StorageTrack to another StorageTrack. More... | |
ostream & | Write (ostream &stream) const |
Write method. More... | |
istream & | Read (istream &stream) |
Read Method. More... | |
OccupiedMap::const_iterator | FirstOccupied () const |
Return a const iterator for the first occupation. More... | |
OccupiedMap::const_iterator | LastOccupied () const |
Return a const iterator for the last occupation. More... | |
Private Attributes | |
string | name |
Name of the storage track. More... | |
OccupiedMap | occupations |
Map of occupations. More... | |
The StorageTrack class implements a storage track.
Storage tracks store trains at stations. Each storage track can only store one train at a given time. No checks are made to determing if the track is actually long enough for the train.
Each storage track has a name.
|
inline |
Construct a storage track.
The name of the track is initialized.
name_ | The name of the storage track. |
References name.
|
inline |
Destructor.
|
inline |
Clone a StorageTrack – copy constructor.
other | The other StorageTrack. |
References name, and occupations.
|
inline |
Return occupication structure for a given time tange.
from | The arrival time. |
to | The departure time. |
References occupations.
|
inline |
Return a const iterator for the first occupation.
References occupations.
const Occupied* TTSupport::StorageTrack::IncludesTime | ( | double | time | ) | const |
Return the occupation that includes the specified time;.
time | The time to check for. |
|
inline |
Return a const iterator for the last occupation.
References occupations.
|
inline |
Return the name of the storage track.
References name.
|
inline |
Assign a StorageTrack to another StorageTrack.
other | The other StorageTrack. |
References name, and occupations.
istream& TTSupport::StorageTrack::Read | ( | istream & | stream | ) |
Read Method.
Read object from a stream.
stream | Stream to read from. |
bool TTSupport::StorageTrack::RemovedStoredTrain | ( | double | from, |
double | to | ||
) |
Remove stored train.
from | The arrival time. |
to | The departure time. |
|
inline |
const Occupied* TTSupport::StorageTrack::StoreTrain | ( | string | train, |
double | from, | ||
double | to, | ||
string | train2 | ||
) |
Insert train onto storage track for a time.
train | The arriving train. |
from | The arrival time. |
to | The departure time. |
train2 | The departing train. |
const Occupied* TTSupport::StorageTrack::UpdateStoredTrain | ( | double | from, |
double | to, | ||
string | train | ||
) |
Replace a stored arrrival train.
from | The arrival time. |
to | The departure time. |
train | The new arriving train. |
const Occupied* TTSupport::StorageTrack::UpdateStoredTrain2 | ( | double | from, |
double | to, | ||
string | train | ||
) |
Replace a stored departure train.
from | The arrival time. |
to | The departure time. |
train | The new departing train. |
const Occupied* TTSupport::StorageTrack::UpdateStoredTrainArrival | ( | double | from, |
double | to, | ||
double | newArrival | ||
) |
Update a train's arrival time.
from | The arrival time. |
to | The departure time. |
newArrival | The new arrival time. |
const Occupied* TTSupport::StorageTrack::UpdateStoredTrainDeparture | ( | double | from, |
double | to, | ||
double | newDeparture | ||
) |
Update a train's departure time.
from | The arrival time. |
to | The departure time. |
newDeparture | The new departure time. |
bool TTSupport::StorageTrack::UsedTimeRange | ( | double | from, |
double | to | ||
) | const |
Return true if the time range is in use.
from | The arrival time. |
to | The departure time. |
ostream& TTSupport::StorageTrack::Write | ( | ostream & | stream | ) | const |
Write method.
Write object to a stream.
stream | Stream to write to. |
|
private |
Name of the storage track.
Referenced by Name(), operator=(), SetName(), and StorageTrack().
|
private |
Map of occupations.
Referenced by FindOccupied(), FirstOccupied(), LastOccupied(), operator=(), and StorageTrack().