55 myNet(nullptr), myHalting(true), myQuit(false), mySimulationInProgress(false), myOk(true), myHaveSignaledEnd(false),
56 mySimDelay(simDelay), myEventQue(eq), myEventThrow(ev),
57 myLastBreakMillis(0) {
97 if (std::string(e2.what()) != std::string(
"Process Error") && std::string(e2.what()) != std::string(
"")) {
215 if (std::string(e2.what()) != std::string(
"Process Error") && std::string(e2.what()) != std::string(
"")) {
272 return myNet !=
nullptr;
285 if (
myNet !=
nullptr) {
342 window->getView()->waitForSnapshots(snapshotTime);
#define WRITE_MESSAGE(msg)
std::string time2string(SUMOTime t)
convert SUMOTime to string
static void sleep(long ms)
Event sent when the the simulation is over.
void clear()
Clears this container.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
const std::vector< GUIGlChildWindow * > & getViews() const
get views
static GUIMainWindow * getInstance()
get instance
A MSNet extended by some values for usage within the gui.
void setIdleDuration(int val)
Sets the duration of the last step's idle part.
void simulationStep()
Performs a single simulation step (locking the simulation)
void setSimDuration(int val)
Sets the duration of the last step's simulation part.
void guiSimulationStep()
Some further steps needed for gui processing.
OutputDevice * myErrorRetriever
The instances of message retriever encapsulations Needed to be deleted from the handler later on.
GUINet * myNet
the loaded simulation network
FXMutex myBreakpointLock
Lock for modifying the list of breakpoints.
FXEX::FXThreadEvent & myEventThrow
std::vector< SUMOTime > myBreakpoints
List of breakpoints.
virtual FXint run()
starts the execution
virtual bool simulationIsStartable() const
GUIRunThread(FXApp *app, MFXInterThreadEventClient *mw, double &simDelay, FXSynchQue< GUIEvent * > &eq, FXEX::FXThreadEvent &ev)
constructor
FXSynchQue< GUIEvent * > & myEventQue
virtual bool simulationIsStepable() const
bool mySimulationInProgress
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
bool myHalting
information whether the simulation is halting (is not being executed)
virtual ~GUIRunThread()
destructor
virtual bool simulationIsStopable() const
OutputDevice * myMessageRetriever
OutputDevice * myWarningRetriever
bool simulationAvailable() const
void retrieveMessage(const MsgHandler::MsgType type, const std::string &msg)
Retrieves messages from the loading module.
void waitForSnapshots(const SUMOTime snapshotTime)
SUMOTime mySimStartTime
the times the simulation starts and ends with
void prepareDestruction()
long myLastBreakMillis
last time the simulation took a microsecond break for the fox event loop to catch up (#9028)
bool myHaveSignaledEnd
whether the simulation already ended
SimulationState
Possible states of a simulation - running or stopped with different reasons.
@ SIMSTATE_TOO_MANY_TELEPORTS
The simulation had too many teleports.
@ SIMSTATE_NO_FURTHER_VEHICLES
The simulation does not contain further vehicles.
@ SIMSTATE_LOADING
The simulation is loading.
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
@ SIMSTATE_CONNECTION_CLOSED
The connection to a client was closed by the client.
@ SIMSTATE_END_STEP_REACHED
The final simulation step has been performed.
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
SimulationState adaptToState(const SimulationState state) const
Called after a simulation step, this method adapts the current simulation state if necessary.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
void loadRoutes()
loads routes for the next few steps
virtual void addRetriever(OutputDevice *retriever)
Adds a further retriever to the instance responsible for a certain msg type.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
static void cleanupOnEnd()
Removes pending handler.
virtual void removeRetriever(OutputDevice *retriever)
Removes the retriever from the handler.
@ MT_MESSAGE
The message is only something to show.
@ MT_ERROR
The message is an error.
@ MT_WARNING
The message is a warning.
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
Encapsulates an object's method for using it as a message retriever.
static OptionsCont & getOptions()
Retrieves the options.
static void closeAll(bool keepErrorRetrievers=false)
static long getCurrentMillis()
Returns the current time in milliseconds.