Model Railroad System  2.2.1
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
FCFSupport::System Class Reference

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 DivisionFindDivisionByIndex (int i) const
 Find a division by its index. More...
 
const DivisionFindDivisionBySymbol (char symbol) const
 Find a division by its symbol. More...
 
FCFSupport::DivisionTheDivision (int i)
 Division indexing function. More...
 
int NumberOfStations () const
 The number of stations loaded. More...
 
FCFSupport::StationTheStation (int i)
 Station indexing function. More...
 
const FCFSupport::StationFindStationByName (string name, string comment) const
 Station indexing (by name) function. More...
 
int NumberOfTrains () const
 The number of trains loaded. More...
 
TrainTrainByIndex (int i)
 Train indexing function. More...
 
const TrainFindTrainByIndex (int i) const
 Find a train by its index. More...
 
TrainTrainByName (const char *name)
 Train indexing (by name) function. More...
 
const TrainFindTrainByName (const char *name) const
 Find a train by its name. More...
 
int NumberOfIndustries () const
 Return the number of industries loaded. More...
 
FCFSupport::IndustryTheIndustry (int i)
 Industry indexing function. More...
 
const FCFSupport::IndustryFindIndustryByIndex (int i) const
 Find an industry by its index. More...
 
const FCFSupport::IndustryFindIndustryByName (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...
 
CarTypeTheCarType (char c)
 Get a car type class instance pointer given a car type. More...
 
CarGroupTheCarGroup (int i) const
 Get a car class instance pointer given a car group index. More...
 
int NumberOfCars () const
 
OwnerTheOwner (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::CarTheCar (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::IndustryIndScrapYard () 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::IndustryIndRipTrack ()
 Return a pointer to the RIP track (workbench). More...
 
const FCFSupport::IndustryIndRipTrackConst () 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...
 
CarGroupcarGroups [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...
 
DivisioncurDiv
 Current division. More...
 
IndustryoriginYard
 Origin Yard. More...
 
IndustrytrainLastLocation
 A trains last location. More...
 
IndustrycarDest
 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...
 

Detailed Description

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''.

Author
Robert Heller <heller@deepsoft.com>

Member Enumeration Documentation

◆ CarLocationType

Types of location report.

Enumerator
INDUSTRY 

Report by industry.

STATION 

Report by station.

DIVISION 

Report by division.

ALL 

Report on all locations.

◆ CarTypeReport

Types of car type reports.

Enumerator
All 

Report on all car types.

Type 

Report on one type.

Summary 

Report summary.

Constructor & Destructor Documentation

◆ System() [1/2]

FCFSupport::System::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.

References ~System().

◆ System() [2/2]

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.

Parameters
systemfilePathname to the system file.
seedSeed value for the random number generator.
outmessagePointer to a pointer to receive any error messages for any errors that might occur.

◆ ~System()

FCFSupport::System::~System ( )

The destructor frees all memory and generally cleans things up.

Referenced by System().

Member Function Documentation

◆ AddCar()

void FCFSupport::System::AddCar ( FCFSupport::Car newcar)
inline

Add a new car to the array of cars.

Parameters
newcarThe new car.

References cars.

◆ AddOwner()

void FCFSupport::System::AddOwner ( const char *  initials)
inline

Create a new owner given a set of initials.

Parameters
initialsThe new car owner's initials.

References owners.

◆ CarAssignment()

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.

Parameters
WIPWork in progress callback.
logLog message callback.
bannerShow banner callback.
outmessageBuffer pointer for error messages.

Referenced by Random().

◆ CarMovements()

int FCFSupport::System::CarMovements ( ) const
inline

Return the total number of car movements.

References carMovements.

◆ CarsAtDest()

int FCFSupport::System::CarsAtDest ( ) const
inline

Return the number of cars that are at their destinations.

References carsAtDest.

◆ CarsAtDest_CarsInTransit()

int FCFSupport::System::CarsAtDest_CarsInTransit ( ) const
inline

Return the number of cars at their destinations plus the number of cars in transit.

References carsAtDest_carsInTransit.

◆ CarsAtWorkBench()

int FCFSupport::System::CarsAtWorkBench ( ) const
inline

Return the number of cars on the RIP track (the workbench).

References carsAtWorkBench.

◆ CarsFile()

const char* FCFSupport::System::CarsFile ( ) const
inline

Return the Cars file's full path name.

References carsFile, and FCFSupport::PathName::FullPath().

◆ CarsInTransit()

int FCFSupport::System::CarsInTransit ( ) const
inline

Return the number of cars still in transit.

References carsInTransit.

◆ CarsMoved()

int FCFSupport::System::CarsMoved ( ) const
inline

Return the number of cars moved.

References carsMoved.

◆ CarsMovedMore()

int FCFSupport::System::CarsMovedMore ( ) const
inline

Return the number of cars moved more then three times.

References carsMovedMore.

◆ CarsMovedOnce()

int FCFSupport::System::CarsMovedOnce ( ) const
inline

Return the number of cars moved once.

References carsMovedOnce.

◆ CarsMovedThree()

int FCFSupport::System::CarsMovedThree ( ) const
inline

Return the number of cars moved three times.

References carsMovedThree.

◆ CarsMovedTwice()

int FCFSupport::System::CarsMovedTwice ( ) const
inline

Return the number of cars moved twice.

References carsMovedTwice.

◆ CarsNotMoved()

int FCFSupport::System::CarsNotMoved ( ) const
inline

Return the number of cars not moved at all.

References carsNotMoved.

◆ CarTypesFile()

const char* FCFSupport::System::CarTypesFile ( ) const
inline

Return the Car Types file's full path name.

References carTypesFile, and FCFSupport::PathName::FullPath().

◆ CarTypesOrder()

char FCFSupport::System::CarTypesOrder ( int  i) const
inline

Access a car type by index.

Parameters
iThe car type index.

References carTypesOrder, CarTypesOrderIndex(), i, and FCFSupport::CarType::MaxCarTypes.

◆ CarTypesOrderIndex()

int FCFSupport::System::CarTypesOrderIndex ( char  type) const

Car type order index.

Get the index of a car type.

Parameters
typeThe car type to lookup.

Referenced by CarTypesOrder().

◆ DeleteAllExistingCars()

void FCFSupport::System::DeleteAllExistingCars ( )

Delete all existing cars.

Referenced by RanAllTrains().

◆ FindCarInCarVector()

CarVector::iterator FCFSupport::System::FindCarInCarVector ( CarVector cvect,
Car car 
)
private

Find a car in a car vector.

Parameters
cvectThe car vector to search.
carThe car to search for.

◆ FindDivisionByIndex()

const Division* FCFSupport::System::FindDivisionByIndex ( int  i) const
inline

Find a division by its index.

Returns either a pointer to the division or NULL.

Parameters
iThe division index to look for.

References divisions, and FindDivisionBySymbol().

◆ FindDivisionBySymbol()

const Division* FCFSupport::System::FindDivisionBySymbol ( char  symbol) const

Find a division by its symbol.

Returns either a pointer to the division or NULL.

Parameters
symbolThe division symbol to look for.

Referenced by FindDivisionByIndex().

◆ FindDivisionIndex()

int FCFSupport::System::FindDivisionIndex ( const FCFSupport::Division division) const

Find a division's index.

Parameters
divisionThe division to look for.

◆ FindIndustry()

IndustryMap::iterator FCFSupport::System::FindIndustry ( Industry industry)
private

Find an industry in the industry map.

Parameters
industryThe industry to search for.

◆ FindIndustryByIndex()

const FCFSupport::Industry* FCFSupport::System::FindIndustryByIndex ( int  i) const
inline

Find an industry by its index.

Returns either a pointer to the industry or NULL.

Parameters
iThe industry index to look for.

References FindIndustryByName(), and industries.

◆ FindIndustryByName()

const FCFSupport::Industry* FCFSupport::System::FindIndustryByName ( string  name) const

Find an industry by its name.

Returns either a pointer to the industry or NULL.

Parameters
nameIndustry name to look for.

Referenced by FindIndustryByIndex().

◆ FindIndustryIndex()

int FCFSupport::System::FindIndustryIndex ( const FCFSupport::Industry industry) const

Find an industry's index.

Parameters
industryThe industry to look for.

◆ FindStationByName()

const FCFSupport::Station* FCFSupport::System::FindStationByName ( string  name,
string  comment 
) const

Station indexing (by name) function.

Returns NULL if the named station does not exist.

Parameters
nameStation name to access.

Referenced by TheStation().

◆ FindStationIndex()

int FCFSupport::System::FindStationIndex ( const FCFSupport::Station station) const

Find a station's index.

Parameters
stationThe station to look for.

◆ FindTrainByIndex()

const Train* FCFSupport::System::FindTrainByIndex ( int  i) const
inline

Find a train by its index.

Returns either a pointer to the train or NULL.

Parameters
iThe train index to look for.

References trains.

◆ FindTrainByName()

const Train* FCFSupport::System::FindTrainByName ( const char *  name) const
inline

Find a train by its name.

Returns either a pointer to the train or NULL.

Parameters
nameTrain name to look for.

References trainIndex.

◆ FirstCarType()

CarTypeMap::const_iterator FCFSupport::System::FirstCarType ( ) const
inline

Iterator of the first car type in the car type map.

References carTypes.

◆ FirstDivision()

DivisionMap::const_iterator FCFSupport::System::FirstDivision ( ) const
inline

Iterator of the first division in the division map.

References divisions.

◆ FirstIndustry()

IndustryMap::const_iterator FCFSupport::System::FirstIndustry ( ) const
inline

Iterator of the first industry in the industry map.

References industries.

◆ FirstOwner()

OwnerMap::const_iterator FCFSupport::System::FirstOwner ( ) const
inline

Iterator of the first owner in the owner map.

References owners.

◆ FirstStation()

StationMap::const_iterator FCFSupport::System::FirstStation ( ) const
inline

Iterator of the first station in the station map.

References stations.

◆ FirstTrain()

TrainMap::const_iterator FCFSupport::System::FirstTrain ( ) const
inline

Iterator of the first train in the train map.

References trains.

◆ FixedRouteMirrorCheck()

bool FCFSupport::System::FixedRouteMirrorCheck ( Car Cx,
Industry Ix 
)
private

Check to see if a certain car can be mirrored on a fixed route at a certain industry.

Parameters
CxThe car to check.
IxThe industry to check.

◆ FormatDutyTime()

const string FCFSupport::System::FormatDutyTime ( int  dutytimeminutes) const
private

Format the on duty time in a human readable format.

Parameters
dutytimeminutesThe duty time in minutes.

◆ GetCarStatus()

void FCFSupport::System::GetCarStatus ( const Car car,
string &  status,
string &  carTypeDescr 
) const

Return car status information.

Parameters
carThe car to look up.
statusIts status (loaded or empty).
carTypeDescrIts car type description.

◆ GetIndustryCarCounts()

void FCFSupport::System::GetIndustryCarCounts ( )
private

Update industry car counts.

◆ GlobStringMatch()

bool FCFSupport::System::GlobStringMatch ( const string  thestring,
const string  pattern 
) const
private

Glob style string match function.

Parameters
thestringThe string to match against.
patternThe glob pattern.

◆ GlobStringMatchHelper()

bool FCFSupport::System::GlobStringMatchHelper ( string::const_iterator  string_i,
string::const_iterator  string_e,
string::const_iterator  pattern_i,
string::const_iterator  pattern_e 
) const
private

Helper function for glob string matching.

Parameters
string_iThe current string index.
string_eThe end of the string.
pattern_iThe current pattern index.
pattern_eThe end of the pattern.

◆ IndRipTrack()

const FCFSupport::Industry* FCFSupport::System::IndRipTrack ( )
inline

Return a pointer to the RIP track (workbench).

References industries.

◆ IndRipTrackConst()

const FCFSupport::Industry* FCFSupport::System::IndRipTrackConst ( ) const
inline

Const version of the pointer to the RIP track (workbench).

References industries, and RestartLoop().

◆ IndScrapYard()

const FCFSupport::Industry* FCFSupport::System::IndScrapYard ( ) const
inline

Return a pointer to the scrap yard.

References indScrapYard.

◆ IndustriesFile()

const char* FCFSupport::System::IndustriesFile ( ) const
inline

Return the industry file's full path name.

References FCFSupport::PathName::FullPath(), and industriesFile.

◆ IndustryIndex()

int FCFSupport::System::IndustryIndex ( const FCFSupport::Industry indus) const

Return an industry's index.

Parameters
indusThe industry to lookup.

Referenced by StatsPeriod().

◆ IndustryTakesCar()

bool FCFSupport::System::IndustryTakesCar ( Industry Ix,
Car Cx 
)
private

Check if an industry takes a certain car.

Parameters
IxThe industry to check.
CxThe car to check.

◆ InternalRunOneTrain()

void FCFSupport::System::InternalRunOneTrain ( Train train,
bool  boxMove,
const FCFSupport::TrainDisplayCallback traindisplay,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Internal function to run a single train.

Parameters
trainThe train to run.
boxMoveIs this a box move?
traindisplayTrain display callback.
LogLog message callback.
printerPrinter device.

◆ LastCarType()

CarTypeMap::const_iterator FCFSupport::System::LastCarType ( ) const
inline

Iterator of one past the last car type in the car type map.

References carTypes.

◆ LastDivision()

DivisionMap::const_iterator FCFSupport::System::LastDivision ( ) const
inline

Iterator of one past the last division in the division map.

References divisions.

◆ LastIndustry()

IndustryMap::const_iterator FCFSupport::System::LastIndustry ( ) const
inline

Iterator of one past the last industry in the industry map.

References industries.

◆ LastOwner()

OwnerMap::const_iterator FCFSupport::System::LastOwner ( ) const
inline

Iterator of one past the last owner in the owner map.

References owners, SearchForCarIndexesByNumber(), SearchForIndustryPattern(), and SearchForTrainPattern().

◆ LastStation()

StationMap::const_iterator FCFSupport::System::LastStation ( ) const
inline

Iterator of one past the last station in the station map.

References stations.

◆ LastTrain()

TrainMap::const_iterator FCFSupport::System::LastTrain ( ) const
inline

Iterator of one past the last train in the train map.

References trains.

◆ LoadCarFile()

bool FCFSupport::System::LoadCarFile ( char **  outmessage = NULL)

(Re-)Load the car file.

Parameters
outmessageBuffer pointer for error messages.

Referenced by RanAllTrains(), and ReLoadCarFile().

◆ LoadStatsFile()

bool FCFSupport::System::LoadStatsFile ( char **  outmessage = NULL)

Load the stats file.

Parameters
outmessageBuffer pointer for error messages.

Referenced by RanAllTrains(), and ReLoadCarFile().

◆ LogCarPickup()

void FCFSupport::System::LogCarPickup ( Car car,
Train train,
bool  boxMove 
)
private

Log a car pickup in the switch list structure.

Parameters
carThe car picked up.
trainThe train that picked it up.
boxMoveIs this a box move?

◆ NextShift()

int FCFSupport::System::NextShift ( )
inline

Increment the shift number.

References sessionNumber, shiftNumber, and totalShifts.

◆ NumberOfCars()

int FCFSupport::System::NumberOfCars ( ) const
inline

References cars.

◆ NumberOfDivisions()

int FCFSupport::System::NumberOfDivisions ( ) const
inline

return the number of divisions loaded.

References divisions.

◆ NumberOfIndustries()

int FCFSupport::System::NumberOfIndustries ( ) const
inline

Return the number of industries loaded.

References industries.

◆ NumberOfStations()

int FCFSupport::System::NumberOfStations ( ) const
inline

The number of stations loaded.

References stations.

◆ NumberOfTrains()

int FCFSupport::System::NumberOfTrains ( ) const
inline

The number of trains loaded.

References trains.

◆ OrdersFile()

const char* FCFSupport::System::OrdersFile ( ) const
inline

Return the train orders file's full path name.

References FCFSupport::PathName::FullPath(), and ordersFile.

◆ OtherCarOkForTrain()

bool FCFSupport::System::OtherCarOkForTrain ( Car car,
Train train 
)
private

Check to see if this other car can be picked up.

Parameters
carThe car to check.
trainThe train to check.

◆ OwnersFile()

const char* FCFSupport::System::OwnersFile ( ) const
inline

Return the Owners file's full path name.

References FCFSupport::PathName::FullPath(), and ownersFile.

◆ PrintAllCarTypes()

void FCFSupport::System::PrintAllCarTypes ( bool  totalsOnly,
FCFSupport::PrinterDevice printer 
) const
private

Print all car types.

Parameters
totalsOnlyPrint only the totals?
printerPrinter device.

◆ PrintAllLists()

void FCFSupport::System::PrintAllLists ( const FCFSupport::LogMessageCallback Log,
const FCFSupport::ShowBannerCallback banner,
FCFSupport::PrinterDevice printer 
)

Print all of the various yard and switch lists.

Parameters
LogLog message callback.
bannerShow banner callback.
printerPrinter device.

Referenced by Random().

◆ PrintAlpha()

bool FCFSupport::System::PrintAlpha ( ) const
inline

Print the alphabetical listing flag.

References printAlpha.

◆ PrintAnalysisHeader()

void FCFSupport::System::PrintAnalysisHeader ( FCFSupport::PrinterDevice printer) const
private

Print an analysis header.

Parameters
printerPrinter device.

◆ PrintAtwice()

bool FCFSupport::System::PrintAtwice ( ) const
inline

Print second copy of the alphabetical listing flag.

References printAtwice.

◆ PrintCarHeading()

void FCFSupport::System::PrintCarHeading ( FCFSupport::PrinterDevice printer) const
private

Print the car heading.

Parameters
printerPrinter device.

◆ PrintCarTypesHeader()

void FCFSupport::System::PrintCarTypesHeader ( FCFSupport::PrinterDevice printer) const
private

Print the car type header.

Parameters
printerPrinter device.

◆ PrintCarTypesSummaryHeader()

void FCFSupport::System::PrintCarTypesSummaryHeader ( FCFSupport::PrinterDevice printer) const
private

Print car type summary header.

Parameters
printerPrinter device.

◆ PrintDashedLine()

void FCFSupport::System::PrintDashedLine ( FCFSupport::PrinterDevice printer) const
private

Print a dashed line.

Parameters
printerPrinter device.

◆ PrintDispatch()

bool FCFSupport::System::PrintDispatch ( ) const
inline

Print dispatcher report sheet.

References printDispatch.

◆ PrintDispatcher()

void FCFSupport::System::PrintDispatcher ( string  banner,
char  trainType,
FCFSupport::PrinterDevice printer 
) const
private

Print dispatcher report sheets.

Parameters
bannerSystem banner.
trainTypeType of train.
printerPrinter device.

◆ Printem()

bool FCFSupport::System::Printem ( ) const
inline

Print train enroute switch list.

References printem.

◆ PrintFormFeed()

void FCFSupport::System::PrintFormFeed ( FCFSupport::PrinterDevice printer) const
private

Print a form feed.

Parameters
printerPrinter device.

◆ PrintIndustryHeader()

void FCFSupport::System::PrintIndustryHeader ( FCFSupport::PrinterDevice printer) const
private

Print the industry header.

Parameters
printerPrinter device.

◆ PrintList()

bool FCFSupport::System::PrintList ( ) const
inline

Print the switch list order flag.

References printList.

◆ PrintLocCommon()

void FCFSupport::System::PrintLocCommon ( FCFSupport::PrinterDevice printer)
private

Print a header for all location reports.

Parameters
printerPrinter device.

◆ PrintLocOneIndustry()

void FCFSupport::System::PrintLocOneIndustry ( const FCFSupport::Industry Ix,
const FCFSupport::Station Sx,
bool &  firstOne,
FCFSupport::PrinterDevice printer 
) const
private

Print a location report for a single industry.

Parameters
IxThe industry to print a report for.
SxThe station to print a report for.
firstOneIs this the first one?
printerPrinter device.

◆ PrintLtwice()

bool FCFSupport::System::PrintLtwice ( ) const
inline

Print a second copy of the switch list order flag.

References printLtwice.

◆ PrintOneAnalysis()

void FCFSupport::System::PrintOneAnalysis ( const Industry Ix,
int &  carsToDiv,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
) const
private

Print one analysis report.

Parameters
IxThe industry.
carsToDivUpdated cars headed for the current division.
LogLog message callback.
printerPrinter device.

◆ PrintOneCarInfo()

void FCFSupport::System::PrintOneCarInfo ( const Car car,
FCFSupport::PrinterDevice printer 
) const
private

Print one car's information.

Parameters
carThe car whose information to print.
printerPrinter device.

◆ PrintOneCarLocation()

void FCFSupport::System::PrintOneCarLocation ( const Car car,
FCFSupport::PrinterDevice printer 
) const
private

Print one car location report.

Parameters
carThe car to print location information for.
printerPrinter device.

◆ PrintOneCarType()

void FCFSupport::System::PrintOneCarType ( bool  totalsOnly,
char  carType,
const CarType ct,
int &  OnLineShippersOfType,
int &  OffLineShippersOfType,
int &  OnLineReceiversOfType,
int &  OffLineReceiversOfType,
int &  allTotalMoves,
int &  allTotalAssigns,
FCFSupport::PrinterDevice printer 
) const
private

Print one car type.

Parameters
totalsOnlyPrint only the totals?
carTypeThe car type character.
ctThe car type object.
OnLineShippersOfTypeUpdated online shippers of this car type.
OffLineShippersOfTypeUpdated offline shippers of this car type.
OnLineReceiversOfTypeUpdated online receivers of this car type.
OffLineReceiversOfTypeUpdated offline receivers of this car type.
allTotalMovesUpdate total moves.
allTotalAssignsUpdated total assignments.
printerPrinter device.

◆ PrintOneIndustry()

void FCFSupport::System::PrintOneIndustry ( const Industry ix,
int &  lenInDiv,
int &  carsInDiv,
int &  carsToDiv,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
) const
private

Print one industry.

Parameters
ixThe industry.
lenInDivThe updated division length.
carsInDivThe updated cars in division count.
carsToDivThe updates cars headed to division count.
LogLog message callback.
printerPrinter device.

◆ PrintSystemBanner()

void FCFSupport::System::PrintSystemBanner ( FCFSupport::PrinterDevice printer) const
private

Print a system banner.

Parameters
printerPrinter device.

◆ PrintTrainLoc()

void FCFSupport::System::PrintTrainLoc ( Train train,
int  Px,
const FCFSupport::LogMessageCallback Log,
const FCFSupport::TrainDisplayCallback traindisplay 
)
private

Print a train's current location.

Parameters
trainThe train to print.
PxThe stop number that train is at.
LogLog message callback.
traindisplayTrain display callback.

◆ PrintTrainOrderHeader()

void FCFSupport::System::PrintTrainOrderHeader ( const FCFSupport::Train train,
FCFSupport::PrinterDevice printer 
)
private

Print a train order header.

Parameters
trainThe train to print a train order header for.
printerPrinter device.

◆ PrintTrainOrders()

void FCFSupport::System::PrintTrainOrders ( const Train train,
FCFSupport::PrinterDevice printer 
) const
private

Print the train orders for a selected train.

Parameters
trainThe train to print trains orders for.
printerPrinter device.

◆ PrintYards()

bool FCFSupport::System::PrintYards ( ) const
inline

Print yard lists flag.

References printYards.

◆ RanAllTrains()

int FCFSupport::System::RanAllTrains ( ) const
inline

◆ Random()

double FCFSupport::System::Random ( )
inline

◆ Randomize()

void FCFSupport::System::Randomize ( int  seed)
inline

Set the random seed.

Parameters
seedSeed value.

◆ ReadCarTypes()

bool FCFSupport::System::ReadCarTypes ( char **  outmessage = NULL)
private

Read in the car types file.

Parameters
outmessageBuffer pointer for error messages.

◆ ReadDivisions()

bool FCFSupport::System::ReadDivisions ( istream &  stream,
map< int, int, less< int > > &  homemap,
char **  outmessage = NULL 
)
private

Read in the division map.

Parameters
streamThe input stream to read from.
homemapThe map of home yards.
outmessageBuffer pointer for error messages.

◆ ReadGroupLimit()

bool FCFSupport::System::ReadGroupLimit ( istream &  stream,
const char *  label,
int &  value,
const char *  filename,
char **  outmessage = NULL 
)
private

Utility to read a group limit.

Parameters
streamThe input stream to read from.
labelThe label for the group limit.
valueThe limit value read.
filenameThe filename being read from.
outmessageBuffer pointer for error messages.

◆ ReadIndustries()

bool FCFSupport::System::ReadIndustries ( char **  outmessage = NULL)
private

Read in the industries file.

Parameters
outmessageBuffer pointer for error messages.

◆ ReadOwners()

bool FCFSupport::System::ReadOwners ( char **  outmessage = NULL)
private

Read in the owners file.

Parameters
outmessageBuffer pointer for error messages.

◆ ReadStations()

bool FCFSupport::System::ReadStations ( istream &  stream,
char **  outmessage = NULL 
)
private

Read in the station map.

Parameters
streamThe input stream to read from.
outmessageBuffer pointer for error messages.

◆ ReadTrainOrders()

bool FCFSupport::System::ReadTrainOrders ( char **  outmessage = NULL)
private

Read in the train orders file.

Parameters
outmessageBuffer pointer for error messages.

◆ ReadTrains()

bool FCFSupport::System::ReadTrains ( char **  outmessage = NULL)
private

Read in the trains file.

Parameters
outmessageBuffer pointer for error messages.

◆ ReLoadCarFile()

void FCFSupport::System::ReLoadCarFile ( char **  outmessage)
inline

Reload car file.

Parameters
outmessageBuffer pointer for error messages.

References LoadCarFile(), LoadStatsFile(), ReportCars(), ReportCarsNotMoved(), ReportIndustries(), ReportTrains(), ResetIndustryStats(), and RestartLoop().

◆ ReportAnalysis()

void FCFSupport::System::ReportAnalysis ( const FCFSupport::WorkInProgressCallback WIP,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
) const

Industry analysis report.

Parameters
WIPWork in progress callback.
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

◆ ReportCarLocations()

void FCFSupport::System::ReportCarLocations ( CarLocationType  cltype,
int  index,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
)

Car location report.

Parameters
cltypeType of report.
indexIndex of thing to report by (industry, station, or division).
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

◆ ReportCarOwners()

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.

Parameters
ownerInitialsCar owner's initials to report on.
WIPWork in progress callback.
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

◆ ReportCars()

void FCFSupport::System::ReportCars ( const FCFSupport::WorkInProgressCallback WIP,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
) const

Report on all cars.

Parameters
WIPWork in progress callback.
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

Referenced by ReLoadCarFile().

◆ ReportCarsNotMoved()

void FCFSupport::System::ReportCarsNotMoved ( const FCFSupport::WorkInProgressCallback WIP,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
) const

Report on cars not moved.

Parameters
WIPWork in progress callback.
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

Referenced by ReLoadCarFile().

◆ ReportCarTypes()

void FCFSupport::System::ReportCarTypes ( CarTypeReport  rtype,
char  carType,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
) const

Report on car types.

Parameters
rtypeType of report to produce.
carTypeCar type to report on (only used when the report type is for a single type).
printerPrinter device.
outmessageBuffer pointer for error messages.

◆ ReportIndustries()

void FCFSupport::System::ReportIndustries ( const FCFSupport::WorkInProgressCallback WIP,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
) const

Report on all industries.

Parameters
WIPWork in progress callback.
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

Referenced by ReLoadCarFile().

◆ ReportLocAll()

void FCFSupport::System::ReportLocAll ( bool  printBench,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
)
private

Print a location report for all locations.

Parameters
printBenchPrint cars at the workbench?
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

◆ ReportLocDivision()

void FCFSupport::System::ReportLocDivision ( DivisionMap::const_iterator  Dx,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
)
private

Print a location report for one division.

Parameters
DxThe division's index.
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

◆ ReportLocIndustry()

void FCFSupport::System::ReportLocIndustry ( IndustryMap::const_iterator  Ix,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
)
private

Print a location report for one industry.

Parameters
IxThe industry's index.
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

◆ ReportLocStation()

void FCFSupport::System::ReportLocStation ( StationMap::const_iterator  Sx,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
)
private

Print a location report for one station.

Parameters
SxThe station's index.
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

◆ ReportTrains()

void FCFSupport::System::ReportTrains ( const FCFSupport::WorkInProgressCallback WIP,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer,
char **  outmessage = NULL 
) const

Report on all trains.

Parameters
WIPWork in progress callback.
LogLog message callback.
printerPrinter device.
outmessageBuffer pointer for error messages.

Referenced by ReLoadCarFile().

◆ ResetIndustryStats()

void FCFSupport::System::ResetIndustryStats ( )

Reset industry statistics.

Referenced by ReLoadCarFile().

◆ RestartLoop()

void FCFSupport::System::RestartLoop ( )

Reset loop variables.

Referenced by IndRipTrackConst(), and ReLoadCarFile().

◆ RunAllTrains()

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.

Parameters
WIPWork in progress callback.
LogLog message callback.
bannerShow banner callback.
printerPrinter device.
traindisplayTrain display callback.

Referenced by Random().

◆ RunBoxMoves()

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.

Parameters
WIPWork in progress callback.
LogLog message callback.
bannerShow banner callback.
printerPrinter device.
traindisplayTrain display callback.

Referenced by Random().

◆ RunOneLocal()

void FCFSupport::System::RunOneLocal ( Train train,
bool  boxMove,
CarVector consist,
const FCFSupport::TrainDisplayCallback traindisplay,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

One one local train.

Parameters
trainThe train to run.
boxMoveIs this a box move?
consistThe train's consist.
traindisplayTrain display callback.
LogLog message callback.
printerPrinter device.

◆ RunOneManifest()

void FCFSupport::System::RunOneManifest ( Train train,
bool  boxMove,
CarVector consist,
const FCFSupport::TrainDisplayCallback traindisplay,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Run one manifest freight train.

Parameters
trainThe train to run.
boxMoveIs this a box move?
consistThe train's consist.
traindisplayTrain display callback.
LogLog message callback.
printerPrinter device.

◆ RunOnePassenger()

void FCFSupport::System::RunOnePassenger ( Train train,
bool  boxMove,
const FCFSupport::TrainDisplayCallback traindisplay,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

One one passenger train.

Parameters
trainThe train to run.
boxMoveIs this a box move?
traindisplayTrain display callback.
LogLog message callback.
printerPrinter device.

◆ RunOneTrain()

void FCFSupport::System::RunOneTrain ( Train train,
bool  boxMove,
const FCFSupport::TrainDisplayCallback traindisplay,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)

Run one single train.

Parameters
trainThe train to run.
boxMoveIs this a box move?
traindisplayTrain display callback.
LogLog message callback.
printerPrinter device.

Referenced by Random().

◆ SaveCars()

bool FCFSupport::System::SaveCars ( char **  outmessage = NULL)

Save cars (and stats).

Parameters
outmessageBuffer pointer for error messages.

Referenced by RanAllTrains().

◆ SearchForCarIndexesByNumber()

vector<int> FCFSupport::System::SearchForCarIndexesByNumber ( string  number,
bool  subStringP 
) const

Search for cars with a specificed number.

Parameters
numberThe number string to look for.
subStringPMatch the whole number or only the last few digits.

Referenced by LastOwner().

◆ SearchForIndustryPattern()

vector<int> FCFSupport::System::SearchForIndustryPattern ( string  industryNamePattern) const

Search for an industry by name given a glob pattern.

Parameters
industryNamePatternThe name pattern.

Referenced by LastOwner().

◆ SearchForTrainPattern()

vector<int> FCFSupport::System::SearchForTrainPattern ( string  trainNamePattern) const

Search for a train by name given a glob pattern.

Parameters
trainNamePatternThe name pattern.

Referenced by LastOwner().

◆ SessionNumber()

int FCFSupport::System::SessionNumber ( ) const
inline

Return the session number.

References sessionNumber.

◆ SetPrintAlpha()

void FCFSupport::System::SetPrintAlpha ( bool  flag)
inline

Set the print alphabetical listing flag.

Parameters
flagNew value to set the flag to.

References printAlpha.

◆ SetPrintAtwice()

void FCFSupport::System::SetPrintAtwice ( bool  flag)
inline

Set the print second copy of the alphabetical listing flag.

Parameters
flagNew value to set the flag to.

References printAtwice.

◆ SetPrintDispatch()

void FCFSupport::System::SetPrintDispatch ( bool  flag)
inline

Set the print dispatcher report sheet.

Parameters
flagNew value to set the flag to.

References printDispatch.

◆ SetPrintem()

void FCFSupport::System::SetPrintem ( bool  flag)
inline

Set the print train enroute switch list.

Parameters
flagNew value to set the flag to.

References printem.

◆ SetPrintList()

void FCFSupport::System::SetPrintList ( bool  flag)
inline

Set the print switch list order flag.

Parameters
flagNew value to set the flag to.

References printList.

◆ SetPrintLtwice()

void FCFSupport::System::SetPrintLtwice ( bool  flag)
inline

Set the print a second copy of the switch list order flag.

Parameters
flagNew value to set the flag to.

References printLtwice.

◆ SetPrintYards()

void FCFSupport::System::SetPrintYards ( bool  flag)
inline

Set the print yard lists flag.

Parameters
flagNew value to set the flag to.

References printYards.

◆ ShiftNumber()

int FCFSupport::System::ShiftNumber ( ) const
inline

Return the shift number.

References shiftNumber.

◆ ShowCarMovements()

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.

Parameters
showAllShow all movements?
IxShow movements by industry.
TxShow movements by train.
LogLog message callback.
bannerShow banner callback.

Referenced by Random().

◆ ShowCarsInDivision()

void FCFSupport::System::ShowCarsInDivision ( const Division division,
const FCFSupport::LogMessageCallback Log,
const FCFSupport::ShowBannerCallback banner 
) const

Show cars in a specificed division.

Parameters
divisionThe specific division.
LogLog message callback.
bannerShow banner callback.

Referenced by Random().

◆ ShowCarsNotMoved()

void FCFSupport::System::ShowCarsNotMoved ( const FCFSupport::LogMessageCallback Log,
const FCFSupport::ShowBannerCallback banner 
) const

Display cars not moved.

Parameters
LogLog message callback.
bannerShow banner callback.

Referenced by Random().

◆ ShowTrainCars()

void FCFSupport::System::ShowTrainCars ( const Train Tx,
const FCFSupport::LogMessageCallback Log,
const FCFSupport::ShowBannerCallback banner 
) const

Show cars moved by a specific train.

Parameters
TxThe specific train.
LogLog message callback.
bannerShow banner callback.

Referenced by Random().

◆ ShowTrainTotals()

void FCFSupport::System::ShowTrainTotals ( const FCFSupport::LogMessageCallback Log,
const FCFSupport::ShowBannerCallback banner 
) const

Show train totals.

Parameters
LogLog message callback.
bannerShow banner callback.

Referenced by Random().

◆ ShowUnassignedCars()

void FCFSupport::System::ShowUnassignedCars ( const FCFSupport::LogMessageCallback Log,
const FCFSupport::ShowBannerCallback banner 
) const

Show unassigned cars.

Parameters
LogLog message callback.
bannerShow banner callback.

Referenced by Random().

◆ SkipCommentsGets()

bool FCFSupport::System::SkipCommentsGets ( istream &  stream,
string &  buffer,
const char *  message,
char **  outmessage = NULL 
)
private

Utility to get a line after skipping any intervening comments.

Parameters
streamThe input stream to read from.
bufferThe result buffer.
messageError message to use if an error occurs.
outmessageBuffer pointer for error messages.

◆ split()

vector<string> FCFSupport::System::split ( string  s,
char  delimiter 
) const
private

Helper utility to split a string into words.

Parameters
sThe string to split.
delimiterThe delimiter character to split the string on.

◆ StatsFile()

const char* FCFSupport::System::StatsFile ( ) const
inline

Return the Statistics file's full path name.

References FCFSupport::PathName::FullPath(), and statsFile.

◆ StatsPeriod()

int FCFSupport::System::StatsPeriod ( ) const
inline

Return the current stats period.

References IndustryIndex(), statsPeriod, and TrainIndex().

◆ StringToInt()

bool FCFSupport::System::StringToInt ( string  str,
int &  result,
const char *  message,
char **  outmessage = NULL 
) const
private

Convert a string to an integer.

Parameters
strThe string to convert.
resultThe converted integer result buffer.
messageThe message to use in case there is an error.
outmessageBuffer pointer for error messages.

◆ StringToIntRange()

bool FCFSupport::System::StringToIntRange ( string  str,
int &  result,
int  minv,
int  maxv,
const char *  message,
char **  outmessage = NULL 
) const
private

Convert a string to an integer and check its range.

Parameters
strThe string to convert.
resultThe converted integer result buffer.
minvThe permitted minimum value.
maxvThe permitted maximum value.
messageThe message to use in case there is an error.
outmessageBuffer pointer for error messages.

◆ SystemFile()

const char* FCFSupport::System::SystemFile ( ) const
inline

Return the system file's full path name.

References FCFSupport::PathName::FullPath(), and systemFile.

◆ SystemName()

const char* FCFSupport::System::SystemName ( ) const
inline

Return the system name.

This is read from the system file.

References systemName.

◆ TheCar()

FCFSupport::Car* FCFSupport::System::TheCar ( int  i) const
inline

Get a car by index.

Parameters
iThe car's index.

References cars, and i.

◆ TheCarGroup()

CarGroup* FCFSupport::System::TheCarGroup ( int  i) const
inline

Get a car class instance pointer given a car group index.

Parameters
iThe car group index.

References carGroups, i, and FCFSupport::CarGroup::MaxCarGroup.

◆ TheCarType()

CarType* FCFSupport::System::TheCarType ( char  c)
inline

Get a car type class instance pointer given a car type.

Parameters
cThe car type to lookup.

References carTypes.

◆ TheDivision()

FCFSupport::Division* FCFSupport::System::TheDivision ( int  i)
inline

Division indexing function.

Warning: if the division at the specificed index does not already exist, a new element is allocated with a NULL pointer.

Parameters
iThe division index to access.

References divisions, and i.

◆ TheIndustry()

FCFSupport::Industry* FCFSupport::System::TheIndustry ( int  i)
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.

Parameters
iThe industry index to access.

References i, and industries.

◆ TheOwner()

Owner* FCFSupport::System::TheOwner ( const char *  initials)
inline

Get a car owner class instance pointer given a car owner's initials.

Parameters
initialsThe car owner's initials.

References owners.

◆ TheStation()

FCFSupport::Station* FCFSupport::System::TheStation ( int  i)
inline

Station indexing function.

Warning: if the station at the specificed index does not already exist, a new element is allocated with a NULL pointer.

Parameters
iThe station index to access.

References FindStationByName(), i, and stations.

◆ Today()

const string FCFSupport::System::Today ( ) const
private

Return today's date.

◆ TotalCars()

int FCFSupport::System::TotalCars ( ) const
inline

Return the total number of cars.

References cars.

◆ TotalShifts()

int FCFSupport::System::TotalShifts ( ) const
inline

Return the total number of shifts.

References totalShifts.

◆ TrainByIndex()

Train* FCFSupport::System::TrainByIndex ( int  i)
inline

Train indexing function.

Warning: if the train at the specificed index does not already exist, a new element is allocated with a NULL pointer.

Parameters
iThe train index to access.

References i, and trains.

◆ TrainByName()

Train* FCFSupport::System::TrainByName ( const char *  name)
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.

Parameters
nameTrain name to access.

References trainIndex.

◆ TrainCarPickupCheck()

bool FCFSupport::System::TrainCarPickupCheck ( Car car,
Train train,
bool  boxMove,
CarVector consist,
bool &  didAction,
int  Px,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Check to see if we can really pick up this car.

Parameters
carThe car to check.
trainThe train to pick up the car for.
boxMoveIs this a box move?
consistThe train's consist.
didActionFlag to set if something was done.
PxThe stop number that train is at.
LogLog message callback.
printerPrinter device.

◆ TrainDropAllCars()

void FCFSupport::System::TrainDropAllCars ( Train train,
int  Px,
CarVector consist,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Drop all cars from a train at the current stop (usually the last stop).

Parameters
trainThe train to drop cars from.
PxThe stop number that train is at.
consistThe train's consist.
LogLog message callback.
printerPrinter device.

◆ TrainDropOneCar()

void FCFSupport::System::TrainDropOneCar ( Car car,
Train train,
CarVector::iterator  Lx,
CarVector consist,
bool &  didAction,
int  Px,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Drop a single car.

Parameters
carThe car to drop.
trainThe train to drop the car from.
LxThe index of the car to drop.
consistThe train's consist.
didActionFlag to set if something was done.
PxThe stop number that train is at.
LogLog message callback.
printerPrinter device.

◆ TrainIndex()

int FCFSupport::System::TrainIndex ( const FCFSupport::Train train) const

Return a train's index.

Parameters
trainThe train to lookup.

Referenced by StatsPeriod().

◆ TrainLocalDrops()

void FCFSupport::System::TrainLocalDrops ( Train train,
int  Px,
CarVector consist,
bool &  didAction,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Drop cars from a local (box move or way freight).

Parameters
trainThe train to drop cars from.
PxThe stop number that train is at.
consistThe train's consist.
didActionFlag to set if something was done.
LogLog message callback.
printerPrinter device.

◆ TrainLocalOriginate()

void FCFSupport::System::TrainLocalOriginate ( Train train,
bool  boxMove,
int  Px,
CarVector consist,
bool &  didAction,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Make up a local train.

Parameters
trainThe train to make up.
boxMoveIs this a box move?
PxThe stop number that train is at.
consistThe train's consist.
didActionFlag to set if something was done.
LogLog message callback.
printerPrinter device.

◆ TrainLocalPickups()

void FCFSupport::System::TrainLocalPickups ( Train train,
bool  boxMove,
int  Px,
CarVector consist,
bool &  didAction,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Pick up cars for a local train (box move or way freight).

Parameters
trainThe train to pick up cars for.
boxMoveIs this a box move?
PxThe stop number that train is at.
consistThe train's consist.
didActionFlag to set if something was done.
LogLog message callback.
printerPrinter device.

◆ TrainManifestDrops()

void FCFSupport::System::TrainManifestDrops ( Train train,
int  Px,
CarVector consist,
bool &  didAction,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Drop cars from a manifest freight.

Parameters
trainThe train to drop cars from.
PxThe stop number that train is at.
consistThe train's consist.
didActionFlag to set if something was done.
LogLog message callback.
printerPrinter device.

◆ TrainManifestPickups()

void FCFSupport::System::TrainManifestPickups ( Train train,
bool  boxMove,
int  Px,
CarVector consist,
bool &  didAction,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Pick up cars for a manifest freight train.

Parameters
trainThe train to pick up cars for.
boxMoveIs this a box move?
PxThe stop number that train is at.
consistThe train's consist.
didActionFlag to set if something was done.
LogLog message callback.
printerPrinter device.

◆ TrainPickupOneCar()

void FCFSupport::System::TrainPickupOneCar ( Car car,
Train train,
bool  boxMove,
CarVector consist,
bool &  didAction,
int  Px,
CarVector::iterator  Lx,
const FCFSupport::LogMessageCallback Log,
FCFSupport::PrinterDevice printer 
)
private

Pick up one car.

Parameters
carThe car to possibly pick up.
trainThe train to pick up the car for.
boxMoveIs this a box move?
consistThe train's consist.
didActionFlag to set if something was done.
PxThe stop number that train is at.
LxPlace in the train to put the car if it is picked up.
LogLog message callback.
printerPrinter device.

◆ TrainPrintConsistSummary()

void FCFSupport::System::TrainPrintConsistSummary ( Train train,
CarVector consist,
FCFSupport::PrinterDevice printer 
)
private

Print a train's consist summary.

Parameters
trainThe train to print a summary for.
consistThe train's consist.
printerPrinter device.

◆ TrainPrintFinalSummary()

void FCFSupport::System::TrainPrintFinalSummary ( Train train,
FCFSupport::PrinterDevice printer 
)
private

Print a train's final summary.

Parameters
trainThe train to print the final summary for.
printerPrinter device.

◆ TrainPrintTown()

void FCFSupport::System::TrainPrintTown ( const FCFSupport::Train train,
const FCFSupport::Station curStation,
FCFSupport::PrinterDevice printer 
)
private

Print the town a train is in.

Parameters
trainThe train to print the town for.
curStationThe current station.
printerPrinter device.

◆ TrainsFile()

const char* FCFSupport::System::TrainsFile ( ) const
inline

Return the trains file's full path name.

References FCFSupport::PathName::FullPath(), and trainsFile.

◆ trim()

string FCFSupport::System::trim ( string  line) const
private

Helper utility function to trim white space off the ends of a string.

Parameters
lineThe string to trim.

◆ UpperCase()

const string FCFSupport::System::UpperCase ( const string  str) const
private

Convert a string to all uppercase letters.

Parameters
strThe string to convert.

◆ WriteOneCarToDisk()

bool FCFSupport::System::WriteOneCarToDisk ( Car car,
ostream &  stream 
)
private

Function to write one car to disk.

Parameters
carThe car to write.
streamThe output stream to write to.

Member Data Documentation

◆ carDest

Industry* FCFSupport::System::carDest
private

A temporary for a car's location.

◆ carGroups

CarGroup* FCFSupport::System::carGroups[CarGroup::MaxCarGroup]
private

Car group vector.

Referenced by TheCarGroup().

◆ carMovements

int FCFSupport::System::carMovements
private

The number of cars movements.

Referenced by CarMovements().

◆ cars

CarVector FCFSupport::System::cars
private

Car vector.

Referenced by AddCar(), NumberOfCars(), TheCar(), and TotalCars().

◆ carsAtDest

int FCFSupport::System::carsAtDest
private

The number of cars at their destinations.

Referenced by CarsAtDest().

◆ carsAtDest_carsInTransit

int FCFSupport::System::carsAtDest_carsInTransit
private

The number of cars at their destinations and still in transit.

Referenced by CarsAtDest_CarsInTransit().

◆ carsAtWorkBench

int FCFSupport::System::carsAtWorkBench
private

The number of cars at the workbench.

Referenced by CarsAtWorkBench().

◆ carsFile

PathName FCFSupport::System::carsFile
private

Full pathname of the cars file.

Referenced by CarsFile().

◆ carsInTransit

int FCFSupport::System::carsInTransit
private

The number of cars in transit.

Referenced by CarsInTransit().

◆ carsMoved

int FCFSupport::System::carsMoved
private

The number of cars moved.

Referenced by CarsMoved().

◆ carsMovedMore

int FCFSupport::System::carsMovedMore
private

The number of cars moved more then three times.

Referenced by CarsMovedMore().

◆ carsMovedOnce

int FCFSupport::System::carsMovedOnce
private

The number of cars moved one time.

Referenced by CarsMovedOnce().

◆ carsMovedThree

int FCFSupport::System::carsMovedThree
private

The number of cars moved three times.

Referenced by CarsMovedThree().

◆ carsMovedTwice

int FCFSupport::System::carsMovedTwice
private

The number of cars moved two times.

Referenced by CarsMovedTwice().

◆ carsNotMoved

int FCFSupport::System::carsNotMoved
private

The number of cars not moved.

Referenced by CarsNotMoved().

◆ carTypes

CarTypeMap FCFSupport::System::carTypes
private

Car type map.

Referenced by FirstCarType(), LastCarType(), and TheCarType().

◆ carTypesFile

PathName FCFSupport::System::carTypesFile
private

Full pathname of the car types file.

Referenced by CarTypesFile().

◆ carTypesOrder

char FCFSupport::System::carTypesOrder[CarType::MaxCarTypes]
private

Car type order vector.

Referenced by CarTypesOrder().

◆ curDiv

Division* FCFSupport::System::curDiv
private

Current division.

◆ deliver

bool FCFSupport::System::deliver
private

Deliver flag.

◆ divisions

DivisionMap FCFSupport::System::divisions
private

◆ indScrapYard

const FCFSupport::Industry FCFSupport::System::indScrapYard
private

The pointer to the scrapyard.

Referenced by IndScrapYard().

◆ industries

IndustryMap FCFSupport::System::industries
private

◆ industriesFile

PathName FCFSupport::System::industriesFile
private

Full pathname of the industries file.

Referenced by IndustriesFile().

◆ messageBuffer

char FCFSupport::System::messageBuffer[2048]
private

Message buffer, used for error messages mostly.

◆ numberCars

int FCFSupport::System::numberCars
private

The number of cars on a train.

◆ ordersFile

PathName FCFSupport::System::ordersFile
private

Full pathname of the train orders file.

Referenced by OrdersFile().

◆ originYard

Industry* FCFSupport::System::originYard
private

Origin Yard.

◆ owners

OwnerMap FCFSupport::System::owners
private

Car owner map.

Referenced by AddOwner(), FirstOwner(), LastOwner(), and TheOwner().

◆ ownersFile

PathName FCFSupport::System::ownersFile
private

Full pathname of the car owners file.

Referenced by OwnersFile().

◆ printAlpha

bool FCFSupport::System::printAlpha
private

Flag for printing alphabetical lists.

Referenced by PrintAlpha(), and SetPrintAlpha().

◆ printAtwice

bool FCFSupport::System::printAtwice
private

Flag for printing a second copy of alphabetical lists.

Referenced by PrintAtwice(), and SetPrintAtwice().

◆ printDispatch

bool FCFSupport::System::printDispatch
private

Flag for printing a dispatcher's report.

Referenced by PrintDispatch(), and SetPrintDispatch().

◆ printem

bool FCFSupport::System::printem
private

Flag for printing train movements.

Referenced by Printem(), and SetPrintem().

◆ printList

bool FCFSupport::System::printList
private

Flag for printing train switch lists.

Referenced by PrintList(), and SetPrintList().

◆ printLtwice

bool FCFSupport::System::printLtwice
private

Flag for printing a second copy of train switch lists.

Referenced by PrintLtwice(), and SetPrintLtwice().

◆ printYards

bool FCFSupport::System::printYards
private

Flag for printing yard switch lists.

Referenced by PrintYards(), and SetPrintYards().

◆ ranAllTrains

int FCFSupport::System::ranAllTrains
private

The ran all trains flag.

Referenced by RanAllTrains().

◆ sessionNumber

int FCFSupport::System::sessionNumber
private

Current session number.

Referenced by NextShift(), and SessionNumber().

◆ shiftNumber

int FCFSupport::System::shiftNumber
private

Current shift number.

Referenced by NextShift(), and ShiftNumber().

◆ stations

StationMap FCFSupport::System::stations
private

◆ statsFile

PathName FCFSupport::System::statsFile
private

Full pathname of the stats file.

Referenced by StatsFile().

◆ statsPeriod

int FCFSupport::System::statsPeriod
private

The current stats period.

Referenced by StatsPeriod().

◆ switchList

SwitchList FCFSupport::System::switchList
private

Switch lists.

◆ systemFile

PathName FCFSupport::System::systemFile
private

Full pathname of the system file.

Referenced by SystemFile().

◆ systemName

string FCFSupport::System::systemName
private

The system name.

Referenced by SystemName().

◆ totalLoads

int FCFSupport::System::totalLoads
private

The total number of loads.

◆ totalPickups

int FCFSupport::System::totalPickups
private

The total number of pickups.

◆ totalRevenueTons

int FCFSupport::System::totalRevenueTons
private

The total number of revenue tons.

◆ totalShifts

int FCFSupport::System::totalShifts
private

The total number of shifts.

Referenced by NextShift(), and TotalShifts().

◆ totalTons

int FCFSupport::System::totalTons
private

The total number of tons.

◆ trainEmpties

int FCFSupport::System::trainEmpties
private

The number of empties on a train.

◆ trainIndex

TrainNameMap FCFSupport::System::trainIndex
private

Train name map.

Referenced by FindTrainByName(), and TrainByName().

◆ trainLastLocation

Industry* FCFSupport::System::trainLastLocation
private

A trains last location.

◆ trainLength

int FCFSupport::System::trainLength
private

Train length.

◆ trainLoads

int FCFSupport::System::trainLoads
private

The number of loads on a train.

◆ trainLongest

int FCFSupport::System::trainLongest
private

The longest a train has been.

◆ trainPrintOK

bool FCFSupport::System::trainPrintOK
private

Train print flag.

◆ trains

TrainMap FCFSupport::System::trains
private

◆ trainsFile

PathName FCFSupport::System::trainsFile
private

Full pathname of the trains file.

Referenced by TrainsFile().

◆ trainTons

int FCFSupport::System::trainTons
private

The number of tons on a train.

◆ wayFreight

bool FCFSupport::System::wayFreight
private

Way freight flag.

◆ whitespace

const string FCFSupport::System::whitespace
staticprivate

String of white space characters.