Sim Class Reference

A class to represent the simulation handler. More...

#include <Sim.h>

Collaboration diagram for Sim:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void setFileIn (string file)
 Sets the file to read input from.
void setFileOut (string file)
 Sets the file to write output to.
void setFileType (WORD fileType)
 Sets the file type of the input.
void setNoLanesDirPos (int nlpos)
 Sets the number of lanes in the positive direction.
void setNoLanesDirNeg (int nlneg)
 Sets the number of lanes in the negative direction.
void setSimTimeStep (double ts)
 Sets the size of the timestep.
void setNoDirections (int nd)
 Sets the number of directions.
void setNoLanes (int nl)
 Sets the number of lanes.
void setRoadLength (int L)
 Sets the length of the road.
double getCurrentSimTime ()
 Gets the current time of the simulation.
RoadgetRoad ()
 Gets the simulation's road object.
double getRoadLength ()
 Gets the length of the road.
M2D getPositions ()
 Gets all the vehicles on the road.
M2D doOneTimeStep (bool *pInSimulation)
 Steps the simulation forward by one timestep.
void init ()
 Initialises the simulation.
 Sim ()
 Default Constructor.
virtual ~Sim ()
 Default Destructor.

Private Attributes

double m_CurrentSimTime
Road m_Road
M2D m_vVehicles
string m_FileIn
string m_FileOut
WORD m_FileType
int m_NoLanesDirPos
int m_NoLanesDirNeg
double m_SimTimeStep
int m_NoDirections
int m_NoLanes
int m_RoadLength


Detailed Description

A class to represent the simulation handler.

Constructor & Destructor Documentation

Sim::Sim (  ) 

Default Constructor.

Sim::~Sim (  )  [virtual]

Default Destructor.


Member Function Documentation

void Sim::setFileIn ( string  file  ) 

Sets the file to read input from.

Parameters:
file The file to read input from

void Sim::setFileOut ( string  file  ) 

Sets the file to write output to.

Parameters:
file The file to write output to

void Sim::setFileType ( WORD  fileType  ) 

Sets the file type of the input.

Parameters:
fileType The file type of the input

void Sim::setNoLanesDirPos ( int  nlpos  ) 

Sets the number of lanes in the positive direction.

Parameters:
nlpos The number of lanes in the positive direction

void Sim::setNoLanesDirNeg ( int  nlneg  ) 

Sets the number of lanes in the negative direction.

Parameters:
nlneg The number of lanes in the negative direction

void Sim::setSimTimeStep ( double  ts  ) 

Sets the size of the timestep.

Parameters:
ts The size of the timestep

void Sim::setNoDirections ( int  nd  ) 

Sets the number of directions.

Parameters:
nd The number of directions

void Sim::setNoLanes ( int  nl  ) 

Sets the number of lanes.

Parameters:
nl The number of lanes

void Sim::setRoadLength ( int  L  ) 

Sets the length of the road.

Parameters:
L The length of the road

double Sim::getCurrentSimTime (  ) 

Gets the current time of the simulation.

Returns:
The current time of the simulation

Road * Sim::getRoad (  ) 

Gets the simulation's road object.

Returns:
The simulation's road object

double Sim::getRoadLength (  ) 

Gets the length of the road.

Returns:
The length of the road

M2D Sim::getPositions (  ) 

Gets all the vehicles on the road.

Returns:
All the vehicles on the road

M2D Sim::doOneTimeStep ( bool *  pInSimulation  ) 

Steps the simulation forward by one timestep.

Parameters:
pInSimulation Whether or not the simulation is still running
Returns:
All of the vehicles currently on the Road
This function is called while the simulation is running. It firstly populates the road each step, by calling Road.populate(), and then updates each vehicle on the road by calling Road.update(). In addition to this, the function return all of the vehicles currently on the road.

void Sim::init (  ) 

Initialises the simulation.

This function takes data which has been passed from the Graphical User Interface, and initialises the Road object with this data.


Member Data Documentation

double Sim::m_CurrentSimTime [private]

Road Sim::m_Road [private]

M2D Sim::m_vVehicles [private]

string Sim::m_FileIn [private]

string Sim::m_FileOut [private]

WORD Sim::m_FileType [private]

int Sim::m_NoLanesDirPos [private]

int Sim::m_NoLanesDirNeg [private]

double Sim::m_SimTimeStep [private]

int Sim::m_NoDirections [private]

int Sim::m_NoLanes [private]

int Sim::m_RoadLength [private]


The documentation for this class was generated from the following files:

Generated on Fri Jul 25 16:11:21 2008 for EvolveTraffic by  doxygen 1.5.6