 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
110 virtual void inform(std::string msg,
bool addType =
true);
114 template<
typename T,
typename... Targs>
115 void informf(
const std::string& format, T value, Targs... Fargs) {
121 (*this) <<
build(
"",
true);
122 _informf(format.c_str(), value, Fargs...);
138 virtual void clear();
166 inline std::string
build(
const std::string& msg,
bool addType) {
172 return "Warning: " + msg;
175 return "Error: " + msg;
178 return "Debug: " + msg;
181 return "GLDebug: " + msg;
196 template<
typename T,
typename... Targs>
197 void _informf(
const char* format, T value, Targs... Fargs) {
198 for (; *format !=
'\0'; format++) {
199 if (*format ==
'%') {
275 #define WRITE_WARNING(msg) MsgHandler::getWarningInstance()->inform(msg);
276 #define WRITE_WARNINGF(...) MsgHandler::getWarningInstance()->informf(__VA_ARGS__);
277 #define WRITE_MESSAGE(msg) MsgHandler::getMessageInstance()->inform(msg);
278 #define PROGRESS_BEGIN_MESSAGE(msg) MsgHandler::getMessageInstance()->beginProcessMsg((msg) + std::string(" ..."));
279 #define PROGRESS_DONE_MESSAGE() MsgHandler::getMessageInstance()->endProcessMsg("done.");
280 #define PROGRESS_BEGIN_TIME_MESSAGE(msg) SysUtils::getCurrentMillis(); MsgHandler::getMessageInstance()->beginProcessMsg((msg) + std::string(" ..."));
281 #define PROGRESS_TIME_MESSAGE(before) MsgHandler::getMessageInstance()->endProcessMsg("done (" + toString(SysUtils::getCurrentMillis() - before) + "ms).");
282 #define PROGRESS_FAILED_MESSAGE() MsgHandler::getMessageInstance()->endProcessMsg("failed.");
283 #define WRITE_ERROR(msg) MsgHandler::getErrorInstance()->inform(msg);
284 #define WRITE_DEBUG(msg) if(MsgHandler::writeDebugMessages()){MsgHandler::getDebugInstance()->inform(msg);};
285 #define WRITE_GLDEBUG(msg) if(MsgHandler::writeDebugGLMessages()){MsgHandler::getGLDebugInstance()->inform(msg);};
@ MT_ERROR
The message is an error.
void setAggregationThreshold(const int thresh)
void _informf(const char *format, T value, Targs... Fargs)
adds a new formatted message
static void initOutputOptions()
init output options
bool wasInformed() const
Returns the information whether any messages were added.
Static storage of an output device and its base (abstract) implementation.
static void removeRetrieverFromAllInstances(OutputDevice *out)
ensure that that given output device is no longer used as retriever by any instance
@ MT_MESSAGE
The message is only something to show.
void _informf(const char *format)
@ MT_WARNING
The message is a warning.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
bool isRetriever(OutputDevice *retriever) const
Returns whether the given output device retrieves messages from the handler.
virtual void beginProcessMsg(std::string msg, bool addType=true)
Begins a process information.
static bool writeDebugMessages()
check whether to enable/disable debug messages
MsgHandler(const MsgHandler &s)=delete
invalid copy constructor
std::string build(const std::string &msg, bool addType)
Builds the string which includes the mml-message type.
bool myWasInformed
information whether an output occurred at all
std::map< const std::string, int > myAggregationCount
count for messages of the same type
static void cleanupOnEnd()
Removes pending handler.
static MsgHandler * myErrorInstance
The instance to handle errors.
static bool myAmProcessingProcess
Information whether a process information is printed to cout.
virtual void clear()
Clears information whether an error occurred previously.
static void enableDebugGLMessages(bool enable)
enable/disable gl-debug messages
MsgHandler *(* Factory)(MsgType)
static void setFactory(Factory func)
Sets the factory function to use for new MsgHandlers.
static MsgHandler * myWarningInstance
The instance to handle warnings.
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
virtual void endProcessMsg(std::string msg)
Ends a process information.
MsgHandler(MsgType type)
standard constructor
static bool myWriteDebugGLMessages
static MsgHandler * getGLDebugInstance()
Returns the instance to add GLdebug to.
static Factory myFactory
The function to call for new MsgHandlers, nullptr means use default constructor.
MsgHandler & operator<<(const T &t)
Generic output operator.
MsgHandler & operator=(const MsgHandler &s)=delete
invalid assignment operator
static MsgHandler * myMessageInstance
The instance to handle normal messages.
static MsgHandler * myDebugInstance
The instance to handle debug.
int myAggregationThreshold
do not output more messages of the same type if the count exceeds this threshold
static MsgHandler * getDebugInstance()
Returns the instance to add debug to.
@ MT_DEBUG
The message is an debug.
static bool writeDebugGLMessages()
check whether to enable/disable gl-debug messages
virtual void addRetriever(OutputDevice *retriever)
Adds a further retriever to the instance responsible for a certain msg type.
void informf(const std::string &format, T value, Targs... Fargs)
adds a new formatted message
std::vector< OutputDevice * > myRetrievers
The list of retrievers that shall be informed about new messages or errors.
@ MT_GLDEBUG
The message is an debug.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
MsgType myType
The type of the instance.
static MsgHandler * myGLDebugInstance
The instance to handle glDebug.
static bool myWriteDebugMessages
Flag to enable or disable debug GL Functions.
virtual ~MsgHandler()
destructor
virtual void removeRetriever(OutputDevice *retriever)
Removes the retriever from the handler.
static void enableDebugMessages(bool enable)
enable/disable debug messages
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.