Model Railroad System  2.2.2
Classes | Public Types | Public Member Functions | Private Attributes | Friends | List of all members
FCFSupport::Train Class Reference

The Train class represents a train. More...

#include <Train.h>

Classes

union  StationOrIndustry
 Union of stations or industries, used for stops. More...
 

Public Types

enum  TrainType {
  Unknown = 0 , Wayfreight = 'W' , BoxMove = 'B' , Manifest = 'M' ,
  Passenger = 'P'
}
 Types of trains. More...
 

Public Member Functions

 Train ()
 Default constructor. More...
 
 Train (Train &other)
 Copy construtor. More...
 
Trainoperator= (Train &other)
 Assignment operator. More...
 
 Train (const char *n, const char *dl, const char *ct, const char *descr, int sh, int mc, int mcl, int mw, int ml, int od, bool p, bool d, TrainType t)
 Full constructor. More...
 
 ~Train ()
 Descructor. More...
 
const char * Name () const
 Return the train's name. More...
 
const char * DivisionList () const
 Return the train's division list (string of symbols). More...
 
const char * CarTypes () const
 Return the train's car type list (string of char type characters). More...
 
const char * Description () const
 Return the train's description. More...
 
int Shift () const
 Return the train's shift. More...
 
void SetShift (int newshift)
 Set the train's shift. More...
 
int MaxCars () const
 Return the train's maximum number of cars. More...
 
int MaxClear () const
 Return the train's maximum clearance plate. More...
 
int MaxWeight () const
 Return the train's maximum weight class. More...
 
void SetMaxWeight (int newmaxweight)
 Set the train's maximum weight class. More...
 
int MaxLength () const
 Return the train's maximum length. More...
 
void SetMaxLength (int newmaxlength)
 Set the train's maximum length. More...
 
int OnDuty () const
 Return the train's on duty time, in minutes since midnight. More...
 
bool Print () const
 Return the train's print flag. More...
 
void SetPrint (bool flag)
 Set the train's print flag. More...
 
bool Done () const
 Return the train's done flag. More...
 
TrainType Type () const
 Return the train's type. More...
 
int NumberOfOrders () const
 Return the number of train orders for this train. More...
 
const char * Order (int index) const
 Return the Ith order. More...
 
int NumberOfStops () const
 Return the number of stops this train makes. More...
 
FCFSupport::IndustryIndustryStop (int index) const
 Return the Ith industry stop this train makes. More...
 
StationStationStop (int index) const
 Return the Ith station stop this train makes. More...
 

Private Attributes

vector< string > orders
 List of train orders. More...
 
vector< StationOrIndustrystops
 List of stops. More...
 
string name
 Name of the train. More...
 
string divList
 The list of division symbols for this train. More...
 
string carTypes
 The list of car type charactes. More...
 
string description
 The description of the train. More...
 
int shift
 The train's shift. More...
 
int maxcars
 The maximum number of cars on this train. More...
 
int maxclear
 The maximum clearance plate for this train. More...
 
int maxweight
 The maximum weight class for this train. More...
 
int maxlength
 The maximum length for this train. More...
 
int onduty
 The onduty time for this train, in minutes since midnight. More...
 
bool print
 The print flag for this train. More...
 
bool done
 The done flag for this train. More...
 
TrainType type
 The type of this train. More...
 

Friends

class System
 The System class is a friend. More...
 

Detailed Description

The Train class represents a train.

A train has a name, a type, a description, a list of divisions it operates in, it takes a specific set of car types, operates during a specific shift (or possibly all shifts if it is a box movement), a set of stops it makes, an on duty time, a maximum number of cars, a maximum clearance plate, a maximum weight class, a maximum length and several flags.

Author
Robert Heller <heller@deepsoft.com>

Member Enumeration Documentation

◆ TrainType

Types of trains.

Enumerator
Unknown 

An unknown type of train.

Wayfreight 

A Way Freight train.

BoxMove 

A Box Move train.

Manifest 

A Manifest Freight train.

Passenger 

A Passenger train.

Constructor & Destructor Documentation

◆ Train() [1/3]

FCFSupport::Train::Train ( )
inline

Default constructor.

Initialize all slots to empty values.

References carTypes, description, divList, done, maxcars, maxclear, maxlength, maxweight, name, onduty, print, shift, type, and Unknown.

◆ Train() [2/3]

FCFSupport::Train::Train ( Train other)
inline

Copy construtor.

Copy initial values from another instance.

Parameters
otherThe other Train instance.

References carTypes, description, divList, done, maxcars, maxclear, maxlength, maxweight, name, onduty, orders, print, shift, stops, and type.

◆ Train() [3/3]

FCFSupport::Train::Train ( const char *  n,
const char *  dl,
const char *  ct,
const char *  descr,
int  sh,
int  mc,
int  mcl,
int  mw,
int  ml,
int  od,
bool  p,
bool  d,
TrainType  t 
)
inline

Full constructor.

Initialize the class instance from a set of parameters.

Parameters
nThe new train's name.
dlThe new train's division list.
ctThe new train's car type list.
descrThe New train's description.
shThe new train's shift.
mcThe new train's maximum car limit.
mclThe new train's maximum clearance plate.
mwThe new train's maximum weight class.
mlThe new train's maximum length.
odThe new train's on duty time (in minutes since midnight).
pA flag to indicate if a pickup / dropoff sheet should be printed for this train.
dA flag to indicate if this train is done.
tThe new train's type.

References carTypes, description, divList, done, maxcars, maxclear, maxlength, maxweight, name, onduty, print, shift, and type.

◆ ~Train()

FCFSupport::Train::~Train ( )
inline

Descructor.

Member Function Documentation

◆ CarTypes()

const char* FCFSupport::Train::CarTypes ( ) const
inline

Return the train's car type list (string of char type characters).

References carTypes.

◆ Description()

const char* FCFSupport::Train::Description ( ) const
inline

Return the train's description.

References description.

◆ DivisionList()

const char* FCFSupport::Train::DivisionList ( ) const
inline

Return the train's division list (string of symbols).

References divList.

◆ Done()

bool FCFSupport::Train::Done ( ) const
inline

Return the train's done flag.

References done.

◆ IndustryStop()

FCFSupport::Industry* FCFSupport::Train::IndustryStop ( int  index) const
inline

Return the Ith industry stop this train makes.

Parameters
indexThe index of the the stop to retrieve.

References Manifest, stops, and type.

Referenced by FCFSupport::SwitchListElement::DropStopEQ().

◆ MaxCars()

int FCFSupport::Train::MaxCars ( ) const
inline

Return the train's maximum number of cars.

References maxcars.

◆ MaxClear()

int FCFSupport::Train::MaxClear ( ) const
inline

Return the train's maximum clearance plate.

References maxclear.

◆ MaxLength()

int FCFSupport::Train::MaxLength ( ) const
inline

Return the train's maximum length.

References maxlength.

◆ MaxWeight()

int FCFSupport::Train::MaxWeight ( ) const
inline

Return the train's maximum weight class.

References maxweight.

◆ Name()

const char* FCFSupport::Train::Name ( ) const
inline

Return the train's name.

References name.

◆ NumberOfOrders()

int FCFSupport::Train::NumberOfOrders ( ) const
inline

Return the number of train orders for this train.

References orders.

◆ NumberOfStops()

int FCFSupport::Train::NumberOfStops ( ) const
inline

Return the number of stops this train makes.

References stops.

◆ OnDuty()

int FCFSupport::Train::OnDuty ( ) const
inline

Return the train's on duty time, in minutes since midnight.

References onduty.

◆ operator=()

Train& FCFSupport::Train::operator= ( Train other)
inline

Assignment operator.

Copy values from another instance.

Parameters
otherThe other Train instance.

References carTypes, description, divList, done, maxcars, maxclear, maxlength, maxweight, name, onduty, orders, print, shift, stops, and type.

◆ Order()

const char* FCFSupport::Train::Order ( int  index) const
inline

Return the Ith order.

Parameters
indexThe index of the order to retrieve.

References orders.

◆ Print()

bool FCFSupport::Train::Print ( ) const
inline

Return the train's print flag.

References print.

◆ SetMaxLength()

void FCFSupport::Train::SetMaxLength ( int  newmaxlength)
inline

Set the train's maximum length.

Parameters
newmaxlengthNew maximum length.

References maxlength.

◆ SetMaxWeight()

void FCFSupport::Train::SetMaxWeight ( int  newmaxweight)
inline

Set the train's maximum weight class.

Parameters
newmaxweightNew maximum weight class.

References maxweight.

◆ SetPrint()

void FCFSupport::Train::SetPrint ( bool  flag)
inline

Set the train's print flag.

Parameters
flagThe new flag value.

References print.

◆ SetShift()

void FCFSupport::Train::SetShift ( int  newshift)
inline

Set the train's shift.

Parameters
newshiftThe new shift.

References shift.

◆ Shift()

int FCFSupport::Train::Shift ( ) const
inline

Return the train's shift.

References shift.

◆ StationStop()

Station* FCFSupport::Train::StationStop ( int  index) const
inline

Return the Ith station stop this train makes.

Parameters
indexThe index of the the stop to retrieve.

References Manifest, stops, and type.

Referenced by FCFSupport::SwitchListElement::DropStopEQ().

◆ Type()

TrainType FCFSupport::Train::Type ( ) const
inline

Friends And Related Function Documentation

◆ System

friend class System
friend

The System class is a friend.

Member Data Documentation

◆ carTypes

string FCFSupport::Train::carTypes
private

The list of car type charactes.

Referenced by CarTypes(), operator=(), and Train().

◆ description

string FCFSupport::Train::description
private

The description of the train.

Referenced by Description(), operator=(), and Train().

◆ divList

string FCFSupport::Train::divList
private

The list of division symbols for this train.

Referenced by DivisionList(), operator=(), and Train().

◆ done

bool FCFSupport::Train::done
private

The done flag for this train.

Referenced by Done(), operator=(), and Train().

◆ maxcars

int FCFSupport::Train::maxcars
private

The maximum number of cars on this train.

Referenced by MaxCars(), operator=(), and Train().

◆ maxclear

int FCFSupport::Train::maxclear
private

The maximum clearance plate for this train.

Referenced by MaxClear(), operator=(), and Train().

◆ maxlength

int FCFSupport::Train::maxlength
private

The maximum length for this train.

Referenced by MaxLength(), operator=(), SetMaxLength(), and Train().

◆ maxweight

int FCFSupport::Train::maxweight
private

The maximum weight class for this train.

Referenced by MaxWeight(), operator=(), SetMaxWeight(), and Train().

◆ name

string FCFSupport::Train::name
private

Name of the train.

Referenced by Name(), operator=(), and Train().

◆ onduty

int FCFSupport::Train::onduty
private

The onduty time for this train, in minutes since midnight.

Referenced by OnDuty(), operator=(), and Train().

◆ orders

vector<string> FCFSupport::Train::orders
private

List of train orders.

Referenced by NumberOfOrders(), operator=(), Order(), and Train().

◆ print

bool FCFSupport::Train::print
private

The print flag for this train.

Referenced by operator=(), Print(), SetPrint(), and Train().

◆ shift

int FCFSupport::Train::shift
private

The train's shift.

Referenced by operator=(), SetShift(), Shift(), and Train().

◆ stops

vector<StationOrIndustry> FCFSupport::Train::stops
private

List of stops.

Referenced by IndustryStop(), NumberOfStops(), operator=(), StationStop(), and Train().

◆ type

TrainType FCFSupport::Train::type
private

The type of this train.

Referenced by IndustryStop(), operator=(), StationStop(), Train(), and Type().