Eclipse SUMO - Simulation of Urban MObility
MsgHandlerSynchronized Class Reference

#include <MsgHandlerSynchronized.h>

Inheritance diagram for MsgHandlerSynchronized:
Collaboration diagram for MsgHandlerSynchronized:

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 >
MsgHandleroperator<< (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 MsgHandlercreate (MsgType type)
 
static void enableDebugGLMessages (bool enable)
 enable/disable gl-debug messages More...
 
static void enableDebugMessages (bool enable)
 enable/disable debug messages More...
 
static MsgHandlergetDebugInstance ()
 Returns the instance to add debug to. More...
 
static MsgHandlergetErrorInstance ()
 Returns the instance to add errors to. More...
 
static MsgHandlergetGLDebugInstance ()
 Returns the instance to add GLdebug to. More...
 
static MsgHandlergetMessageInstance ()
 Returns the instance to add normal messages to. More...
 
static MsgHandlergetWarningInstance ()
 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...
 
MsgHandlerSynchronizedoperator= (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...
 

Detailed Description

Member Enumeration Documentation

◆ MsgType

enum MsgHandler::MsgType
inherited

An enumeration to differ between different types of messages (errors, warning and information)

Enumerator
MT_MESSAGE 

The message is only something to show.

MT_WARNING 

The message is a warning.

MT_ERROR 

The message is an error.

MT_DEBUG 

The message is an debug.

MT_GLDEBUG 

The message is an debug.

Definition at line 51 of file MsgHandler.h.

Constructor & Destructor Documentation

◆ MsgHandlerSynchronized() [1/2]

MsgHandlerSynchronized::MsgHandlerSynchronized ( MsgType  type)
private

standard constructor

Definition at line 96 of file MsgHandlerSynchronized.cpp.

Referenced by create().

◆ ~MsgHandlerSynchronized()

MsgHandlerSynchronized::~MsgHandlerSynchronized ( )
private

destructor

Definition at line 101 of file MsgHandlerSynchronized.cpp.

Referenced by create().

◆ MsgHandlerSynchronized() [2/2]

MsgHandlerSynchronized::MsgHandlerSynchronized ( const MsgHandlerSynchronized s)
privatedelete

invalid copy constructor

Member Function Documentation

◆ addRetriever()

void MsgHandlerSynchronized::addRetriever ( OutputDevice retriever)
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().

◆ beginProcessMsg()

void MsgHandlerSynchronized::beginProcessMsg ( std::string  msg,
bool  addType = true 
)
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().

◆ build()

std::string MsgHandler::build ( const std::string &  msg,
bool  addType 
)
inlineprotectedinherited

◆ cleanupOnEnd()

◆ clear()

void MsgHandlerSynchronized::clear ( )
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().

◆ create()

static MsgHandler* MsgHandlerSynchronized::create ( MsgType  type)
inlinestatic

◆ enableDebugGLMessages()

void MsgHandler::enableDebugGLMessages ( bool  enable)
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().

◆ enableDebugMessages()

void MsgHandler::enableDebugMessages ( bool  enable)
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().

◆ endProcessMsg()

void MsgHandlerSynchronized::endProcessMsg ( std::string  msg)
virtual

Ends a process information.

Reimplemented from MsgHandler.

Definition at line 61 of file MsgHandlerSynchronized.cpp.

References MsgHandler::endProcessMsg(), and myLock.

Referenced by create().

◆ getDebugInstance()

◆ getErrorInstance()

◆ getGLDebugInstance()

MsgHandler * MsgHandler::getGLDebugInstance ( )
staticinherited

◆ getMessageInstance()

◆ getWarningInstance()

◆ inform()

void MsgHandlerSynchronized::inform ( std::string  msg,
bool  addType = true 
)
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().

◆ initOutputOptions()

◆ isRetriever()

bool MsgHandler::isRetriever ( OutputDevice retriever) const
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().

◆ operator<<()

template<class T >
MsgHandler& MsgHandler::operator<< ( const T &  t)
inlineinherited

Generic output operator.

Returns
The MsgHandler for further processing

Definition at line 147 of file MsgHandler.h.

References MsgHandler::myRetrievers.

◆ operator=()

MsgHandlerSynchronized& MsgHandlerSynchronized::operator= ( const MsgHandlerSynchronized s)
privatedelete

invalid assignment operator

◆ removeRetriever()

void MsgHandlerSynchronized::removeRetriever ( OutputDevice retriever)
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().

◆ removeRetrieverFromAllInstances()

void MsgHandler::removeRetrieverFromAllInstances ( OutputDevice out)
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().

◆ setFactory()

static void MsgHandler::setFactory ( Factory  func)
inlinestaticinherited

◆ wasInformed()

bool MsgHandler::wasInformed ( ) const
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().

◆ writeDebugGLMessages()

◆ writeDebugMessages()

static bool MsgHandler::writeDebugMessages ( )
inlinestaticinherited

check whether to enable/disable debug messages

Definition at line 95 of file MsgHandler.h.

References MsgHandler::myWriteDebugMessages.

Field Documentation

◆ myLock

FXMutex MsgHandlerSynchronized::myLock
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().


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