SUMO - Simulation of Urban MObility
GUIRunThread Class Reference

#include <GUIRunThread.h>

Inheritance diagram for GUIRunThread:
Inheritance graph
Collaboration diagram for GUIRunThread:
Collaboration graph

Public Types

enum  { ID_THREAD_EVENT }
 

Public Member Functions

virtual void begin ()
 
virtual void deleteSim ()
 
FXMutex & getBreakpointLock ()
 
std::vector< SUMOTime > & getBreakpoints ()
 
GUINetgetNet () const
 
SUMOTime getSimEndTime () const
 
 GUIRunThread (FXApp *app, MFXInterThreadEventClient *mw, double &simDelay, MFXEventQue< GUIEvent *> &eq, FXEX::FXThreadEvent &ev)
 constructor More...
 
virtual bool init (GUINet *net, SUMOTime start, SUMOTime end)
 initialises the thread with the new simulation More...
 
long onThreadEvent (FXObject *, FXSelector, void *)
 
long onThreadSignal (FXObject *, FXSelector, void *)
 
void prepareDestruction ()
 
void resume ()
 
void retrieveMessage (const MsgHandler::MsgType type, const std::string &msg)
 Retrieves messages from the loading module. More...
 
virtual FXint run ()
 starts the execution More...
 
void signal ()
 
void signal (FXuint seltype)
 
bool simulationAvailable () const
 
virtual bool simulationIsStartable () const
 
virtual bool simulationIsStepable () const
 
virtual bool simulationIsStopable () const
 
void singleStep ()
 
void stop ()
 
virtual ~GUIRunThread ()
 destructor More...
 

Static Public Member Functions

static void sleep (long ms)
 

Protected Member Functions

void makeStep ()
 
void waitForSnapshots (const SUMOTime snapshotTime)
 

Protected Attributes

FXMutex myBreakpointLock
 Lock for modifying the list of breakpoints. More...
 
std::vector< SUMOTimemyBreakpoints
 List of breakpoints. More...
 
OutputDevicemyErrorRetriever
 The instances of message retriever encapsulations Needed to be deleted from the handler later on. More...
 
MFXEventQue< GUIEvent * > & myEventQue
 
FXEX::FXThreadEventmyEventThrow
 
bool myHalting
 information whether the simulation is halting (is not being executed) More...
 
bool myHaveSignaledEnd
 whether the simulation already ended More...
 
OutputDevicemyMessageRetriever
 
GUINetmyNet
 the loaded simulation network More...
 
bool myOk
 
bool myQuit
 
double & mySimDelay
 
SUMOTime mySimEndTime
 
SUMOTime mySimStartTime
 the times the simulation starts and ends with More...
 
bool mySimulationInProgress
 
MFXMutex mySimulationLock
 
bool mySingle
 
OutputDevicemyWarningRetriever
 

Detailed Description

This thread executes the given simulation stepwise to allow parallel visualisation. The avoidance of collisions between the simulation execution and its visualisation is done individually for every lane using mutexes

Definition at line 58 of file GUIRunThread.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
ID_THREAD_EVENT 

Definition at line 46 of file FXSingleEventThread.h.

Constructor & Destructor Documentation

◆ GUIRunThread()

GUIRunThread::GUIRunThread ( FXApp *  app,
MFXInterThreadEventClient mw,
double &  simDelay,
MFXEventQue< GUIEvent *> &  eq,
FXEX::FXThreadEvent ev 
)

◆ ~GUIRunThread()

GUIRunThread::~GUIRunThread ( )
virtual

Member Function Documentation

◆ begin()

void GUIRunThread::begin ( )
virtual

starts the simulation (execution of one step after another)

Definition at line 259 of file GUIRunThread.cpp.

References myOk, mySimStartTime, time2string(), and WRITE_MESSAGE.

Referenced by GUIApplicationWindow::onCmdStart(), and GUIApplicationWindow::onCmdStep().

◆ deleteSim()

◆ getBreakpointLock()

◆ getBreakpoints()

std::vector<SUMOTime>& GUIRunThread::getBreakpoints ( )
inline

◆ getNet()

◆ getSimEndTime()

SUMOTime GUIRunThread::getSimEndTime ( ) const
inline

Definition at line 106 of file GUIRunThread.h.

References mySimEndTime.

Referenced by GUIApplicationWindow::updateTimeLCD().

◆ init()

◆ makeStep()

◆ onThreadEvent()

long FXSingleEventThread::onThreadEvent ( FXObject *  ,
FXSelector  ,
void *   
)
inherited

Definition at line 125 of file FXSingleEventThread.cpp.

◆ onThreadSignal()

long FXSingleEventThread::onThreadSignal ( FXObject *  ,
FXSelector  ,
void *   
)
inherited

Definition at line 110 of file FXSingleEventThread.cpp.

References PIPE_READ, FXEX::SEL_THREAD, and UNUSED_PARAMETER.

◆ prepareDestruction()

void GUIRunThread::prepareDestruction ( )

halts the thread before it shall be deleted

Definition at line 308 of file GUIRunThread.cpp.

References myHalting, and myQuit.

Referenced by GUIApplicationWindow::~GUIApplicationWindow().

◆ resume()

void GUIRunThread::resume ( )

called when the user presses the "resume"-button, this method resumes the execution after a break

Definition at line 245 of file GUIRunThread.cpp.

References myHalting, and mySingle.

Referenced by GUIApplicationWindow::onCmdStart().

◆ retrieveMessage()

void GUIRunThread::retrieveMessage ( const MsgHandler::MsgType  type,
const std::string &  msg 
)

Retrieves messages from the loading module.

Definition at line 315 of file GUIRunThread.cpp.

References MFXEventQue< T >::add(), myEventQue, myEventThrow, and FXEX::FXThreadEvent::signal().

Referenced by GUIRunThread().

◆ run()

◆ signal() [1/2]

void FXSingleEventThread::signal ( )
inherited

Definition at line 86 of file FXSingleEventThread.cpp.

References PIPE_WRITE, FXEX::SEL_THREAD, and UNUSED_PARAMETER.

◆ signal() [2/2]

void FXSingleEventThread::signal ( FXuint  seltype)
inherited

Definition at line 98 of file FXSingleEventThread.cpp.

References PIPE_WRITE, and UNUSED_PARAMETER.

◆ simulationAvailable()

◆ simulationIsStartable()

bool GUIRunThread::simulationIsStartable ( ) const
virtual

◆ simulationIsStepable()

bool GUIRunThread::simulationIsStepable ( ) const
virtual

Definition at line 335 of file GUIRunThread.cpp.

References myHalting, and myNet.

Referenced by GUIApplicationWindow::onUpdStep().

◆ simulationIsStopable()

bool GUIRunThread::simulationIsStopable ( ) const
virtual

Definition at line 329 of file GUIRunThread.cpp.

References myHalting, and myNet.

Referenced by GUIApplicationWindow::onUpdStop().

◆ singleStep()

void GUIRunThread::singleStep ( )

called when the user presses the "single step"-button, this method allows the thread to perform a single simulation step

Definition at line 252 of file GUIRunThread.cpp.

References myHalting, and mySingle.

Referenced by GUIApplicationWindow::onCmdStep().

◆ sleep()

void FXSingleEventThread::sleep ( long  ms)
staticinherited

◆ stop()

void GUIRunThread::stop ( )

halts the simulation execution

Definition at line 267 of file GUIRunThread.cpp.

References myHalting, and mySingle.

Referenced by GUIApplicationWindow::onCmdStop(), and run().

◆ waitForSnapshots()

void GUIRunThread::waitForSnapshots ( const SUMOTime  snapshotTime)
protected

Definition at line 341 of file GUIRunThread.cpp.

References GUIMainWindow::getInstance(), and GUIMainWindow::getViews().

Referenced by getBreakpointLock(), and run().

Field Documentation

◆ myBreakpointLock

FXMutex GUIRunThread::myBreakpointLock
protected

Lock for modifying the list of breakpoints.

Definition at line 166 of file GUIRunThread.h.

Referenced by getBreakpointLock(), and run().

◆ myBreakpoints

std::vector<SUMOTime> GUIRunThread::myBreakpoints
protected

List of breakpoints.

Definition at line 163 of file GUIRunThread.h.

Referenced by getBreakpoints(), and run().

◆ myErrorRetriever

OutputDevice* GUIRunThread::myErrorRetriever
protected

The instances of message retriever encapsulations Needed to be deleted from the handler later on.

Definition at line 152 of file GUIRunThread.h.

Referenced by deleteSim(), GUIRunThread(), init(), and ~GUIRunThread().

◆ myEventQue

MFXEventQue<GUIEvent*>& GUIRunThread::myEventQue
protected

Definition at line 156 of file GUIRunThread.h.

Referenced by makeStep(), and retrieveMessage().

◆ myEventThrow

FXEX::FXThreadEvent& GUIRunThread::myEventThrow
protected

Definition at line 158 of file GUIRunThread.h.

Referenced by makeStep(), and retrieveMessage().

◆ myHalting

bool GUIRunThread::myHalting
protected

information whether the simulation is halting (is not being executed)

Definition at line 131 of file GUIRunThread.h.

Referenced by deleteSim(), init(), makeStep(), prepareDestruction(), resume(), run(), simulationIsStartable(), simulationIsStepable(), simulationIsStopable(), singleStep(), and stop().

◆ myHaveSignaledEnd

bool GUIRunThread::myHaveSignaledEnd
protected

whether the simulation already ended

Definition at line 148 of file GUIRunThread.h.

Referenced by makeStep().

◆ myMessageRetriever

OutputDevice * GUIRunThread::myMessageRetriever
protected

Definition at line 152 of file GUIRunThread.h.

Referenced by deleteSim(), GUIRunThread(), init(), and ~GUIRunThread().

◆ myNet

GUINet* GUIRunThread::myNet
protected

◆ myOk

bool GUIRunThread::myOk
protected

Definition at line 142 of file GUIRunThread.h.

Referenced by begin(), init(), makeStep(), and run().

◆ myQuit

bool GUIRunThread::myQuit
protected

information whether the thread shall be stopped (if not, the thread stays in an endless loop)

Definition at line 135 of file GUIRunThread.h.

Referenced by prepareDestruction(), run(), and ~GUIRunThread().

◆ mySimDelay

double& GUIRunThread::mySimDelay
protected

Definition at line 154 of file GUIRunThread.h.

Referenced by run().

◆ mySimEndTime

SUMOTime GUIRunThread::mySimEndTime
protected

Definition at line 128 of file GUIRunThread.h.

Referenced by getSimEndTime(), init(), and makeStep().

◆ mySimStartTime

SUMOTime GUIRunThread::mySimStartTime
protected

the times the simulation starts and ends with

Definition at line 128 of file GUIRunThread.h.

Referenced by begin(), deleteSim(), and init().

◆ mySimulationInProgress

bool GUIRunThread::mySimulationInProgress
protected

information whether a simulation step is being performed (otherwise the thread may be waiting or the simulation is maybe not performed at all)

Definition at line 140 of file GUIRunThread.h.

Referenced by deleteSim(), init(), makeStep(), and ~GUIRunThread().

◆ mySimulationLock

MFXMutex GUIRunThread::mySimulationLock
protected

Definition at line 160 of file GUIRunThread.h.

Referenced by deleteSim(), init(), and makeStep().

◆ mySingle

bool GUIRunThread::mySingle
protected

information whether the thread is running in single step mode

Definition at line 145 of file GUIRunThread.h.

Referenced by makeStep(), resume(), singleStep(), and stop().

◆ myWarningRetriever

OutputDevice * GUIRunThread::myWarningRetriever
protected

Definition at line 152 of file GUIRunThread.h.

Referenced by deleteSim(), GUIRunThread(), init(), and ~GUIRunThread().


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