![]() |
Eclipse SUMO - Simulation of Urban MObility
|
#include <MsgHandlerSynchronized.h>
Public Types | |
enum | MsgType { MT_MESSAGE, MT_WARNING, MT_ERROR, MT_DEBUG, MT_GLDEBUG } |
Public Member Functions | |
void | addRetriever (OutputDevice *retriever) |
Adds a further retriever to the instance responsible for a certain msg type. More... | |
void | beginProcessMsg (std::string msg, bool addType=true) |
Begins a process information. More... | |
void | clear () |
Clears information whether an error occurred previously. More... | |
void | endProcessMsg (std::string msg) |
Ends a process information. More... | |
void | inform (std::string msg, bool addType=true) |
adds a new error to the list More... | |
bool | isRetriever (OutputDevice *retriever) const |
Returns whether the given output device retrieves messages from the handler. More... | |
template<class T > | |
MsgHandler & | operator<< (const T &t) |
Generic output operator. More... | |
void | removeRetriever (OutputDevice *retriever) |
Removes the retriever from the handler. More... | |
bool | wasInformed () const |
Returns the information whether any messages were added. More... | |
Static Public Member Functions | |
static void | cleanupOnEnd () |
Removes pending handler. More... | |
static MsgHandler * | create (MsgType type) |
static void | enableDebugGLMessages (bool enable) |
enable/disable gl-debug messages More... | |
static void | enableDebugMessages (bool enable) |
enable/disable debug messages More... | |
static MsgHandler * | getDebugInstance () |
Returns the instance to add debug to. More... | |
static MsgHandler * | getErrorInstance () |
Returns the instance to add errors to. More... | |
static MsgHandler * | getGLDebugInstance () |
Returns the instance to add GLdebug to. More... | |
static MsgHandler * | getMessageInstance () |
Returns the instance to add normal messages to. More... | |
static MsgHandler * | getWarningInstance () |
Returns the instance to add warnings to. More... | |
static void | initOutputOptions () |
init output options More... | |
static void | removeRetrieverFromAllInstances (OutputDevice *out) |
ensure that that given output device is no longer used as retriever by any instance More... | |
static void | setFactory (Factory func) |
Sets the factory function to use for new MsgHandlers. More... | |
static bool | writeDebugGLMessages () |
check whether to enable/disable gl-debug messages More... | |
static bool | writeDebugMessages () |
check whether to enable/disable debug messages More... | |
Protected Member Functions | |
std::string | build (const std::string &msg, bool addType) |
Builds the string which includes the mml-message type. More... | |
Private Member Functions | |
MsgHandlerSynchronized (MsgType type) | |
standard constructor More... | |
MsgHandlerSynchronized (const MsgHandlerSynchronized &s)=delete | |
invalid copy constructor More... | |
MsgHandlerSynchronized & | operator= (const MsgHandlerSynchronized &s)=delete |
invalid assignment operator More... | |
~MsgHandlerSynchronized () | |
destructor More... | |
Static Private Attributes | |
static FXMutex | myLock |
The lock for synchronizing all outputs using handlers of this class. More... | |
Definition at line 49 of file MsgHandlerSynchronized.h.
|
inherited |
An enumeration to differ between different types of messages (errors, warning and information)
Definition at line 51 of file MsgHandler.h.
|
private |
standard constructor
Definition at line 96 of file MsgHandlerSynchronized.cpp.
Referenced by create().
|
private |
|
privatedelete |
invalid copy constructor
|
virtual |
Adds a further retriever to the instance responsible for a certain msg type.
Reimplemented from MsgHandler.
Definition at line 79 of file MsgHandlerSynchronized.cpp.
References MsgHandler::addRetriever(), and myLock.
Referenced by create().
|
virtual |
Begins a process information.
When a longer action is started, this method should be used to inform the user about it. There will be no newline printed, but the message handler will be informed that a process message has been begun. If an error occurs, a newline will be printed. After the action has been performed, use endProcessMsg to inform the user about it.
Reimplemented from MsgHandler.
Definition at line 52 of file MsgHandlerSynchronized.cpp.
References MsgHandler::beginProcessMsg(), and myLock.
Referenced by create().
|
inlineprotectedinherited |
Builds the string which includes the mml-message type.
Definition at line 157 of file MsgHandler.h.
References MsgHandler::MsgHandler(), MsgHandler::MT_DEBUG, MsgHandler::MT_ERROR, MsgHandler::MT_GLDEBUG, MsgHandler::MT_MESSAGE, MsgHandler::MT_WARNING, MsgHandler::myType, and MsgHandler::~MsgHandler().
Referenced by MsgHandler::beginProcessMsg(), and MsgHandler::inform().
|
staticinherited |
Removes pending handler.
Definition at line 241 of file MsgHandler.cpp.
References MsgHandler::myDebugInstance, MsgHandler::myErrorInstance, MsgHandler::myGLDebugInstance, MsgHandler::myMessageInstance, and MsgHandler::myWarningInstance.
Referenced by SystemFrame::close(), GUIRunThread::deleteSim(), and MsgHandler::writeDebugGLMessages().
|
virtual |
Clears information whether an error occurred previously.
Reimplemented from MsgHandler.
Definition at line 70 of file MsgHandlerSynchronized.cpp.
References MsgHandler::clear(), and myLock.
Referenced by create().
|
inlinestatic |
Definition at line 51 of file MsgHandlerSynchronized.h.
References addRetriever(), beginProcessMsg(), clear(), endProcessMsg(), inform(), MsgHandlerSynchronized(), removeRetriever(), and ~MsgHandlerSynchronized().
Referenced by main().
|
staticinherited |
enable/disable gl-debug messages
Definition at line 113 of file MsgHandler.cpp.
References MsgHandler::myWriteDebugGLMessages.
Referenced by GUIDialog_Options::InputBool::onCmdSetOption(), GNELoadThread::run(), and MsgHandler::setFactory().
|
staticinherited |
enable/disable debug messages
Definition at line 108 of file MsgHandler.cpp.
References MsgHandler::myWriteDebugMessages.
Referenced by GUIDialog_Options::InputBool::onCmdSetOption(), GNELoadThread::run(), and MsgHandler::setFactory().
|
virtual |
Ends a process information.
Reimplemented from MsgHandler.
Definition at line 61 of file MsgHandlerSynchronized.cpp.
References MsgHandler::endProcessMsg(), and myLock.
Referenced by create().
|
staticinherited |
Returns the instance to add debug to.
Definition at line 90 of file MsgHandler.cpp.
References MsgHandler::MsgHandler(), MsgHandler::MT_DEBUG, and MsgHandler::myDebugInstance.
Referenced by GUIMessageWindow::registerMsgHandlers(), GNELoadThread::run(), MsgHandler::setFactory(), GNELoadThread::submitEndAndCleanup(), and GUIMessageWindow::unregisterMsgHandlers().
|
staticinherited |
Returns the instance to add errors to.
Definition at line 81 of file MsgHandler.cpp.
References MsgHandler::MsgHandler(), MsgHandler::MT_ERROR, and MsgHandler::myErrorInstance.
Referenced by NLHandler::addPhase(), MSRouteHandler::addStop(), GNERouteHandler::addStop(), NLBuilder::build(), MSSOTLTrafficLightLogic::checkPhases(), OutputDevice::closeAll(), RORouteHandler::closeFlow(), RORouteHandler::closeVehicle(), ROJTRRouter::compute(), GUIRunThread::deleteSim(), GNELoadThread::GNELoadThread(), GUILoadThread::GUILoadThread(), GUIRunThread::init(), NLBuilder::init(), MsgHandler::initOutputOptions(), PCLoaderOSM::loadIfSet(), loadJTRDefinitions(), NIImporter_ArcView::loadNetwork(), main(), GUIRunThread::makeStep(), MSPhaseDefinition::MSPhaseDefinition(), ROLoader::openRoutes(), RORouteDef::preComputeCurrentRoute(), ROLoader::processRoutes(), GUIMessageWindow::registerMsgHandlers(), RORouteDef::repairCurrentRoute(), GNELoadThread::run(), GUILoadThread::run(), XMLSubSys::runParser(), RONet::saveAndRemoveRoutesUntil(), MsgHandler::setFactory(), MSSOTLTrafficLightLogic::setToATargetPhase(), GUILoadThread::submitEndAndCleanup(), GNELoadThread::submitEndAndCleanup(), and GUIMessageWindow::unregisterMsgHandlers().
|
staticinherited |
Returns the instance to add GLdebug to.
Definition at line 99 of file MsgHandler.cpp.
References MsgHandler::MsgHandler(), MsgHandler::MT_GLDEBUG, and MsgHandler::myGLDebugInstance.
Referenced by GUIMessageWindow::registerMsgHandlers(), GNELoadThread::run(), MsgHandler::setFactory(), GNELoadThread::submitEndAndCleanup(), and GUIMessageWindow::unregisterMsgHandlers().
|
staticinherited |
Returns the instance to add normal messages to.
Definition at line 59 of file MsgHandler.cpp.
References MsgHandler::MsgHandler(), MsgHandler::MT_MESSAGE, MsgHandler::myFactory, and MsgHandler::myMessageInstance.
Referenced by CHBuilder< E, V >::buildContractionHierarchy(), MSDeterministicHiLevelTrafficLightLogic::decideNextPhase(), MSSwarmTrafficLightLogic::decideNextPhase(), GUIRunThread::deleteSim(), MsgHandler::inform(), GUIRunThread::init(), NLBuilder::init(), MsgHandler::initOutputOptions(), NBHeightMapper::loadIfSet(), MSSOTLPhaseTrafficLightLogic::MSSOTLPhaseTrafficLightLogic(), MSSOTLPolicyBasedTrafficLightLogic::MSSOTLPolicyBasedTrafficLightLogic(), MSSOTLWaveTrafficLightLogic::MSSOTLWaveTrafficLightLogic(), GUIMessageWindow::registerMsgHandlers(), GNELoadThread::run(), GUILoadThread::run(), MsgHandler::setFactory(), GUILoadThread::submitEndAndCleanup(), GNELoadThread::submitEndAndCleanup(), and GUIMessageWindow::unregisterMsgHandlers().
|
staticinherited |
Returns the instance to add warnings to.
Definition at line 72 of file MsgHandler.cpp.
References MsgHandler::MsgHandler(), MsgHandler::MT_WARNING, and MsgHandler::myWarningInstance.
Referenced by NLHandler::addPhase(), DijkstraRouter< E, V, BASE >::clone(), AStarRouter< MSEdge, SUMOVehicle, SUMOAbstractRouterPermissions< MSEdge, SUMOVehicle > >::clone(), CHRouter< E, V, BASE >::clone(), ROJTRRouter::compute(), GUIRunThread::deleteSim(), GUIRunThread::init(), NLBuilder::init(), MsgHandler::initOutputOptions(), PCLoaderOSM::loadIfSet(), NBLoadedTLDef::myCompute(), RORouteDef::preComputeCurrentRoute(), GUIMessageWindow::registerMsgHandlers(), RORouteDef::repairCurrentRoute(), GNELoadThread::run(), GUILoadThread::run(), RONet::saveAndRemoveRoutesUntil(), MsgHandler::setFactory(), GUILoadThread::submitEndAndCleanup(), GNELoadThread::submitEndAndCleanup(), TraCIServer::TraCIServer(), and GUIMessageWindow::unregisterMsgHandlers().
|
virtual |
adds a new error to the list
Reimplemented from MsgHandler.
Definition at line 43 of file MsgHandlerSynchronized.cpp.
References MsgHandler::inform(), and myLock.
Referenced by create().
|
staticinherited |
init output options
Definition at line 208 of file MsgHandler.cpp.
References MsgHandler::addRetriever(), OptionsCont::getBool(), OutputDevice::getDevice(), MsgHandler::getErrorInstance(), MsgHandler::getMessageInstance(), OptionsCont::getOptions(), OptionsCont::getString(), MsgHandler::getWarningInstance(), OptionsCont::isSet(), and MsgHandler::removeRetriever().
Referenced by NLBuilder::init(), main(), GNELoadThread::run(), GUILoadThread::run(), and MsgHandler::writeDebugGLMessages().
|
inherited |
Returns whether the given output device retrieves messages from the handler.
Definition at line 183 of file MsgHandler.cpp.
References MsgHandler::myRetrievers.
Referenced by MsgHandler::addRetriever(), OutputDevice::closeAll(), and MsgHandler::writeDebugGLMessages().
|
inlineinherited |
Generic output operator.
Definition at line 147 of file MsgHandler.h.
References MsgHandler::myRetrievers.
|
privatedelete |
invalid assignment operator
|
virtual |
Removes the retriever from the handler.
Reimplemented from MsgHandler.
Definition at line 88 of file MsgHandlerSynchronized.cpp.
References myLock, and MsgHandler::removeRetriever().
Referenced by create().
|
staticinherited |
ensure that that given output device is no longer used as retriever by any instance
Definition at line 189 of file MsgHandler.cpp.
References MsgHandler::myDebugInstance, MsgHandler::myErrorInstance, MsgHandler::myGLDebugInstance, MsgHandler::myMessageInstance, MsgHandler::myWarningInstance, and MsgHandler::removeRetriever().
Referenced by OutputDevice::close(), and MsgHandler::writeDebugGLMessages().
|
inlinestaticinherited |
Sets the factory function to use for new MsgHandlers.
Definition at line 69 of file MsgHandler.h.
References MsgHandler::enableDebugGLMessages(), MsgHandler::enableDebugMessages(), MsgHandler::getDebugInstance(), MsgHandler::getErrorInstance(), MsgHandler::getGLDebugInstance(), MsgHandler::getMessageInstance(), MsgHandler::getWarningInstance(), and MsgHandler::myFactory.
Referenced by main().
|
inherited |
Returns the information whether any messages were added.
Definition at line 270 of file MsgHandler.cpp.
References MsgHandler::myWasInformed.
Referenced by NLBuilder::build(), ROLoader::openRoutes(), ROLoader::processRoutes(), XMLSubSys::runParser(), and MsgHandler::writeDebugGLMessages().
|
inlinestaticinherited |
check whether to enable/disable gl-debug messages
Definition at line 100 of file MsgHandler.h.
References MsgHandler::addRetriever(), MsgHandler::beginProcessMsg(), MsgHandler::cleanupOnEnd(), MsgHandler::clear(), MsgHandler::endProcessMsg(), MsgHandler::inform(), MsgHandler::initOutputOptions(), MsgHandler::isRetriever(), MsgHandler::myWriteDebugGLMessages, MsgHandler::removeRetriever(), MsgHandler::removeRetrieverFromAllInstances(), and MsgHandler::wasInformed().
Referenced by SUMORTree::addAdditionalGLObject(), and SUMORTree::removeAdditionalGLObject().
|
inlinestaticinherited |
check whether to enable/disable debug messages
Definition at line 95 of file MsgHandler.h.
References MsgHandler::myWriteDebugMessages.
|
staticprivate |
The lock for synchronizing all outputs using handlers of this class.
Definition at line 87 of file MsgHandlerSynchronized.h.
Referenced by addRetriever(), beginProcessMsg(), clear(), endProcessMsg(), inform(), and removeRetriever().