55 myNet(nullptr), myHalting(true), myQuit(false), mySimulationInProgress(false), myOk(true), myHaveSignaledEnd(false),
56 mySimDelay(simDelay), myEventQue(eq), myEventThrow(ev),
57 myLastEndMillis(-1), myLastBreakMillis(0), myAmLibsumo(false) {
97 if (std::string(e2.what()) != std::string(
"Process Error") && std::string(e2.what()) != std::string(
"")) {
222 if (std::string(e2.what()) != std::string(
"Process Error") && std::string(e2.what()) != std::string(
"")) {
279 return myNet !=
nullptr;
294 if (
myNet !=
nullptr) {
353 window->getView()->waitForSnapshots(snapshotTime);
#define WRITE_MESSAGEF(...)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
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.
std::vector< SUMOTime > myBreakpoints
List of breakpoints.
virtual FXint run()
starts the execution
FXEX::MFXThreadEvent & myEventThrow
virtual bool simulationIsStartable() const
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
long myLastEndMillis
end of the last simulation step
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
bool myAmLibsumo
whether we are running in libsumo
void prepareDestruction()
long myLastBreakMillis
last time the simulation took a microsecond break for the fox event loop to catch up (#9028)
MFXSynchQue< GUIEvent * > & myEventQue
GUIRunThread(FXApp *app, MFXInterThreadEventClient *mw, double &simDelay, MFXSynchQue< GUIEvent * > &eq, FXEX::MFXThreadEvent &ev)
constructor
bool myHaveSignaledEnd
whether the simulation already ended
static void sleep(long ms)
FXApp * myApp
pointer to APP
SimulationState adaptToState(const SimulationState state, const bool isLibsumo=false) const
Called after a simulation step, this method adapts the current simulation state if necessary.
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.
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.
virtual void clear(bool resetInformed=true)
Clears information whether an error occurred previously and print aggregated message summary.
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.