Model Railroad System 2.2.2
|
This is the main Freight Car Forwarder class. More...
#include <System.h>
Public Types | |
enum | CarTypeReport { All , Type , Summary } |
Types of car type reports. More... | |
enum | CarLocationType { INDUSTRY , STATION , DIVISION , ALL } |
Types of location report. More... | |
Public Member Functions | |
System (const char *systemfile, int seed, char **outmessage=NULL) | |
The constructor for the system. More... | |
~System () | |
The destructor frees all memory and generally cleans things up. More... | |
const char * | SystemName () const |
Return the system name. More... | |
const char * | SystemFile () const |
Return the system file's full path name. More... | |
const char * | IndustriesFile () const |
Return the industry file's full path name. More... | |
const char * | TrainsFile () const |
Return the trains file's full path name. More... | |
const char * | OrdersFile () const |
Return the train orders file's full path name. More... | |
const char * | OwnersFile () const |
Return the Owners file's full path name. More... | |
const char * | CarTypesFile () const |
Return the Car Types file's full path name. More... | |
const char * | CarsFile () const |
Return the Cars file's full path name. More... | |
const char * | StatsFile () const |
Return the Statistics file's full path name. More... | |
int | NumberOfDivisions () const |
return the number of divisions loaded. More... | |
const Division * | FindDivisionByIndex (int i) const |
Find a division by its index. More... | |
const Division * | FindDivisionBySymbol (char symbol) const |
Find a division by its symbol. More... | |
FCFSupport::Division * | TheDivision (int i) |
Division indexing function. More... | |
int | NumberOfStations () const |
The number of stations loaded. More... | |
FCFSupport::Station * | TheStation (int i) |
Station indexing function. More... | |
const FCFSupport::Station * | FindStationByName (string name, string comment) const |
Station indexing (by name) function. More... | |
int | NumberOfTrains () const |
The number of trains loaded. More... | |
Train * | TrainByIndex (int i) |
Train indexing function. More... | |
const Train * | FindTrainByIndex (int i) const |
Find a train by its index. More... | |
Train * | TrainByName (const char *name) |
Train indexing (by name) function. More... | |
const Train * | FindTrainByName (const char *name) const |
Find a train by its name. More... | |
int | NumberOfIndustries () const |
Return the number of industries loaded. More... | |
FCFSupport::Industry * | TheIndustry (int i) |
Industry indexing function. More... | |
const FCFSupport::Industry * | FindIndustryByIndex (int i) const |
Find an industry by its index. More... | |
const FCFSupport::Industry * | FindIndustryByName (string name) const |
Find an industry by its name. More... | |
char | CarTypesOrder (int i) const |
Access a car type by index. More... | |
int | CarTypesOrderIndex (char type) const |
Car type order index. More... | |
CarType * | TheCarType (char c) |
Get a car type class instance pointer given a car type. More... | |
CarGroup * | TheCarGroup (int i) const |
Get a car class instance pointer given a car group index. More... | |
int | NumberOfCars () const |
Owner * | TheOwner (const char *initials) |
Get a car owner class instance pointer given a car owner's initials. More... | |
void | AddOwner (const char *initials) |
Create a new owner given a set of initials. More... | |
FCFSupport::Car * | TheCar (int i) const |
Get a car by index. More... | |
void | AddCar (FCFSupport::Car *newcar) |
Add a new car to the array of cars. More... | |
int | SessionNumber () const |
Return the session number. More... | |
int | ShiftNumber () const |
Return the shift number. More... | |
int | TotalShifts () const |
Return the total number of shifts. More... | |
int | NextShift () |
Increment the shift number. More... | |
int | TotalCars () const |
Return the total number of cars. More... | |
int | RanAllTrains () const |
Ran all trains? More... | |
void | DeleteAllExistingCars () |
Delete all existing cars. More... | |
bool | LoadCarFile (char **outmessage=NULL) |
(Re-)Load the car file. More... | |
bool | LoadStatsFile (char **outmessage=NULL) |
Load the stats file. More... | |
bool | SaveCars (char **outmessage=NULL) |
Save cars (and stats). More... | |
const FCFSupport::Industry * | IndScrapYard () const |
Return a pointer to the scrap yard. More... | |
int | StatsPeriod () const |
Return the current stats period. More... | |
int | TrainIndex (const FCFSupport::Train *train) const |
Return a train's index. More... | |
int | IndustryIndex (const FCFSupport::Industry *indus) const |
Return an industry's index. More... | |
int | CarsMoved () const |
Return the number of cars moved. More... | |
int | CarsAtDest () const |
Return the number of cars that are at their destinations. More... | |
int | CarsNotMoved () const |
Return the number of cars not moved at all. More... | |
int | CarsMovedOnce () const |
Return the number of cars moved once. More... | |
int | CarsMovedTwice () const |
Return the number of cars moved twice. More... | |
int | CarsMovedThree () const |
Return the number of cars moved three times. More... | |
int | CarsMovedMore () const |
Return the number of cars moved more then three times. More... | |
int | CarMovements () const |
Return the total number of car movements. More... | |
int | CarsInTransit () const |
Return the number of cars still in transit. More... | |
int | CarsAtWorkBench () const |
Return the number of cars on the RIP track (the workbench). More... | |
int | CarsAtDest_CarsInTransit () const |
Return the number of cars at their destinations plus the number of cars in transit. More... | |
bool | PrintYards () const |
Print yard lists flag. More... | |
void | SetPrintYards (bool flag) |
Set the print yard lists flag. More... | |
bool | PrintAlpha () const |
Print the alphabetical listing flag. More... | |
void | SetPrintAlpha (bool flag) |
Set the print alphabetical listing flag. More... | |
bool | PrintAtwice () const |
Print second copy of the alphabetical listing flag. More... | |
void | SetPrintAtwice (bool flag) |
Set the print second copy of the alphabetical listing flag. More... | |
bool | PrintList () const |
Print the switch list order flag. More... | |
void | SetPrintList (bool flag) |
Set the print switch list order flag. More... | |
bool | PrintLtwice () const |
Print a second copy of the switch list order flag. More... | |
void | SetPrintLtwice (bool flag) |
Set the print a second copy of the switch list order flag. More... | |
bool | PrintDispatch () const |
Print dispatcher report sheet. More... | |
void | SetPrintDispatch (bool flag) |
Set the print dispatcher report sheet. More... | |
bool | Printem () const |
Print train enroute switch list. More... | |
void | SetPrintem (bool flag) |
Set the print train enroute switch list. More... | |
const FCFSupport::Industry * | IndRipTrack () |
Return a pointer to the RIP track (workbench). More... | |
const FCFSupport::Industry * | IndRipTrackConst () const |
Const version of the pointer to the RIP track (workbench). More... | |
void | RestartLoop () |
Reset loop variables. More... | |
void | Randomize (int seed) |
Set the random seed. More... | |
double | Random () |
Return a random number between 0.0 and 1.0. More... | |
void | CarAssignment (const FCFSupport::WorkInProgressCallback *WIP, const FCFSupport::LogMessageCallback *log, const FCFSupport::ShowBannerCallback *banner, char **outmessage=NULL) |
Car assignment procedure. More... | |
void | RunAllTrains (const FCFSupport::WorkInProgressCallback *WIP, const FCFSupport::LogMessageCallback *Log, const FCFSupport::ShowBannerCallback *banner, FCFSupport::PrinterDevice *printer, const FCFSupport::TrainDisplayCallback *traindisplay) |
Run all trains procedure. More... | |
void | RunBoxMoves (const FCFSupport::WorkInProgressCallback *WIP, const FCFSupport::LogMessageCallback *Log, const FCFSupport::ShowBannerCallback *banner, FCFSupport::PrinterDevice *printer, const FCFSupport::TrainDisplayCallback *traindisplay) |
Run all boxmove trains. More... | |
void | PrintAllLists (const FCFSupport::LogMessageCallback *Log, const FCFSupport::ShowBannerCallback *banner, FCFSupport::PrinterDevice *printer) |
Print all of the various yard and switch lists. More... | |
void | RunOneTrain (Train *train, bool boxMove, const FCFSupport::TrainDisplayCallback *traindisplay, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Run one single train. More... | |
void | ShowCarsNotMoved (const FCFSupport::LogMessageCallback *Log, const FCFSupport::ShowBannerCallback *banner) const |
Display cars not moved. More... | |
void | ShowCarMovements (bool showAll, const FCFSupport::Industry *Ix, const FCFSupport::Train *Tx, const FCFSupport::LogMessageCallback *Log, const FCFSupport::ShowBannerCallback *banner) const |
Show all car movements. More... | |
void | ShowTrainCars (const Train *Tx, const FCFSupport::LogMessageCallback *Log, const FCFSupport::ShowBannerCallback *banner) const |
Show cars moved by a specific train. More... | |
void | ShowCarsInDivision (const Division *division, const FCFSupport::LogMessageCallback *Log, const FCFSupport::ShowBannerCallback *banner) const |
Show cars in a specificed division. More... | |
void | ShowTrainTotals (const FCFSupport::LogMessageCallback *Log, const FCFSupport::ShowBannerCallback *banner) const |
Show train totals. More... | |
void | ShowUnassignedCars (const FCFSupport::LogMessageCallback *Log, const FCFSupport::ShowBannerCallback *banner) const |
Show unassigned cars. More... | |
void | ReLoadCarFile (char **outmessage) |
Reload car file. More... | |
void | ResetIndustryStats () |
Reset industry statistics. More... | |
void | ReportIndustries (const FCFSupport::WorkInProgressCallback *WIP, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) const |
Report on all industries. More... | |
void | ReportTrains (const FCFSupport::WorkInProgressCallback *WIP, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) const |
Report on all trains. More... | |
void | ReportCars (const FCFSupport::WorkInProgressCallback *WIP, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) const |
Report on all cars. More... | |
void | ReportCarsNotMoved (const FCFSupport::WorkInProgressCallback *WIP, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) const |
Report on cars not moved. More... | |
void | ReportCarTypes (CarTypeReport rtype, char carType, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) const |
Report on car types. More... | |
void | ReportCarLocations (CarLocationType cltype, int index, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) |
Car location report. More... | |
void | ReportAnalysis (const FCFSupport::WorkInProgressCallback *WIP, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) const |
Industry analysis report. More... | |
void | ReportCarOwners (string ownerInitials, const FCFSupport::WorkInProgressCallback *WIP, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) const |
Report on a specified car owner. More... | |
int | FindIndustryIndex (const FCFSupport::Industry *industry) const |
Find an industry's index. More... | |
int | FindStationIndex (const FCFSupport::Station *station) const |
Find a station's index. More... | |
int | FindDivisionIndex (const FCFSupport::Division *division) const |
Find a division's index. More... | |
void | GetCarStatus (const Car *car, string &status, string &carTypeDescr) const |
Return car status information. More... | |
DivisionMap::const_iterator | FirstDivision () const |
Iterator of the first division in the division map. More... | |
DivisionMap::const_iterator | LastDivision () const |
Iterator of one past the last division in the division map. More... | |
StationMap::const_iterator | FirstStation () const |
Iterator of the first station in the station map. More... | |
StationMap::const_iterator | LastStation () const |
Iterator of one past the last station in the station map. More... | |
TrainMap::const_iterator | FirstTrain () const |
Iterator of the first train in the train map. More... | |
TrainMap::const_iterator | LastTrain () const |
Iterator of one past the last train in the train map. More... | |
IndustryMap::const_iterator | FirstIndustry () const |
Iterator of the first industry in the industry map. More... | |
IndustryMap::const_iterator | LastIndustry () const |
Iterator of one past the last industry in the industry map. More... | |
CarTypeMap::const_iterator | FirstCarType () const |
Iterator of the first car type in the car type map. More... | |
CarTypeMap::const_iterator | LastCarType () const |
Iterator of one past the last car type in the car type map. More... | |
OwnerMap::const_iterator | FirstOwner () const |
Iterator of the first owner in the owner map. More... | |
OwnerMap::const_iterator | LastOwner () const |
Iterator of one past the last owner in the owner map. More... | |
vector< int > | SearchForCarIndexesByNumber (string number, bool subStringP) const |
Search for cars with a specificed number. More... | |
vector< int > | SearchForTrainPattern (string trainNamePattern) const |
Search for a train by name given a glob pattern. More... | |
vector< int > | SearchForIndustryPattern (string industryNamePattern) const |
Search for an industry by name given a glob pattern. More... | |
Protected Member Functions | |
System () | |
The default constructor. More... | |
Private Member Functions | |
string | trim (string line) const |
Helper utility function to trim white space off the ends of a string. More... | |
vector< string > | split (string s, char delimiter) const |
Helper utility to split a string into words. More... | |
bool | SkipCommentsGets (istream &stream, string &buffer, const char *message, char **outmessage=NULL) |
Utility to get a line after skipping any intervening comments. More... | |
bool | ReadGroupLimit (istream &stream, const char *label, int &value, const char *filename, char **outmessage=NULL) |
Utility to read a group limit. More... | |
bool | ReadDivisions (istream &stream, map< int, int, less< int > > &homemap, char **outmessage=NULL) |
Read in the division map. More... | |
bool | ReadStations (istream &stream, char **outmessage=NULL) |
Read in the station map. More... | |
bool | ReadTrains (char **outmessage=NULL) |
Read in the trains file. More... | |
bool | ReadIndustries (char **outmessage=NULL) |
Read in the industries file. More... | |
bool | ReadTrainOrders (char **outmessage=NULL) |
Read in the train orders file. More... | |
bool | ReadCarTypes (char **outmessage=NULL) |
Read in the car types file. More... | |
bool | ReadOwners (char **outmessage=NULL) |
Read in the owners file. More... | |
bool | StringToInt (string str, int &result, const char *message, char **outmessage=NULL) const |
Convert a string to an integer. More... | |
bool | StringToIntRange (string str, int &result, int minv, int maxv, const char *message, char **outmessage=NULL) const |
Convert a string to an integer and check its range. More... | |
bool | WriteOneCarToDisk (Car *car, ostream &stream) |
Function to write one car to disk. More... | |
bool | IndustryTakesCar (Industry *Ix, Car *Cx) |
Check if an industry takes a certain car. More... | |
bool | FixedRouteMirrorCheck (Car *Cx, Industry *Ix) |
Check to see if a certain car can be mirrored on a fixed route at a certain industry. More... | |
CarVector::iterator | FindCarInCarVector (CarVector &cvect, Car *car) |
Find a car in a car vector. More... | |
IndustryMap::iterator | FindIndustry (Industry *industry) |
Find an industry in the industry map. More... | |
void | GetIndustryCarCounts () |
Update industry car counts. More... | |
void | InternalRunOneTrain (Train *train, bool boxMove, const FCFSupport::TrainDisplayCallback *traindisplay, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Internal function to run a single train. More... | |
void | RunOneLocal (Train *train, bool boxMove, CarVector &consist, const FCFSupport::TrainDisplayCallback *traindisplay, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
One one local train. More... | |
void | RunOnePassenger (Train *train, bool boxMove, const FCFSupport::TrainDisplayCallback *traindisplay, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
One one passenger train. More... | |
void | RunOneManifest (Train *train, bool boxMove, CarVector &consist, const FCFSupport::TrainDisplayCallback *traindisplay, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Run one manifest freight train. More... | |
void | PrintTrainLoc (Train *train, int Px, const FCFSupport::LogMessageCallback *Log, const FCFSupport::TrainDisplayCallback *traindisplay) |
Print a train's current location. More... | |
void | TrainLocalOriginate (Train *train, bool boxMove, int Px, CarVector &consist, bool &didAction, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Make up a local train. More... | |
void | LogCarPickup (Car *car, Train *train, bool boxMove) |
Log a car pickup in the switch list structure. More... | |
void | TrainLocalDrops (Train *train, int Px, CarVector &consist, bool &didAction, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Drop cars from a local (box move or way freight). More... | |
void | TrainManifestDrops (Train *train, int Px, CarVector &consist, bool &didAction, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Drop cars from a manifest freight. More... | |
void | TrainDropOneCar (Car *car, Train *train, CarVector::iterator Lx, CarVector &consist, bool &didAction, int Px, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Drop a single car. More... | |
void | TrainDropAllCars (Train *train, int Px, CarVector &consist, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Drop all cars from a train at the current stop (usually the last stop). More... | |
void | TrainLocalPickups (Train *train, bool boxMove, int Px, CarVector &consist, bool &didAction, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Pick up cars for a local train (box move or way freight). More... | |
void | TrainManifestPickups (Train *train, bool boxMove, int Px, CarVector &consist, bool &didAction, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Pick up cars for a manifest freight train. More... | |
void | TrainPickupOneCar (Car *car, Train *train, bool boxMove, CarVector &consist, bool &didAction, int Px, CarVector::iterator Lx, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Pick up one car. More... | |
bool | TrainCarPickupCheck (Car *car, Train *train, bool boxMove, CarVector &consist, bool &didAction, int Px, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) |
Check to see if we can really pick up this car. More... | |
bool | OtherCarOkForTrain (Car *car, Train *train) |
Check to see if this other car can be picked up. More... | |
void | TrainPrintConsistSummary (Train *train, CarVector &consist, FCFSupport::PrinterDevice *printer) |
Print a train's consist summary. More... | |
void | TrainPrintFinalSummary (Train *train, FCFSupport::PrinterDevice *printer) |
Print a train's final summary. More... | |
void | TrainPrintTown (const FCFSupport::Train *train, const FCFSupport::Station *curStation, FCFSupport::PrinterDevice *printer) |
Print the town a train is in. More... | |
void | PrintTrainOrderHeader (const FCFSupport::Train *train, FCFSupport::PrinterDevice *printer) |
Print a train order header. More... | |
void | PrintFormFeed (FCFSupport::PrinterDevice *printer) const |
Print a form feed. More... | |
void | PrintSystemBanner (FCFSupport::PrinterDevice *printer) const |
Print a system banner. More... | |
void | PrintDashedLine (FCFSupport::PrinterDevice *printer) const |
Print a dashed line. More... | |
void | PrintDispatcher (string banner, char trainType, FCFSupport::PrinterDevice *printer) const |
Print dispatcher report sheets. More... | |
const string | FormatDutyTime (int dutytimeminutes) const |
Format the on duty time in a human readable format. More... | |
void | PrintTrainOrders (const Train *train, FCFSupport::PrinterDevice *printer) const |
Print the train orders for a selected train. More... | |
const string | Today () const |
Return today's date. More... | |
const string | UpperCase (const string str) const |
Convert a string to all uppercase letters. More... | |
void | PrintIndustryHeader (FCFSupport::PrinterDevice *printer) const |
Print the industry header. More... | |
void | PrintOneIndustry (const Industry *ix, int &lenInDiv, int &carsInDiv, int &carsToDiv, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) const |
Print one industry. More... | |
void | PrintCarHeading (FCFSupport::PrinterDevice *printer) const |
Print the car heading. More... | |
void | PrintOneCarInfo (const Car *car, FCFSupport::PrinterDevice *printer) const |
Print one car's information. More... | |
void | PrintCarTypesHeader (FCFSupport::PrinterDevice *printer) const |
Print the car type header. More... | |
void | PrintAllCarTypes (bool totalsOnly, FCFSupport::PrinterDevice *printer) const |
Print all car types. More... | |
void | PrintOneCarType (bool totalsOnly, char carType, const CarType *ct, int &OnLineShippersOfType, int &OffLineShippersOfType, int &OnLineReceiversOfType, int &OffLineReceiversOfType, int &allTotalMoves, int &allTotalAssigns, FCFSupport::PrinterDevice *printer) const |
Print one car type. More... | |
void | PrintCarTypesSummaryHeader (FCFSupport::PrinterDevice *printer) const |
Print car type summary header. More... | |
void | ReportLocIndustry (IndustryMap::const_iterator Ix, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) |
Print a location report for one industry. More... | |
void | ReportLocStation (StationMap::const_iterator Sx, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) |
Print a location report for one station. More... | |
void | ReportLocDivision (DivisionMap::const_iterator Dx, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) |
Print a location report for one division. More... | |
void | ReportLocAll (bool printBench, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer, char **outmessage=NULL) |
Print a location report for all locations. More... | |
void | PrintLocCommon (FCFSupport::PrinterDevice *printer) |
Print a header for all location reports. More... | |
void | PrintLocOneIndustry (const FCFSupport::Industry *Ix, const FCFSupport::Station *Sx, bool &firstOne, FCFSupport::PrinterDevice *printer) const |
Print a location report for a single industry. More... | |
void | PrintOneCarLocation (const Car *car, FCFSupport::PrinterDevice *printer) const |
Print one car location report. More... | |
void | PrintOneAnalysis (const Industry *Ix, int &carsToDiv, const FCFSupport::LogMessageCallback *Log, FCFSupport::PrinterDevice *printer) const |
Print one analysis report. More... | |
void | PrintAnalysisHeader (FCFSupport::PrinterDevice *printer) const |
Print an analysis header. More... | |
bool | GlobStringMatch (const string thestring, const string pattern) const |
Glob style string match function. More... | |
bool | GlobStringMatchHelper (string::const_iterator string_i, string::const_iterator string_e, string::const_iterator pattern_i, string::const_iterator pattern_e) const |
Helper function for glob string matching. More... | |
Private Attributes | |
PathName | systemFile |
Full pathname of the system file. More... | |
string | systemName |
The system name. More... | |
PathName | industriesFile |
Full pathname of the industries file. More... | |
PathName | trainsFile |
Full pathname of the trains file. More... | |
PathName | ordersFile |
Full pathname of the train orders file. More... | |
PathName | ownersFile |
Full pathname of the car owners file. More... | |
PathName | carTypesFile |
Full pathname of the car types file. More... | |
PathName | carsFile |
Full pathname of the cars file. More... | |
PathName | statsFile |
Full pathname of the stats file. More... | |
DivisionMap | divisions |
Division map. More... | |
StationMap | stations |
Station map. More... | |
TrainMap | trains |
Train map. More... | |
TrainNameMap | trainIndex |
Train name map. More... | |
IndustryMap | industries |
Industries map. More... | |
char | carTypesOrder [CarType::MaxCarTypes] |
Car type order vector. More... | |
CarTypeMap | carTypes |
Car type map. More... | |
CarGroup * | carGroups [CarGroup::MaxCarGroup] |
Car group vector. More... | |
OwnerMap | owners |
Car owner map. More... | |
CarVector | cars |
Car vector. More... | |
SwitchList | switchList |
Switch lists. More... | |
int | sessionNumber |
Current session number. More... | |
int | shiftNumber |
Current shift number. More... | |
int | totalShifts |
The total number of shifts. More... | |
int | ranAllTrains |
The ran all trains flag. More... | |
int | totalPickups |
The total number of pickups. More... | |
int | totalLoads |
The total number of loads. More... | |
int | totalTons |
The total number of tons. More... | |
int | totalRevenueTons |
The total number of revenue tons. More... | |
bool | trainPrintOK |
Train print flag. More... | |
bool | wayFreight |
Way freight flag. More... | |
bool | deliver |
Deliver flag. More... | |
int | trainLength |
Train length. More... | |
int | numberCars |
The number of cars on a train. More... | |
int | trainTons |
The number of tons on a train. More... | |
int | trainLoads |
The number of loads on a train. More... | |
int | trainEmpties |
The number of empties on a train. More... | |
int | trainLongest |
The longest a train has been. More... | |
Division * | curDiv |
Current division. More... | |
Industry * | originYard |
Origin Yard. More... | |
Industry * | trainLastLocation |
A trains last location. More... | |
Industry * | carDest |
A temporary for a car's location. More... | |
int | statsPeriod |
The current stats period. More... | |
int | carsMoved |
The number of cars moved. More... | |
int | carsAtDest |
The number of cars at their destinations. More... | |
int | carsNotMoved |
The number of cars not moved. More... | |
int | carsMovedOnce |
The number of cars moved one time. More... | |
int | carsMovedTwice |
The number of cars moved two times. More... | |
int | carsMovedThree |
The number of cars moved three times. More... | |
int | carsMovedMore |
The number of cars moved more then three times. More... | |
int | carMovements |
The number of cars movements. More... | |
int | carsInTransit |
The number of cars in transit. More... | |
int | carsAtWorkBench |
The number of cars at the workbench. More... | |
int | carsAtDest_carsInTransit |
The number of cars at their destinations and still in transit. More... | |
bool | printYards |
Flag for printing yard switch lists. More... | |
bool | printAlpha |
Flag for printing alphabetical lists. More... | |
bool | printAtwice |
Flag for printing a second copy of alphabetical lists. More... | |
bool | printList |
Flag for printing train switch lists. More... | |
bool | printLtwice |
Flag for printing a second copy of train switch lists. More... | |
bool | printDispatch |
Flag for printing a dispatcher's report. More... | |
bool | printem |
Flag for printing train movements. More... | |
char | messageBuffer [2048] |
Message buffer, used for error messages mostly. More... | |
const FCFSupport::Industry | indScrapYard |
The pointer to the scrapyard. More... | |
Static Private Attributes | |
static const string | whitespace |
String of white space characters. More... | |
This is the main Freight Car Forwarder class.
It implements all of the basic data and algorithms used in the the Freight Car Forwarder system.
This class includes code to load a model railroad `‘system’' (divisions, stations, industries, cars, and trains) along with code to assign cars to trains, run trains, generate yard switch lists, and various reports. Basically everything you need run realistic trains on a layout.
This is my second port of Tim O'Connors Freight Car Forwarding system, originally written in QBasic for use with the North Shore Model RR Club `‘Chesapeake System’'.
|
inlineprotected |
The default constructor.
This is protected to prevent the creation of an uninitialized class instance. It simply makes no sense to create a system without loading a system file.
FCFSupport::System::System | ( | const char * | systemfile, |
int | seed, | ||
char ** | outmessage = NULL |
||
) |
The constructor for the system.
Takes the path to a system file (typically #system.dat#) and loads the complete system. The system file contains the names of the additional files, containing the remaining system data. All of the files are presumbed to exist in the same directory as the system file. All of the files are loaded and a sanity check is made to insure that the data is sane.
systemfile | Pathname to the system file. |
seed | Seed value for the random number generator. |
outmessage | Pointer to a pointer to receive any error messages for any errors that might occur. |
FCFSupport::System::~System | ( | ) |
The destructor frees all memory and generally cleans things up.
|
inline |
|
inline |
Create a new owner given a set of initials.
initials | The new car owner's initials. |
References owners.
void FCFSupport::System::CarAssignment | ( | const FCFSupport::WorkInProgressCallback * | WIP, |
const FCFSupport::LogMessageCallback * | log, | ||
const FCFSupport::ShowBannerCallback * | banner, | ||
char ** | outmessage = NULL |
||
) |
Car assignment procedure.
The is one of the main workhorse procedures. It goes through all of the cars, finding ones that are ready to be moved and determines where they could be moved to, based on a number of critiera, such as whether they are loaded or empty, whether they are in their home divisions or not, and so on.
WIP | Work in progress callback. |
log | Log message callback. |
banner | Show banner callback. |
outmessage | Buffer pointer for error messages. |
|
inline |
Return the total number of car movements.
References carMovements.
|
inline |
Return the number of cars that are at their destinations.
References carsAtDest.
|
inline |
Return the number of cars at their destinations plus the number of cars in transit.
References carsAtDest_carsInTransit.
|
inline |
Return the number of cars on the RIP track (the workbench).
References carsAtWorkBench.
|
inline |
Return the Cars file's full path name.
References carsFile, and FCFSupport::PathName::FullPath().
|
inline |
Return the number of cars still in transit.
References carsInTransit.
|
inline |
Return the number of cars moved.
References carsMoved.
|
inline |
Return the number of cars moved more then three times.
References carsMovedMore.
|
inline |
Return the number of cars moved once.
References carsMovedOnce.
|
inline |
Return the number of cars moved three times.
References carsMovedThree.
|
inline |
Return the number of cars moved twice.
References carsMovedTwice.
|
inline |
Return the number of cars not moved at all.
References carsNotMoved.
|
inline |
Return the Car Types file's full path name.
References carTypesFile, and FCFSupport::PathName::FullPath().
|
inline |
Access a car type by index.
i | The car type index. |
References carTypesOrder, i, and FCFSupport::CarType::MaxCarTypes.
int FCFSupport::System::CarTypesOrderIndex | ( | char | type | ) | const |
void FCFSupport::System::DeleteAllExistingCars | ( | ) |
Delete all existing cars.
Find a car in a car vector.
cvect | The car vector to search. |
car | The car to search for. |
|
inline |
const Division * FCFSupport::System::FindDivisionBySymbol | ( | char | symbol | ) | const |
Find a division by its symbol.
Returns either a pointer to the division or NULL.
symbol | The division symbol to look for. |
int FCFSupport::System::FindDivisionIndex | ( | const FCFSupport::Division * | division | ) | const |
Find a division's index.
division | The division to look for. |
|
private |
Find an industry in the industry map.
industry | The industry to search for. |
|
inline |
Find an industry by its index.
Returns either a pointer to the industry or NULL.
i | The industry index to look for. |
References i, and industries.
const FCFSupport::Industry * FCFSupport::System::FindIndustryByName | ( | string | name | ) | const |
Find an industry by its name.
Returns either a pointer to the industry or NULL.
name | Industry name to look for. |
int FCFSupport::System::FindIndustryIndex | ( | const FCFSupport::Industry * | industry | ) | const |
Find an industry's index.
industry | The industry to look for. |
const FCFSupport::Station * FCFSupport::System::FindStationByName | ( | string | name, |
string | comment | ||
) | const |
int FCFSupport::System::FindStationIndex | ( | const FCFSupport::Station * | station | ) | const |
Find a station's index.
station | The station to look for. |
|
inline |
|
inline |
Find a train by its name.
Returns either a pointer to the train or NULL.
name | Train name to look for. |
References trainIndex.
|
inline |
Iterator of the first car type in the car type map.
References carTypes.
|
inline |
Iterator of the first division in the division map.
References divisions.
|
inline |
Iterator of the first industry in the industry map.
References industries.
|
inline |
Iterator of the first owner in the owner map.
References owners.
|
inline |
Iterator of the first station in the station map.
References stations.
|
inline |
Iterator of the first train in the train map.
References trains.
Check to see if a certain car can be mirrored on a fixed route at a certain industry.
Cx | The car to check. |
Ix | The industry to check. |
|
private |
Format the on duty time in a human readable format.
dutytimeminutes | The duty time in minutes. |
void FCFSupport::System::GetCarStatus | ( | const Car * | car, |
string & | status, | ||
string & | carTypeDescr | ||
) | const |
Return car status information.
car | The car to look up. |
status | Its status (loaded or empty). |
carTypeDescr | Its car type description. |
|
private |
Update industry car counts.
|
private |
Glob style string match function.
thestring | The string to match against. |
pattern | The glob pattern. |
|
private |
Helper function for glob string matching.
string_i | The current string index. |
string_e | The end of the string. |
pattern_i | The current pattern index. |
pattern_e | The end of the pattern. |
|
inline |
Return a pointer to the RIP track (workbench).
References industries.
|
inline |
Const version of the pointer to the RIP track (workbench).
References industries.
|
inline |
Return a pointer to the scrap yard.
References indScrapYard.
|
inline |
Return the industry file's full path name.
References FCFSupport::PathName::FullPath(), and industriesFile.
int FCFSupport::System::IndustryIndex | ( | const FCFSupport::Industry * | indus | ) | const |
Return an industry's index.
indus | The industry to lookup. |
Check if an industry takes a certain car.
Ix | The industry to check. |
Cx | The car to check. |
|
private |
Internal function to run a single train.
train | The train to run. |
boxMove | Is this a box move? |
traindisplay | Train display callback. |
Log | Log message callback. |
printer | Printer device. |
|
inline |
Iterator of one past the last car type in the car type map.
References carTypes.
|
inline |
Iterator of one past the last division in the division map.
References divisions.
|
inline |
Iterator of one past the last industry in the industry map.
References industries.
|
inline |
Iterator of one past the last owner in the owner map.
References owners.
|
inline |
Iterator of one past the last station in the station map.
References stations.
|
inline |
Iterator of one past the last train in the train map.
References trains.
bool FCFSupport::System::LoadCarFile | ( | char ** | outmessage = NULL | ) |
(Re-)Load the car file.
outmessage | Buffer pointer for error messages. |
Referenced by ReLoadCarFile().
bool FCFSupport::System::LoadStatsFile | ( | char ** | outmessage = NULL | ) |
Load the stats file.
outmessage | Buffer pointer for error messages. |
Referenced by ReLoadCarFile().
Log a car pickup in the switch list structure.
car | The car picked up. |
train | The train that picked it up. |
boxMove | Is this a box move? |
|
inline |
Increment the shift number.
References sessionNumber, shiftNumber, and totalShifts.
|
inline |
References cars.
|
inline |
return the number of divisions loaded.
References divisions.
|
inline |
Return the number of industries loaded.
References industries.
|
inline |
The number of stations loaded.
References stations.
|
inline |
The number of trains loaded.
References trains.
|
inline |
Return the train orders file's full path name.
References FCFSupport::PathName::FullPath(), and ordersFile.
Check to see if this other car can be picked up.
car | The car to check. |
train | The train to check. |
|
inline |
Return the Owners file's full path name.
References FCFSupport::PathName::FullPath(), and ownersFile.
|
private |
Print all car types.
totalsOnly | Print only the totals? |
printer | Printer device. |
void FCFSupport::System::PrintAllLists | ( | const FCFSupport::LogMessageCallback * | Log, |
const FCFSupport::ShowBannerCallback * | banner, | ||
FCFSupport::PrinterDevice * | printer | ||
) |
Print all of the various yard and switch lists.
Log | Log message callback. |
banner | Show banner callback. |
printer | Printer device. |
|
inline |
Print the alphabetical listing flag.
References printAlpha.
|
private |
Print an analysis header.
printer | Printer device. |
|
inline |
Print second copy of the alphabetical listing flag.
References printAtwice.
|
private |
Print the car heading.
printer | Printer device. |
|
private |
Print the car type header.
printer | Printer device. |
|
private |
Print car type summary header.
printer | Printer device. |
|
private |
Print a dashed line.
printer | Printer device. |
|
inline |
Print dispatcher report sheet.
References printDispatch.
|
private |
Print dispatcher report sheets.
banner | System banner. |
trainType | Type of train. |
printer | Printer device. |
|
inline |
Print train enroute switch list.
References printem.
|
private |
Print a form feed.
printer | Printer device. |
|
private |
Print the industry header.
printer | Printer device. |
|
inline |
Print the switch list order flag.
References printList.
|
private |
Print a header for all location reports.
printer | Printer device. |
|
private |
Print a location report for a single industry.
Ix | The industry to print a report for. |
Sx | The station to print a report for. |
firstOne | Is this the first one? |
printer | Printer device. |
|
inline |
Print a second copy of the switch list order flag.
References printLtwice.
|
private |
Print one analysis report.
Ix | The industry. |
carsToDiv | Updated cars headed for the current division. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Print one car's information.
car | The car whose information to print. |
printer | Printer device. |
|
private |
Print one car location report.
car | The car to print location information for. |
printer | Printer device. |
|
private |
Print one car type.
totalsOnly | Print only the totals? |
carType | The car type character. |
ct | The car type object. |
OnLineShippersOfType | Updated online shippers of this car type. |
OffLineShippersOfType | Updated offline shippers of this car type. |
OnLineReceiversOfType | Updated online receivers of this car type. |
OffLineReceiversOfType | Updated offline receivers of this car type. |
allTotalMoves | Update total moves. |
allTotalAssigns | Updated total assignments. |
printer | Printer device. |
|
private |
Print one industry.
ix | The industry. |
lenInDiv | The updated division length. |
carsInDiv | The updated cars in division count. |
carsToDiv | The updates cars headed to division count. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Print a system banner.
printer | Printer device. |
|
private |
Print a train's current location.
train | The train to print. |
Px | The stop number that train is at. |
Log | Log message callback. |
traindisplay | Train display callback. |
|
private |
Print a train order header.
train | The train to print a train order header for. |
printer | Printer device. |
|
private |
Print the train orders for a selected train.
train | The train to print trains orders for. |
printer | Printer device. |
|
inline |
Print yard lists flag.
References printYards.
|
inline |
Ran all trains?
References ranAllTrains.
|
inline |
Return a random number between 0.0 and 1.0.
|
inline |
Set the random seed.
seed | Seed value. |
|
private |
Read in the car types file.
outmessage | Buffer pointer for error messages. |
|
private |
Read in the division map.
stream | The input stream to read from. |
homemap | The map of home yards. |
outmessage | Buffer pointer for error messages. |
|
private |
Utility to read a group limit.
stream | The input stream to read from. |
label | The label for the group limit. |
value | The limit value read. |
filename | The filename being read from. |
outmessage | Buffer pointer for error messages. |
|
private |
Read in the industries file.
outmessage | Buffer pointer for error messages. |
|
private |
Read in the owners file.
outmessage | Buffer pointer for error messages. |
|
private |
Read in the station map.
stream | The input stream to read from. |
outmessage | Buffer pointer for error messages. |
|
private |
Read in the train orders file.
outmessage | Buffer pointer for error messages. |
|
private |
Read in the trains file.
outmessage | Buffer pointer for error messages. |
|
inline |
Reload car file.
outmessage | Buffer pointer for error messages. |
References LoadCarFile(), LoadStatsFile(), and RestartLoop().
void FCFSupport::System::ReportAnalysis | ( | const FCFSupport::WorkInProgressCallback * | WIP, |
const FCFSupport::LogMessageCallback * | Log, | ||
FCFSupport::PrinterDevice * | printer, | ||
char ** | outmessage = NULL |
||
) | const |
Industry analysis report.
WIP | Work in progress callback. |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
void FCFSupport::System::ReportCarLocations | ( | CarLocationType | cltype, |
int | index, | ||
const FCFSupport::LogMessageCallback * | Log, | ||
FCFSupport::PrinterDevice * | printer, | ||
char ** | outmessage = NULL |
||
) |
Car location report.
cltype | Type of report. |
index | Index of thing to report by (industry, station, or division). |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
void FCFSupport::System::ReportCarOwners | ( | string | ownerInitials, |
const FCFSupport::WorkInProgressCallback * | WIP, | ||
const FCFSupport::LogMessageCallback * | Log, | ||
FCFSupport::PrinterDevice * | printer, | ||
char ** | outmessage = NULL |
||
) | const |
Report on a specified car owner.
ownerInitials | Car owner's initials to report on. |
WIP | Work in progress callback. |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
void FCFSupport::System::ReportCars | ( | const FCFSupport::WorkInProgressCallback * | WIP, |
const FCFSupport::LogMessageCallback * | Log, | ||
FCFSupport::PrinterDevice * | printer, | ||
char ** | outmessage = NULL |
||
) | const |
Report on all cars.
WIP | Work in progress callback. |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
void FCFSupport::System::ReportCarsNotMoved | ( | const FCFSupport::WorkInProgressCallback * | WIP, |
const FCFSupport::LogMessageCallback * | Log, | ||
FCFSupport::PrinterDevice * | printer, | ||
char ** | outmessage = NULL |
||
) | const |
Report on cars not moved.
WIP | Work in progress callback. |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
void FCFSupport::System::ReportCarTypes | ( | CarTypeReport | rtype, |
char | carType, | ||
FCFSupport::PrinterDevice * | printer, | ||
char ** | outmessage = NULL |
||
) | const |
Report on car types.
rtype | Type of report to produce. |
carType | Car type to report on (only used when the report type is for a single type). |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
void FCFSupport::System::ReportIndustries | ( | const FCFSupport::WorkInProgressCallback * | WIP, |
const FCFSupport::LogMessageCallback * | Log, | ||
FCFSupport::PrinterDevice * | printer, | ||
char ** | outmessage = NULL |
||
) | const |
Report on all industries.
WIP | Work in progress callback. |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
|
private |
Print a location report for all locations.
printBench | Print cars at the workbench? |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
|
private |
Print a location report for one division.
Dx | The division's index. |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
|
private |
Print a location report for one industry.
Ix | The industry's index. |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
|
private |
Print a location report for one station.
Sx | The station's index. |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
void FCFSupport::System::ReportTrains | ( | const FCFSupport::WorkInProgressCallback * | WIP, |
const FCFSupport::LogMessageCallback * | Log, | ||
FCFSupport::PrinterDevice * | printer, | ||
char ** | outmessage = NULL |
||
) | const |
Report on all trains.
WIP | Work in progress callback. |
Log | Log message callback. |
printer | Printer device. |
outmessage | Buffer pointer for error messages. |
void FCFSupport::System::ResetIndustryStats | ( | ) |
Reset industry statistics.
void FCFSupport::System::RestartLoop | ( | ) |
Reset loop variables.
Referenced by ReLoadCarFile().
void FCFSupport::System::RunAllTrains | ( | const FCFSupport::WorkInProgressCallback * | WIP, |
const FCFSupport::LogMessageCallback * | Log, | ||
const FCFSupport::ShowBannerCallback * | banner, | ||
FCFSupport::PrinterDevice * | printer, | ||
const FCFSupport::TrainDisplayCallback * | traindisplay | ||
) |
Run all trains procedure.
The is another workhorse procedure. This procedure runs the initial box moves, then the way freights and manifest trains. It is necessary to run the box moves again after running this procedure, unless additional sections of the way freights or manifest trains need to be run first.
WIP | Work in progress callback. |
Log | Log message callback. |
banner | Show banner callback. |
printer | Printer device. |
traindisplay | Train display callback. |
void FCFSupport::System::RunBoxMoves | ( | const FCFSupport::WorkInProgressCallback * | WIP, |
const FCFSupport::LogMessageCallback * | Log, | ||
const FCFSupport::ShowBannerCallback * | banner, | ||
FCFSupport::PrinterDevice * | printer, | ||
const FCFSupport::TrainDisplayCallback * | traindisplay | ||
) |
Run all boxmove trains.
The is another workhorse procedure. This procedure runs all of the box moves.
WIP | Work in progress callback. |
Log | Log message callback. |
banner | Show banner callback. |
printer | Printer device. |
traindisplay | Train display callback. |
|
private |
One one local train.
train | The train to run. |
boxMove | Is this a box move? |
consist | The train's consist. |
traindisplay | Train display callback. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Run one manifest freight train.
train | The train to run. |
boxMove | Is this a box move? |
consist | The train's consist. |
traindisplay | Train display callback. |
Log | Log message callback. |
printer | Printer device. |
|
private |
One one passenger train.
train | The train to run. |
boxMove | Is this a box move? |
traindisplay | Train display callback. |
Log | Log message callback. |
printer | Printer device. |
void FCFSupport::System::RunOneTrain | ( | Train * | train, |
bool | boxMove, | ||
const FCFSupport::TrainDisplayCallback * | traindisplay, | ||
const FCFSupport::LogMessageCallback * | Log, | ||
FCFSupport::PrinterDevice * | printer | ||
) |
Run one single train.
train | The train to run. |
boxMove | Is this a box move? |
traindisplay | Train display callback. |
Log | Log message callback. |
printer | Printer device. |
bool FCFSupport::System::SaveCars | ( | char ** | outmessage = NULL | ) |
Save cars (and stats).
outmessage | Buffer pointer for error messages. |
vector< int > FCFSupport::System::SearchForCarIndexesByNumber | ( | string | number, |
bool | subStringP | ||
) | const |
Search for cars with a specificed number.
number | The number string to look for. |
subStringP | Match the whole number or only the last few digits. |
vector< int > FCFSupport::System::SearchForIndustryPattern | ( | string | industryNamePattern | ) | const |
Search for an industry by name given a glob pattern.
industryNamePattern | The name pattern. |
vector< int > FCFSupport::System::SearchForTrainPattern | ( | string | trainNamePattern | ) | const |
Search for a train by name given a glob pattern.
trainNamePattern | The name pattern. |
|
inline |
Return the session number.
References sessionNumber.
|
inline |
Set the print alphabetical listing flag.
flag | New value to set the flag to. |
References printAlpha.
|
inline |
Set the print second copy of the alphabetical listing flag.
flag | New value to set the flag to. |
References printAtwice.
|
inline |
Set the print dispatcher report sheet.
flag | New value to set the flag to. |
References printDispatch.
|
inline |
Set the print train enroute switch list.
flag | New value to set the flag to. |
References printem.
|
inline |
Set the print switch list order flag.
flag | New value to set the flag to. |
References printList.
|
inline |
Set the print a second copy of the switch list order flag.
flag | New value to set the flag to. |
References printLtwice.
|
inline |
|
inline |
Return the shift number.
References shiftNumber.
void FCFSupport::System::ShowCarMovements | ( | bool | showAll, |
const FCFSupport::Industry * | Ix, | ||
const FCFSupport::Train * | Tx, | ||
const FCFSupport::LogMessageCallback * | Log, | ||
const FCFSupport::ShowBannerCallback * | banner | ||
) | const |
Show all car movements.
showAll | Show all movements? |
Ix | Show movements by industry. |
Tx | Show movements by train. |
Log | Log message callback. |
banner | Show banner callback. |
void FCFSupport::System::ShowCarsInDivision | ( | const Division * | division, |
const FCFSupport::LogMessageCallback * | Log, | ||
const FCFSupport::ShowBannerCallback * | banner | ||
) | const |
Show cars in a specificed division.
division | The specific division. |
Log | Log message callback. |
banner | Show banner callback. |
void FCFSupport::System::ShowCarsNotMoved | ( | const FCFSupport::LogMessageCallback * | Log, |
const FCFSupport::ShowBannerCallback * | banner | ||
) | const |
Display cars not moved.
Log | Log message callback. |
banner | Show banner callback. |
void FCFSupport::System::ShowTrainCars | ( | const Train * | Tx, |
const FCFSupport::LogMessageCallback * | Log, | ||
const FCFSupport::ShowBannerCallback * | banner | ||
) | const |
Show cars moved by a specific train.
Tx | The specific train. |
Log | Log message callback. |
banner | Show banner callback. |
void FCFSupport::System::ShowTrainTotals | ( | const FCFSupport::LogMessageCallback * | Log, |
const FCFSupport::ShowBannerCallback * | banner | ||
) | const |
Show train totals.
Log | Log message callback. |
banner | Show banner callback. |
void FCFSupport::System::ShowUnassignedCars | ( | const FCFSupport::LogMessageCallback * | Log, |
const FCFSupport::ShowBannerCallback * | banner | ||
) | const |
Show unassigned cars.
Log | Log message callback. |
banner | Show banner callback. |
|
private |
Utility to get a line after skipping any intervening comments.
stream | The input stream to read from. |
buffer | The result buffer. |
message | Error message to use if an error occurs. |
outmessage | Buffer pointer for error messages. |
|
private |
Helper utility to split a string into words.
s | The string to split. |
delimiter | The delimiter character to split the string on. |
|
inline |
Return the Statistics file's full path name.
References FCFSupport::PathName::FullPath(), and statsFile.
|
inline |
Return the current stats period.
References statsPeriod.
|
private |
Convert a string to an integer.
str | The string to convert. |
result | The converted integer result buffer. |
message | The message to use in case there is an error. |
outmessage | Buffer pointer for error messages. |
|
private |
Convert a string to an integer and check its range.
str | The string to convert. |
result | The converted integer result buffer. |
minv | The permitted minimum value. |
maxv | The permitted maximum value. |
message | The message to use in case there is an error. |
outmessage | Buffer pointer for error messages. |
|
inline |
Return the system file's full path name.
References FCFSupport::PathName::FullPath(), and systemFile.
|
inline |
|
inline |
|
inline |
Get a car class instance pointer given a car group index.
i | The car group index. |
References carGroups, i, and FCFSupport::CarGroup::MaxCarGroup.
|
inline |
Get a car type class instance pointer given a car type.
c | The car type to lookup. |
References carTypes.
|
inline |
|
inline |
Industry indexing function.
Warning: if the industry at the specificed index does not already exist, a new element is allocated with a NULL pointer.
i | The industry index to access. |
References i, and industries.
|
inline |
Get a car owner class instance pointer given a car owner's initials.
initials | The car owner's initials. |
References owners.
|
inline |
|
private |
Return today's date.
|
inline |
Return the total number of cars.
References cars.
|
inline |
Return the total number of shifts.
References totalShifts.
|
inline |
|
inline |
Train indexing (by name) function.
Warning: if the train at the specificed index (name) does not already exist, a new element is allocated with a NULL pointer.
name | Train name to access. |
References trainIndex.
|
private |
Check to see if we can really pick up this car.
car | The car to check. |
train | The train to pick up the car for. |
boxMove | Is this a box move? |
consist | The train's consist. |
didAction | Flag to set if something was done. |
Px | The stop number that train is at. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Drop all cars from a train at the current stop (usually the last stop).
train | The train to drop cars from. |
Px | The stop number that train is at. |
consist | The train's consist. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Drop a single car.
car | The car to drop. |
train | The train to drop the car from. |
Lx | The index of the car to drop. |
consist | The train's consist. |
didAction | Flag to set if something was done. |
Px | The stop number that train is at. |
Log | Log message callback. |
printer | Printer device. |
int FCFSupport::System::TrainIndex | ( | const FCFSupport::Train * | train | ) | const |
Return a train's index.
train | The train to lookup. |
|
private |
Drop cars from a local (box move or way freight).
train | The train to drop cars from. |
Px | The stop number that train is at. |
consist | The train's consist. |
didAction | Flag to set if something was done. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Make up a local train.
train | The train to make up. |
boxMove | Is this a box move? |
Px | The stop number that train is at. |
consist | The train's consist. |
didAction | Flag to set if something was done. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Pick up cars for a local train (box move or way freight).
train | The train to pick up cars for. |
boxMove | Is this a box move? |
Px | The stop number that train is at. |
consist | The train's consist. |
didAction | Flag to set if something was done. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Drop cars from a manifest freight.
train | The train to drop cars from. |
Px | The stop number that train is at. |
consist | The train's consist. |
didAction | Flag to set if something was done. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Pick up cars for a manifest freight train.
train | The train to pick up cars for. |
boxMove | Is this a box move? |
Px | The stop number that train is at. |
consist | The train's consist. |
didAction | Flag to set if something was done. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Pick up one car.
car | The car to possibly pick up. |
train | The train to pick up the car for. |
boxMove | Is this a box move? |
consist | The train's consist. |
didAction | Flag to set if something was done. |
Px | The stop number that train is at. |
Lx | Place in the train to put the car if it is picked up. |
Log | Log message callback. |
printer | Printer device. |
|
private |
Print a train's consist summary.
train | The train to print a summary for. |
consist | The train's consist. |
printer | Printer device. |
|
private |
Print a train's final summary.
train | The train to print the final summary for. |
printer | Printer device. |
|
private |
Print the town a train is in.
train | The train to print the town for. |
curStation | The current station. |
printer | Printer device. |
|
inline |
Return the trains file's full path name.
References FCFSupport::PathName::FullPath(), and trainsFile.
|
private |
Helper utility function to trim white space off the ends of a string.
line | The string to trim. |
|
private |
Convert a string to all uppercase letters.
str | The string to convert. |
|
private |
Function to write one car to disk.
car | The car to write. |
stream | The output stream to write to. |
|
private |
A temporary for a car's location.
|
private |
Car group vector.
Referenced by TheCarGroup().
|
private |
The number of cars movements.
Referenced by CarMovements().
|
private |
Car vector.
Referenced by AddCar(), NumberOfCars(), TheCar(), and TotalCars().
|
private |
The number of cars at their destinations.
Referenced by CarsAtDest().
|
private |
The number of cars at their destinations and still in transit.
Referenced by CarsAtDest_CarsInTransit().
|
private |
The number of cars at the workbench.
Referenced by CarsAtWorkBench().
|
private |
Full pathname of the cars file.
Referenced by CarsFile().
|
private |
The number of cars in transit.
Referenced by CarsInTransit().
|
private |
The number of cars moved.
Referenced by CarsMoved().
|
private |
The number of cars moved more then three times.
Referenced by CarsMovedMore().
|
private |
The number of cars moved one time.
Referenced by CarsMovedOnce().
|
private |
The number of cars moved three times.
Referenced by CarsMovedThree().
|
private |
The number of cars moved two times.
Referenced by CarsMovedTwice().
|
private |
The number of cars not moved.
Referenced by CarsNotMoved().
|
private |
Car type map.
Referenced by FirstCarType(), LastCarType(), and TheCarType().
|
private |
Full pathname of the car types file.
Referenced by CarTypesFile().
|
private |
Car type order vector.
Referenced by CarTypesOrder().
|
private |
Current division.
|
private |
Deliver flag.
|
private |
Division map.
Referenced by FindDivisionByIndex(), FirstDivision(), LastDivision(), NumberOfDivisions(), and TheDivision().
|
private |
The pointer to the scrapyard.
Referenced by IndScrapYard().
|
private |
Industries map.
Referenced by FindIndustryByIndex(), FirstIndustry(), IndRipTrack(), IndRipTrackConst(), LastIndustry(), NumberOfIndustries(), and TheIndustry().
|
private |
Full pathname of the industries file.
Referenced by IndustriesFile().
|
private |
Message buffer, used for error messages mostly.
|
private |
The number of cars on a train.
|
private |
Full pathname of the train orders file.
Referenced by OrdersFile().
|
private |
Origin Yard.
|
private |
Car owner map.
Referenced by AddOwner(), FirstOwner(), LastOwner(), and TheOwner().
|
private |
Full pathname of the car owners file.
Referenced by OwnersFile().
|
private |
Flag for printing alphabetical lists.
Referenced by PrintAlpha(), and SetPrintAlpha().
|
private |
Flag for printing a second copy of alphabetical lists.
Referenced by PrintAtwice(), and SetPrintAtwice().
|
private |
Flag for printing a dispatcher's report.
Referenced by PrintDispatch(), and SetPrintDispatch().
|
private |
Flag for printing train movements.
Referenced by Printem(), and SetPrintem().
|
private |
Flag for printing train switch lists.
Referenced by PrintList(), and SetPrintList().
|
private |
Flag for printing a second copy of train switch lists.
Referenced by PrintLtwice(), and SetPrintLtwice().
|
private |
Flag for printing yard switch lists.
Referenced by PrintYards(), and SetPrintYards().
|
private |
The ran all trains flag.
Referenced by RanAllTrains().
|
private |
Current session number.
Referenced by NextShift(), and SessionNumber().
|
private |
Current shift number.
Referenced by NextShift(), and ShiftNumber().
|
private |
Station map.
Referenced by FirstStation(), LastStation(), NumberOfStations(), and TheStation().
|
private |
Full pathname of the stats file.
Referenced by StatsFile().
|
private |
The current stats period.
Referenced by StatsPeriod().
|
private |
Switch lists.
|
private |
Full pathname of the system file.
Referenced by SystemFile().
|
private |
The system name.
Referenced by SystemName().
|
private |
The total number of loads.
|
private |
The total number of pickups.
|
private |
The total number of revenue tons.
|
private |
The total number of shifts.
Referenced by NextShift(), and TotalShifts().
|
private |
The total number of tons.
|
private |
The number of empties on a train.
|
private |
Train name map.
Referenced by FindTrainByName(), and TrainByName().
|
private |
A trains last location.
|
private |
Train length.
|
private |
The number of loads on a train.
|
private |
The longest a train has been.
|
private |
Train print flag.
|
private |
Train map.
Referenced by FindTrainByIndex(), FirstTrain(), LastTrain(), NumberOfTrains(), and TrainByIndex().
|
private |
Full pathname of the trains file.
Referenced by TrainsFile().
|
private |
The number of tons on a train.
|
private |
Way freight flag.
|
staticprivate |
String of white space characters.