Model Railroad System  2.2.1
Public Member Functions | Private Attributes | Friends | List of all members
FCFSupport::SwitchList Class Reference

The global switch list structure. More...

#include <SwitchList.h>

Public Member Functions

 SwitchList ()
 Constructor. More...
 
 ~SwitchList ()
 Destructor. More...
 
void ResetSwitchList ()
 Reset the switch list pointer. More...
 
void DiscardSwitchList ()
 Clobber the switch list. More...
 
void AddSwitchListElement (const Industry *pickloc, const Car *pickcar, const Train *picktrain, const Train *lasttrain, const Industry *istop)
 Add a switch list element for a manifest freight (industry stop). More...
 
void AddSwitchListElement (const Industry *pickloc, const Car *pickcar, const Train *picktrain, const Train *lasttrain, const Station *sstop)
 Add a switch list element for a local freight (station stop). More...
 
SwitchListElementoperator[] (int ielement)
 Random index access to the switch list. More...
 
const SwitchListElement operator[] (int ielement) const
 Random index access to the switch list, const version. More...
 
int NextSwitchListForCarAndIndustry (const Car *car, const Industry *industry)
 Return the next switch list list element for a selected car and industry. More...
 
unsigned int PickIndex () const
 Return the pick index. More...
 
int LimitCars () const
 Return the limit count. More...
 
void ResetLastIndex ()
 Reset the last index. More...
 
bool PickLocationEq (int Gx, const Industry *Ix) const
 Is the selected element for the specificed industry? More...
 
bool PickCarEq (int Gx, const Car *Cx) const
 Is the selected element for the specificed car? More...
 
bool PickTrainEq (int Gx, const Train *Tx) const
 Is the selected element for the specificed train? More...
 

Private Attributes

SwitchListElementVector theList
 The switch list vector. More...
 
unsigned int pickIndex
 The pick index. More...
 
int limitCars
 The limit index. More...
 
int lastIndex
 The last index. More...
 

Friends

ostream & operator<< (ostream &stream, const SwitchList &list)
 Output stream operator for switch lists. More...
 

Detailed Description

The global switch list structure.

Author
Robert Heller <heller@deepsoft.com>

Constructor & Destructor Documentation

◆ SwitchList()

FCFSupport::SwitchList::SwitchList ( )

Constructor.

◆ ~SwitchList()

FCFSupport::SwitchList::~SwitchList ( )

Destructor.

Member Function Documentation

◆ AddSwitchListElement() [1/2]

void FCFSupport::SwitchList::AddSwitchListElement ( const Industry pickloc,
const Car pickcar,
const Train picktrain,
const Train lasttrain,
const Industry istop 
)

Add a switch list element for a manifest freight (industry stop).

Parameters
picklocPickup location of car.
pickcarCar being picked up by this train.
picktrainTrain picking this car up.
lasttrainThe last train this car was on.
istopWhere this train will drop this car.

◆ AddSwitchListElement() [2/2]

void FCFSupport::SwitchList::AddSwitchListElement ( const Industry pickloc,
const Car pickcar,
const Train picktrain,
const Train lasttrain,
const Station sstop 
)

Add a switch list element for a local freight (station stop).

Parameters
picklocPickup location of car.
pickcarCar being picked up by this train.
picktrainTrain picking this car up.
lasttrainThe last train this car was on.
sstopWhere this train will drop this car.

◆ DiscardSwitchList()

void FCFSupport::SwitchList::DiscardSwitchList ( )

Clobber the switch list.

◆ LimitCars()

int FCFSupport::SwitchList::LimitCars ( ) const
inline

Return the limit count.

◆ NextSwitchListForCarAndIndustry()

int FCFSupport::SwitchList::NextSwitchListForCarAndIndustry ( const Car car,
const Industry industry 
)

Return the next switch list list element for a selected car and industry.

Parameters
carThe selected car.
industryThe selected industry.

◆ operator[]() [1/2]

SwitchListElement& FCFSupport::SwitchList::operator[] ( int  ielement)

Random index access to the switch list.

Parameters
ielementThe index into the switch list.

◆ operator[]() [2/2]

const SwitchListElement FCFSupport::SwitchList::operator[] ( int  ielement) const

Random index access to the switch list, const version.

Parameters
ielementThe index into the switch list.

◆ PickCarEq()

bool FCFSupport::SwitchList::PickCarEq ( int  Gx,
const Car Cx 
) const

Is the selected element for the specificed car?

Parameters
GxThe index to check.
CxThe car to check for.

◆ PickIndex()

unsigned int FCFSupport::SwitchList::PickIndex ( ) const
inline

Return the pick index.

◆ PickLocationEq()

bool FCFSupport::SwitchList::PickLocationEq ( int  Gx,
const Industry Ix 
) const

Is the selected element for the specificed industry?

Parameters
GxThe index to check.
IxThe industry to check for.

◆ PickTrainEq()

bool FCFSupport::SwitchList::PickTrainEq ( int  Gx,
const Train Tx 
) const

Is the selected element for the specificed train?

Parameters
GxThe index to check.
TxThe train to check for.

◆ ResetLastIndex()

void FCFSupport::SwitchList::ResetLastIndex ( )
inline

Reset the last index.

References FCFSupport::operator<<(), and lcc::stream.

◆ ResetSwitchList()

void FCFSupport::SwitchList::ResetSwitchList ( )

Reset the switch list pointer.

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  stream,
const SwitchList list 
)
friend

Output stream operator for switch lists.

Parameters
streamThe stream to write to.
listThe switch list to write out.

Member Data Documentation

◆ lastIndex

int FCFSupport::SwitchList::lastIndex
private

The last index.

◆ limitCars

int FCFSupport::SwitchList::limitCars
private

The limit index.

◆ pickIndex

unsigned int FCFSupport::SwitchList::pickIndex
private

The pick index.

◆ theList

SwitchListElementVector FCFSupport::SwitchList::theList
private

The switch list vector.